]> git.lizzy.rs Git - rust.git/commitdiff
Update E0424 to the new error format
authorJohannes Löthberg <johannes@kyriasis.com>
Sat, 20 Aug 2016 00:41:51 +0000 (02:41 +0200)
committerJohannes Löthberg <johannes@kyriasis.com>
Sat, 20 Aug 2016 20:05:51 +0000 (22:05 +0200)
Fixes #35797.

Signed-off-by: Johannes Löthberg <johannes@kyriasis.com>
src/librustc_resolve/lib.rs
src/test/compile-fail/E0424.rs
src/test/compile-fail/issue-2356.rs

index b91ede5b2fa8a02495f623c53b4fa77ae219af93..655c4f1f263fe45dd7710efaa3b95752b2d6e1cb 100644 (file)
@@ -344,11 +344,13 @@ fn resolve_struct_error<'b, 'a: 'b, 'c>(resolver: &'b Resolver<'a>,
                              path_name)
         }
         ResolutionError::SelfNotAvailableInStaticMethod => {
-            struct_span_err!(resolver.session,
+            let mut err = struct_span_err!(resolver.session,
                              span,
                              E0424,
-                             "`self` is not available in a static method. Maybe a `self` \
-                             argument is missing?")
+                             "`self` is not available in a static method");
+            err.span_label(span, &format!("not available in static method"));
+            err.note(&format!("maybe a `self` argument is missing?"));
+            err
         }
         ResolutionError::UnresolvedName { path, message: msg, context, is_static_method,
                                           is_field, def } => {
index 445d0c5f3edc0db383c7925cdc243d22b23eab57..911007113d3d64804a3c8ab51eb1fd4293ed4280 100644 (file)
@@ -14,7 +14,10 @@ impl Foo {
     fn bar(self) {}
 
     fn foo() {
-        self.bar(); //~ ERROR E0424
+        self.bar();
+        //~^ ERROR `self` is not available in a static method [E0424]
+        //~| NOTE not available in static method
+        //~| NOTE maybe a `self` argument is missing?
     }
 }
 
index d7ec1ed67397fe939d1585dc32b60f535a8958f2..da92161967dbdc98921c9684174cbc913b757b45 100644 (file)
@@ -59,7 +59,9 @@ fn purr_louder() {
 impl cat {
   fn meow() {
     if self.whiskers > 3 {
-        //~^ ERROR: `self` is not available in a static method. Maybe a `self` argument is missing?
+        //~^ ERROR `self` is not available in a static method [E0424]
+        //~| NOTE not available in static method
+        //~| NOTE maybe a `self` argument is missing?
         println!("MEOW");
     }
   }