]> git.lizzy.rs Git - rust.git/commitdiff
Updated E0394 to new error message
authorKnight <knight42@mail.ustc.edu.cn>
Tue, 16 Aug 2016 17:40:57 +0000 (01:40 +0800)
committerKnight <knight42@mail.ustc.edu.cn>
Tue, 16 Aug 2016 19:02:25 +0000 (03:02 +0800)
src/librustc_mir/transform/qualify_consts.rs
src/test/compile-fail/E0394.rs

index 103a15dadb61cfcc9481049a9eb28d804445bbb3..1de67922b1b3a19e9ab3523885baa424946eaf03 100644 (file)
@@ -277,7 +277,10 @@ fn try_consume(&mut self) -> bool {
             } else {
                 "cannot refer to statics by value, use a constant instead"
             };
-            span_err!(self.tcx.sess, self.span, E0394, "{}", msg);
+            struct_span_err!(self.tcx.sess, self.span, E0394, "{}", msg)
+                .span_label(self.span, &format!("referring to another static by value"))
+                .note(&format!("use the address-of operator or a constant instead"))
+                .emit();
 
             // Replace STATIC with NOT_CONST to avoid further errors.
             self.qualif = self.qualif - Qualif::STATIC;
index 1b86b8ad674962440afe4fc759baa8e1e2e51339..e35d038248c8148f39b1a377be151a7fe258f8c5 100644 (file)
@@ -9,7 +9,10 @@
 // except according to those terms.
 
 static A: u32 = 0;
-static B: u32 = A; //~ ERROR E0394
+static B: u32 = A;
+//~^ ERROR E0394
+//~| NOTE referring to another static by value
+//~| NOTE use the address-of operator or a constant instead
 
 fn main() {
 }