]> git.lizzy.rs Git - rust.git/commitdiff
Rustup to *1.10.0-nightly (476fe6eef 2016-05-21)*
authormcarton <cartonmartin+git@gmail.com>
Mon, 23 May 2016 14:34:09 +0000 (16:34 +0200)
committermcarton <cartonmartin+git@gmail.com>
Mon, 23 May 2016 14:36:10 +0000 (16:36 +0200)
src/shadow.rs
tests/compile-fail/methods.rs
tests/compile-fail/shadow.rs

index cf7de04cb6fc07b9cf08acde9ec6d77a163a3b5e..2a0d36a80b3cf0f0a6ca24f47aa73a21d03b6425 100644 (file)
@@ -208,15 +208,16 @@ fn note_orig(cx: &LateContext, mut db: DiagnosticWrapper, lint: &'static Lint, s
             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 note_orig(cx: &LateContext, mut db: DiagnosticWrapper, lint: &'static Lint, s
             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,
index 9753c021372083ab34da3ad85f19e2aacb951e98..f6e4a9a31e054c4c369577b503e7f88158ebf063 100644 (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
 }
index 0a52a9829aef5b3fa77391a5306f0ee7530d9420..1cfcff74a44c091b33851f2dee10782838f38019 100644 (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);