]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_mir/diagnostics.rs
Give an error number for "borrowed data escapes outside of closure"
[rust.git] / src / librustc_mir / diagnostics.rs
index aac5fc5ed7e9136529bc1a646ddd4223b91e537f..773064f15dcf0698a7b02aa0a6b5472bea7e72b6 100644 (file)
@@ -665,24 +665,6 @@ fn main() {
 ```
 "##,
 
-E0022: r##"
-Constant functions are not allowed to mutate anything. Thus, binding to an
-argument with a mutable pattern is not allowed. For example,
-
-```compile_fail
-const fn foo(mut x: u8) {
-    // do stuff
-}
-```
-
-Is incorrect because the function body may not mutate `x`.
-
-Remove any mutable bindings from the argument list to fix this error. In case
-you need to mutate the argument, try lazily initializing a global variable
-instead of using a `const fn`, or refactoring the code to a functional style to
-avoid mutation if possible.
-"##,
-
 E0133: r##"
 Unsafe code was used outside of an unsafe function or block.
 
@@ -2263,13 +2245,13 @@ impl<'a> Drop for S<'a> {
 access.
 "##,
 
-E0714: r##"
+E0716: r##"
 This error indicates that a temporary value is being dropped
 while a borrow is still in active use.
 
 Erroneous code example:
 
-```compile_fail,E0714
+```compile_fail,E0716
 # #![feature(nll)]
 fn foo() -> i32 { 22 }
 fn bar(x: &i32) -> &i32 { x }
@@ -2357,6 +2339,7 @@ fn foo() -> i32 { 22 }
 //  E0471, // constant evaluation error (in pattern)
 //    E0385, // {} in an aliasable location
     E0493, // destructors cannot be evaluated at compile-time
+    E0521,  // borrowed data escapes outside of closure
     E0524, // two closures require unique access to `..` at the same time
     E0526, // shuffle indices are not constant
     E0594, // cannot assign to {}