Rustup to *1.10.0-nightly (476fe6eef 2016-05-21)*

This commit is contained in:
mcarton 2016-05-23 16:34:09 +02:00
parent 6dd608e53e
commit ac2e175c1b
No known key found for this signature in database
GPG key ID: 5E427C794CBA45E8
3 changed files with 14 additions and 15 deletions

View file

@ -208,15 +208,16 @@ fn lint_shadow<T>(cx: &LateContext, name: Name, span: Span, pattern_span: Span,
let db = span_lint(cx,
SHADOW_SAME,
span,
&format!("{} is shadowed by itself in {}",
&format!("`{}` is shadowed by itself in `{}`",
snippet(cx, pattern_span, "_"),
snippet(cx, expr.span, "..")));
note_orig(cx, db, SHADOW_SAME, prev_span);
} else if contains_self(name, expr) {
let db = span_note_and_lint(cx,
SHADOW_REUSE,
pattern_span,
&format!("{} is shadowed by {} which reuses the original value",
&format!("`{}` is shadowed by `{}` which reuses the original value",
snippet(cx, pattern_span, "_"),
snippet(cx, expr.span, "..")),
expr.span,
@ -226,7 +227,7 @@ fn lint_shadow<T>(cx: &LateContext, name: Name, span: Span, pattern_span: Span,
let db = span_note_and_lint(cx,
SHADOW_UNRELATED,
pattern_span,
&format!("{} is shadowed by {}",
&format!("`{}` is shadowed by `{}`",
snippet(cx, pattern_span, "_"),
snippet(cx, expr.span, "..")),
expr.span,

View file

@ -493,10 +493,8 @@ fn single_char_pattern() {
fn temporary_cstring() {
use std::ffi::CString;
( // extra parenthesis to better test spans
CString::new("foo").unwrap().as_ptr();
//~^ ERROR you are getting the inner pointer of a temporary `CString`
//~| NOTE that pointer will be invalid outside this expression
CString::new("foo").unwrap()
//~^ HELP assign the `CString` to a variable to extend its lifetime
).as_ptr();
//~| HELP assign the `CString` to a variable to extend its lifetime
}

View file

@ -10,15 +10,15 @@ fn first(x: (isize, isize)) -> isize { x.0 }
fn main() {
let mut x = 1;
let x = &mut x; //~ERROR x is shadowed by itself in &mut x
let x = { x }; //~ERROR x is shadowed by itself in { x }
let x = (&*x); //~ERROR x is shadowed by itself in &*x
let x = { *x + 1 }; //~ERROR x is shadowed by { *x + 1 } which reuses
let x = id(x); //~ERROR x is shadowed by id(x) which reuses
let x = (1, x); //~ERROR x is shadowed by (1, x) which reuses
let x = first(x); //~ERROR x is shadowed by first(x) which reuses
let x = &mut x; //~ERROR `x` is shadowed by itself in `&mut x`
let x = { x }; //~ERROR `x` is shadowed by itself in `{ x }`
let x = (&*x); //~ERROR `x` is shadowed by itself in `(&*x)`
let x = { *x + 1 }; //~ERROR `x` is shadowed by `{ *x + 1 }` which reuses
let x = id(x); //~ERROR `x` is shadowed by `id(x)` which reuses
let x = (1, x); //~ERROR `x` is shadowed by `(1, x)` which reuses
let x = first(x); //~ERROR `x` is shadowed by `first(x)` which reuses
let y = 1;
let x = y; //~ERROR x is shadowed by y
let x = y; //~ERROR `x` is shadowed by `y`
let o = Some(1u8);