Skip to content

Commit ac2e175

Browse files
committed
Rustup to *1.10.0-nightly (476fe6e 2016-05-21)*
1 parent 6dd608e commit ac2e175

File tree

3 files changed

+14
-15
lines changed

3 files changed

+14
-15
lines changed

src/shadow.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -208,15 +208,16 @@ fn lint_shadow<T>(cx: &LateContext, name: Name, span: Span, pattern_span: Span,
208208
let db = span_lint(cx,
209209
SHADOW_SAME,
210210
span,
211-
&format!("{} is shadowed by itself in {}",
211+
&format!("`{}` is shadowed by itself in `{}`",
212212
snippet(cx, pattern_span, "_"),
213213
snippet(cx, expr.span, "..")));
214+
214215
note_orig(cx, db, SHADOW_SAME, prev_span);
215216
} else if contains_self(name, expr) {
216217
let db = span_note_and_lint(cx,
217218
SHADOW_REUSE,
218219
pattern_span,
219-
&format!("{} is shadowed by {} which reuses the original value",
220+
&format!("`{}` is shadowed by `{}` which reuses the original value",
220221
snippet(cx, pattern_span, "_"),
221222
snippet(cx, expr.span, "..")),
222223
expr.span,
@@ -226,7 +227,7 @@ fn lint_shadow<T>(cx: &LateContext, name: Name, span: Span, pattern_span: Span,
226227
let db = span_note_and_lint(cx,
227228
SHADOW_UNRELATED,
228229
pattern_span,
229-
&format!("{} is shadowed by {}",
230+
&format!("`{}` is shadowed by `{}`",
230231
snippet(cx, pattern_span, "_"),
231232
snippet(cx, expr.span, "..")),
232233
expr.span,

tests/compile-fail/methods.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -493,10 +493,8 @@ fn single_char_pattern() {
493493
fn temporary_cstring() {
494494
use std::ffi::CString;
495495

496-
( // extra parenthesis to better test spans
496+
CString::new("foo").unwrap().as_ptr();
497497
//~^ ERROR you are getting the inner pointer of a temporary `CString`
498498
//~| NOTE that pointer will be invalid outside this expression
499-
CString::new("foo").unwrap()
500-
//~^ HELP assign the `CString` to a variable to extend its lifetime
501-
).as_ptr();
499+
//~| HELP assign the `CString` to a variable to extend its lifetime
502500
}

tests/compile-fail/shadow.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ fn first(x: (isize, isize)) -> isize { x.0 }
1010

1111
fn main() {
1212
let mut x = 1;
13-
let x = &mut x; //~ERROR x is shadowed by itself in &mut x
14-
let x = { x }; //~ERROR x is shadowed by itself in { x }
15-
let x = (&*x); //~ERROR x is shadowed by itself in &*x
16-
let x = { *x + 1 }; //~ERROR x is shadowed by { *x + 1 } which reuses
17-
let x = id(x); //~ERROR x is shadowed by id(x) which reuses
18-
let x = (1, x); //~ERROR x is shadowed by (1, x) which reuses
19-
let x = first(x); //~ERROR x is shadowed by first(x) which reuses
13+
let x = &mut x; //~ERROR `x` is shadowed by itself in `&mut x`
14+
let x = { x }; //~ERROR `x` is shadowed by itself in `{ x }`
15+
let x = (&*x); //~ERROR `x` is shadowed by itself in `(&*x)`
16+
let x = { *x + 1 }; //~ERROR `x` is shadowed by `{ *x + 1 }` which reuses
17+
let x = id(x); //~ERROR `x` is shadowed by `id(x)` which reuses
18+
let x = (1, x); //~ERROR `x` is shadowed by `(1, x)` which reuses
19+
let x = first(x); //~ERROR `x` is shadowed by `first(x)` which reuses
2020
let y = 1;
21-
let x = y; //~ERROR x is shadowed by y
21+
let x = y; //~ERROR `x` is shadowed by `y`
2222

2323
let o = Some(1u8);
2424

0 commit comments

Comments
 (0)