]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc/diagnostics.rs
Fix stability
[rust.git] / src / librustc / diagnostics.rs
index 19c880905aeb8f200040ad464f07533a4e69934d..7cb2de78e2c7dbdf1248b05ed9270c458ff90e13 100644 (file)
@@ -298,10 +298,18 @@ fn index<'a>(&'a self, idx: u8) -> &'a u8 { &self.a }
 ```
 "##,
 
+// FIXME(#24111) Change the language here when const fn stabilizes
 E0015: r##"
 The only functions that can be called in static or constant expressions are
-`const` functions. Rust currently does not support more general compile-time
-function execution.
+`const` functions, and struct/enum constructors. `const` functions are only
+available on a nightly compiler. Rust currently does not support more general
+compile-time function execution.
+
+```
+const FOO: Option<u8> = Some(1); // enum constructor
+struct Bar {x: u8}
+const BAR: Bar = Bar {x: 1}; // struct constructor
+```
 
 See [RFC 911] for more details on the design of `const fn`s.
 
@@ -1984,6 +1992,39 @@ struct Foo {
 ```
 "##,
 
+E0496: r##"
+A lifetime name is shadowing another lifetime name. Erroneous code example:
+
+```
+struct Foo<'a> {
+    a: &'a i32,
+}
+
+impl<'a> Foo<'a> {
+    fn f<'a>(x: &'a i32) { // error: lifetime name `'a` shadows a lifetime
+                           //        name that is already in scope
+    }
+}
+```
+
+Please change the name of one of the lifetimes to remove this error. Example:
+
+
+```
+struct Foo<'a> {
+    a: &'a i32,
+}
+
+impl<'a> Foo<'a> {
+    fn f<'b>(x: &'b i32) { // ok!
+    }
+}
+
+fn main() {
+}
+```
+"##,
+
 E0497: r##"
 A stability attribute was used outside of the standard library. Erroneous code
 example:
@@ -2064,6 +2105,6 @@ fn foo() {}
     E0491, // in type `..`, reference has a longer lifetime than the data it...
     E0492, // cannot borrow a constant which contains interior mutability
     E0495, // cannot infer an appropriate lifetime due to conflicting requirements
-    E0496, // .. name `..` shadows a .. name that is already in scope
     E0498, // malformed plugin attribute
+    E0514, // metadata version mismatch
 }