about summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristian Poveda <git@christianpoveda.xyz>2020-06-18 14:52:37 -0500
committerChristian Poveda <git@christianpoveda.xyz>2020-06-19 14:16:38 -0500
commit96031e22d22fd3b98e6caa3851b99272e2b4618d (patch)
treec9f390ca17849af8918034a3b804ab44e1b9f2ff
parent1f48465a0147769cfe6487212862a66518663fed (diff)
downloadrust-96031e22d22fd3b98e6caa3851b99272e2b4618d.tar.gz
rust-96031e22d22fd3b98e6caa3851b99272e2b4618d.zip
add new error code
-rw-r--r--src/librustc_error_codes/error_codes.rs1
-rw-r--r--src/librustc_error_codes/error_codes/E0764.md39
-rw-r--r--src/librustc_mir/transform/check_consts/ops.rs2
-rw-r--r--src/test/ui/check-static-immutable-mut-slices.stderr4
-rw-r--r--src/test/ui/consts/const-eval/issue-65394.stderr6
-rw-r--r--src/test/ui/consts/const-multi-ref.stderr6
-rw-r--r--src/test/ui/consts/const-mut-refs/const_mut_address_of.stderr6
-rw-r--r--src/test/ui/consts/const-mut-refs/const_mut_refs.stderr8
-rw-r--r--src/test/ui/consts/const_let_assign3.stderr7
-rw-r--r--src/test/ui/consts/projection_qualif.mut_refs.stderr6
-rw-r--r--src/test/ui/consts/projection_qualif.stock.stderr4
-rw-r--r--src/test/ui/consts/read_from_static_mut_ref.stderr4
-rw-r--r--src/test/ui/consts/static_mut_containing_mut_ref2.mut_refs.stderr4
-rw-r--r--src/test/ui/consts/static_mut_containing_mut_ref2.stock.stderr5
-rw-r--r--src/test/ui/error-codes/E0017.rs8
-rw-r--r--src/test/ui/error-codes/E0017.stderr10
-rw-r--r--src/test/ui/error-codes/E0388.rs6
-rw-r--r--src/test/ui/error-codes/E0388.stderr8
-rw-r--r--src/test/ui/issues/issue-17718-const-bad-values.stderr6
-rw-r--r--src/test/ui/issues/issue-46604.rs2
-rw-r--r--src/test/ui/issues/issue-46604.stderr6
21 files changed, 95 insertions, 53 deletions
diff --git a/src/librustc_error_codes/error_codes.rs b/src/librustc_error_codes/error_codes.rs
index 997762efcb3..738b3bc7539 100644
--- a/src/librustc_error_codes/error_codes.rs
+++ b/src/librustc_error_codes/error_codes.rs
@@ -444,6 +444,7 @@ E0760: include_str!("./error_codes/E0760.md"),
 E0761: include_str!("./error_codes/E0761.md"),
 E0762: include_str!("./error_codes/E0762.md"),
 E0763: include_str!("./error_codes/E0763.md"),
+E0764: include_str!("./error_codes/E0764.md"),
 ;
 //  E0006, // merged with E0005
 //  E0008, // cannot bind by-move into a pattern guard
diff --git a/src/librustc_error_codes/error_codes/E0764.md b/src/librustc_error_codes/error_codes/E0764.md
new file mode 100644
index 00000000000..e9061f988ac
--- /dev/null
+++ b/src/librustc_error_codes/error_codes/E0764.md
@@ -0,0 +1,39 @@
+Mutable references (`&mut`) can only be used in constant functions, not statics
+or constants. This limitation exists to prevent the creation of constants that
+have a mutable reference in their final value. If you had a constant of `&mut
+i32` type, you could modify the value through that reference, making the
+constant essentially mutable. While there could be a more fine-grained scheme
+in the future that allows mutable references if they are not "leaked" to the
+final value, a more conservative approach was chosen for now. `const fn` do not
+have this problem, as the borrow checker will prevent the `const fn` from
+returning new mutable references.
+
+Erroneous code example:
+
+```compile_fail,E0764
+#![feature(const_fn)]
+#![feature(const_mut_refs)]
+
+fn main() {
+    const OH_NO: &'static mut usize = &mut 1; // error!
+}
+```
+
+Remember: you cannot use a function call inside a constant or static. However,
+you can totally use it in constant functions:
+
+```
+#![feature(const_fn)]
+#![feature(const_mut_refs)]
+
+const fn foo(x: usize) -> usize {
+    let mut y = 1;
+    let z = &mut y;
+    *z += x;
+    y
+}
+
+fn main() {
+    const FOO: usize = foo(10); // ok!
+}
+```
diff --git a/src/librustc_mir/transform/check_consts/ops.rs b/src/librustc_mir/transform/check_consts/ops.rs
index 5e3bd2c1d3d..733ae908451 100644
--- a/src/librustc_mir/transform/check_consts/ops.rs
+++ b/src/librustc_mir/transform/check_consts/ops.rs
@@ -227,7 +227,7 @@ impl NonConstOp for MutBorrow {
             struct_span_err!(
                 ccx.tcx.sess,
                 span,
-                E0019,
+                E0764,
                 "mutable references are not allowed in {}s",
                 ccx.const_kind(),
             )
diff --git a/src/test/ui/check-static-immutable-mut-slices.stderr b/src/test/ui/check-static-immutable-mut-slices.stderr
index 855f6dda182..9ffbb483d13 100644
--- a/src/test/ui/check-static-immutable-mut-slices.stderr
+++ b/src/test/ui/check-static-immutable-mut-slices.stderr
@@ -1,4 +1,4 @@
-error[E0019]: mutable references are not allowed in statics
+error[E0764]: mutable references are not allowed in statics
   --> $DIR/check-static-immutable-mut-slices.rs:3:37
    |
 LL | static TEST: &'static mut [isize] = &mut [];
@@ -6,4 +6,4 @@ LL | static TEST: &'static mut [isize] = &mut [];
 
 error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0019`.
+For more information about this error, try `rustc --explain E0764`.
diff --git a/src/test/ui/consts/const-eval/issue-65394.stderr b/src/test/ui/consts/const-eval/issue-65394.stderr
index 827af6d832d..f843a94fabd 100644
--- a/src/test/ui/consts/const-eval/issue-65394.stderr
+++ b/src/test/ui/consts/const-eval/issue-65394.stderr
@@ -1,4 +1,4 @@
-error[E0019]: mutable references are not allowed in constants
+error[E0764]: mutable references are not allowed in constants
   --> $DIR/issue-65394.rs:8:13
    |
 LL |     let r = &mut x;
@@ -12,5 +12,5 @@ LL |     let mut x = Vec::<i32>::new();
 
 error: aborting due to 2 previous errors
 
-Some errors have detailed explanations: E0019, E0493.
-For more information about an error, try `rustc --explain E0019`.
+Some errors have detailed explanations: E0493, E0764.
+For more information about an error, try `rustc --explain E0493`.
diff --git a/src/test/ui/consts/const-multi-ref.stderr b/src/test/ui/consts/const-multi-ref.stderr
index 84ff5457eef..9a7914b4588 100644
--- a/src/test/ui/consts/const-multi-ref.stderr
+++ b/src/test/ui/consts/const-multi-ref.stderr
@@ -1,4 +1,4 @@
-error[E0019]: mutable references are not allowed in constants
+error[E0764]: mutable references are not allowed in constants
   --> $DIR/const-multi-ref.rs:6:13
    |
 LL |     let p = &mut a;
@@ -12,5 +12,5 @@ LL |     let p = &a;
 
 error: aborting due to 2 previous errors
 
-Some errors have detailed explanations: E0019, E0492.
-For more information about an error, try `rustc --explain E0019`.
+Some errors have detailed explanations: E0492, E0764.
+For more information about an error, try `rustc --explain E0492`.
diff --git a/src/test/ui/consts/const-mut-refs/const_mut_address_of.stderr b/src/test/ui/consts/const-mut-refs/const_mut_address_of.stderr
index 3940ce236a3..2214ce6ee1c 100644
--- a/src/test/ui/consts/const-mut-refs/const_mut_address_of.stderr
+++ b/src/test/ui/consts/const-mut-refs/const_mut_address_of.stderr
@@ -1,10 +1,10 @@
-error[E0019]: mutable references are not allowed in constants
+error[E0764]: mutable references are not allowed in constants
   --> $DIR/const_mut_address_of.rs:24:5
    |
 LL |     foo().bar();
    |     ^^^^^ `&mut` is only allowed in `const fn`
 
-error[E0019]: mutable references are not allowed in constants
+error[E0764]: mutable references are not allowed in constants
   --> $DIR/const_mut_address_of.rs:26:9
    |
 LL |     baz(&mut foo());
@@ -12,4 +12,4 @@ LL |     baz(&mut foo());
 
 error: aborting due to 2 previous errors
 
-For more information about this error, try `rustc --explain E0019`.
+For more information about this error, try `rustc --explain E0764`.
diff --git a/src/test/ui/consts/const-mut-refs/const_mut_refs.stderr b/src/test/ui/consts/const-mut-refs/const_mut_refs.stderr
index 39d0a391bab..4ca7b128b7c 100644
--- a/src/test/ui/consts/const-mut-refs/const_mut_refs.stderr
+++ b/src/test/ui/consts/const-mut-refs/const_mut_refs.stderr
@@ -1,16 +1,16 @@
-error[E0019]: mutable references are not allowed in constants
+error[E0764]: mutable references are not allowed in constants
   --> $DIR/const_mut_refs.rs:31:17
    |
 LL |     let _: [(); foo().bar()] = [(); 1];
    |                 ^^^^^ `&mut` is only allowed in `const fn`
 
-error[E0019]: mutable references are not allowed in constants
+error[E0764]: mutable references are not allowed in constants
   --> $DIR/const_mut_refs.rs:33:21
    |
 LL |     let _: [(); baz(&mut foo())] = [(); 2];
    |                     ^^^^^^^^^^ `&mut` is only allowed in `const fn`
 
-error[E0019]: mutable references are not allowed in constants
+error[E0764]: mutable references are not allowed in constants
   --> $DIR/const_mut_refs.rs:35:22
    |
 LL |     let _: [(); bazz(&mut foo())] = [(); 3];
@@ -18,4 +18,4 @@ LL |     let _: [(); bazz(&mut foo())] = [(); 3];
 
 error: aborting due to 3 previous errors
 
-For more information about this error, try `rustc --explain E0019`.
+For more information about this error, try `rustc --explain E0764`.
diff --git a/src/test/ui/consts/const_let_assign3.stderr b/src/test/ui/consts/const_let_assign3.stderr
index a5810e60a09..dd05a4c0bb0 100644
--- a/src/test/ui/consts/const_let_assign3.stderr
+++ b/src/test/ui/consts/const_let_assign3.stderr
@@ -6,13 +6,13 @@ LL |         self.state = x;
    |
    = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
 
-error[E0019]: mutable references are not allowed in constants
+error[E0764]: mutable references are not allowed in constants
   --> $DIR/const_let_assign3.rs:16:5
    |
 LL |     s.foo(3);
    |     ^ `&mut` is only allowed in `const fn`
 
-error[E0019]: mutable references are not allowed in constants
+error[E0764]: mutable references are not allowed in constants
   --> $DIR/const_let_assign3.rs:22:13
    |
 LL |     let y = &mut x;
@@ -28,4 +28,5 @@ LL |     *y = 42;
 
 error: aborting due to 4 previous errors
 
-For more information about this error, try `rustc --explain E0019`.
+Some errors have detailed explanations: E0019, E0764.
+For more information about an error, try `rustc --explain E0019`.
diff --git a/src/test/ui/consts/projection_qualif.mut_refs.stderr b/src/test/ui/consts/projection_qualif.mut_refs.stderr
index e84c86f5a78..fad8f011f75 100644
--- a/src/test/ui/consts/projection_qualif.mut_refs.stderr
+++ b/src/test/ui/consts/projection_qualif.mut_refs.stderr
@@ -1,4 +1,4 @@
-error[E0019]: mutable references are not allowed in constants
+error[E0764]: mutable references are not allowed in constants
   --> $DIR/projection_qualif.rs:10:27
    |
 LL |         let b: *mut u32 = &mut a;
@@ -15,5 +15,5 @@ LL |         unsafe { *b = 5; }
 
 error: aborting due to 2 previous errors
 
-Some errors have detailed explanations: E0019, E0658.
-For more information about an error, try `rustc --explain E0019`.
+Some errors have detailed explanations: E0658, E0764.
+For more information about an error, try `rustc --explain E0658`.
diff --git a/src/test/ui/consts/projection_qualif.stock.stderr b/src/test/ui/consts/projection_qualif.stock.stderr
index 01e12e186fe..212f1228645 100644
--- a/src/test/ui/consts/projection_qualif.stock.stderr
+++ b/src/test/ui/consts/projection_qualif.stock.stderr
@@ -1,4 +1,4 @@
-error[E0019]: mutable references are not allowed in constants
+error[E0764]: mutable references are not allowed in constants
   --> $DIR/projection_qualif.rs:10:27
    |
 LL |         let b: *mut u32 = &mut a;
@@ -23,5 +23,5 @@ LL |         unsafe { *b = 5; }
 
 error: aborting due to 3 previous errors
 
-Some errors have detailed explanations: E0019, E0658.
+Some errors have detailed explanations: E0019, E0658, E0764.
 For more information about an error, try `rustc --explain E0019`.
diff --git a/src/test/ui/consts/read_from_static_mut_ref.stderr b/src/test/ui/consts/read_from_static_mut_ref.stderr
index c51ddae23d8..c936ac0b7d5 100644
--- a/src/test/ui/consts/read_from_static_mut_ref.stderr
+++ b/src/test/ui/consts/read_from_static_mut_ref.stderr
@@ -1,4 +1,4 @@
-error[E0019]: mutable references are not allowed in statics
+error[E0764]: mutable references are not allowed in statics
   --> $DIR/read_from_static_mut_ref.rs:5:26
    |
 LL | static OH_NO: &mut i32 = &mut 42;
@@ -6,4 +6,4 @@ LL | static OH_NO: &mut i32 = &mut 42;
 
 error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0019`.
+For more information about this error, try `rustc --explain E0764`.
diff --git a/src/test/ui/consts/static_mut_containing_mut_ref2.mut_refs.stderr b/src/test/ui/consts/static_mut_containing_mut_ref2.mut_refs.stderr
index 2c6abb3a4ed..36c280ca5c6 100644
--- a/src/test/ui/consts/static_mut_containing_mut_ref2.mut_refs.stderr
+++ b/src/test/ui/consts/static_mut_containing_mut_ref2.mut_refs.stderr
@@ -1,4 +1,4 @@
-error[E0019]: mutable references are not allowed in statics
+error[E0764]: mutable references are not allowed in statics
   --> $DIR/static_mut_containing_mut_ref2.rs:7:46
    |
 LL | pub static mut STDERR_BUFFER: () = unsafe { *(&mut STDERR_BUFFER_SPACE) = 42; };
@@ -6,4 +6,4 @@ LL | pub static mut STDERR_BUFFER: () = unsafe { *(&mut STDERR_BUFFER_SPACE) = 4
 
 error: aborting due to previous error
 
-For more information about this error, try `rustc --explain E0019`.
+For more information about this error, try `rustc --explain E0764`.
diff --git a/src/test/ui/consts/static_mut_containing_mut_ref2.stock.stderr b/src/test/ui/consts/static_mut_containing_mut_ref2.stock.stderr
index 47c9401704c..57fb27e642e 100644
--- a/src/test/ui/consts/static_mut_containing_mut_ref2.stock.stderr
+++ b/src/test/ui/consts/static_mut_containing_mut_ref2.stock.stderr
@@ -1,4 +1,4 @@
-error[E0019]: mutable references are not allowed in statics
+error[E0764]: mutable references are not allowed in statics
   --> $DIR/static_mut_containing_mut_ref2.rs:7:46
    |
 LL | pub static mut STDERR_BUFFER: () = unsafe { *(&mut STDERR_BUFFER_SPACE) = 42; };
@@ -14,4 +14,5 @@ LL | pub static mut STDERR_BUFFER: () = unsafe { *(&mut STDERR_BUFFER_SPACE) = 4
 
 error: aborting due to 2 previous errors
 
-For more information about this error, try `rustc --explain E0019`.
+Some errors have detailed explanations: E0019, E0764.
+For more information about an error, try `rustc --explain E0019`.
diff --git a/src/test/ui/error-codes/E0017.rs b/src/test/ui/error-codes/E0017.rs
index 8e6de93f440..818dec1207b 100644
--- a/src/test/ui/error-codes/E0017.rs
+++ b/src/test/ui/error-codes/E0017.rs
@@ -2,10 +2,10 @@ static X: i32 = 1;
 const C: i32 = 2;
 static mut M: i32 = 3;
 
-const CR: &'static mut i32 = &mut C; //~ ERROR E0019
-static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0019
+const CR: &'static mut i32 = &mut C; //~ ERROR E0764
+static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0764
                                               //~| ERROR E0019
                                               //~| ERROR cannot borrow
-static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0019
-static STATIC_MUT_REF: &'static mut i32 = unsafe { &mut M }; //~ ERROR E0019
+static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0764
+static STATIC_MUT_REF: &'static mut i32 = unsafe { &mut M }; //~ ERROR E0764
 fn main() {}
diff --git a/src/test/ui/error-codes/E0017.stderr b/src/test/ui/error-codes/E0017.stderr
index d952afa2521..c1d96de1dca 100644
--- a/src/test/ui/error-codes/E0017.stderr
+++ b/src/test/ui/error-codes/E0017.stderr
@@ -1,4 +1,4 @@
-error[E0019]: mutable references are not allowed in constants
+error[E0764]: mutable references are not allowed in constants
   --> $DIR/E0017.rs:5:30
    |
 LL | const CR: &'static mut i32 = &mut C;
@@ -12,7 +12,7 @@ LL | static STATIC_REF: &'static mut i32 = &mut X;
    |
    = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
 
-error[E0019]: mutable references are not allowed in statics
+error[E0764]: mutable references are not allowed in statics
   --> $DIR/E0017.rs:6:39
    |
 LL | static STATIC_REF: &'static mut i32 = &mut X;
@@ -24,13 +24,13 @@ error[E0596]: cannot borrow immutable static item `X` as mutable
 LL | static STATIC_REF: &'static mut i32 = &mut X;
    |                                       ^^^^^^ cannot borrow as mutable
 
-error[E0019]: mutable references are not allowed in statics
+error[E0764]: mutable references are not allowed in statics
   --> $DIR/E0017.rs:9:38
    |
 LL | static CONST_REF: &'static mut i32 = &mut C;
    |                                      ^^^^^^ `&mut` is only allowed in `const fn`
 
-error[E0019]: mutable references are not allowed in statics
+error[E0764]: mutable references are not allowed in statics
   --> $DIR/E0017.rs:10:52
    |
 LL | static STATIC_MUT_REF: &'static mut i32 = unsafe { &mut M };
@@ -38,5 +38,5 @@ LL | static STATIC_MUT_REF: &'static mut i32 = unsafe { &mut M };
 
 error: aborting due to 6 previous errors
 
-Some errors have detailed explanations: E0019, E0596.
+Some errors have detailed explanations: E0019, E0596, E0764.
 For more information about an error, try `rustc --explain E0019`.
diff --git a/src/test/ui/error-codes/E0388.rs b/src/test/ui/error-codes/E0388.rs
index 90ea8649b8b..13131017c2e 100644
--- a/src/test/ui/error-codes/E0388.rs
+++ b/src/test/ui/error-codes/E0388.rs
@@ -1,10 +1,10 @@
 static X: i32 = 1;
 const C: i32 = 2;
 
-const CR: &'static mut i32 = &mut C; //~ ERROR E0019
+const CR: &'static mut i32 = &mut C; //~ ERROR E0764
 static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0019
                                               //~| ERROR cannot borrow
-                                              //~| ERROR E0019
-static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0019
+                                              //~| ERROR E0764
+static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0764
 
 fn main() {}
diff --git a/src/test/ui/error-codes/E0388.stderr b/src/test/ui/error-codes/E0388.stderr
index 04b3d954250..f09100bac43 100644
--- a/src/test/ui/error-codes/E0388.stderr
+++ b/src/test/ui/error-codes/E0388.stderr
@@ -1,4 +1,4 @@
-error[E0019]: mutable references are not allowed in constants
+error[E0764]: mutable references are not allowed in constants
   --> $DIR/E0388.rs:4:30
    |
 LL | const CR: &'static mut i32 = &mut C;
@@ -12,7 +12,7 @@ LL | static STATIC_REF: &'static mut i32 = &mut X;
    |
    = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
 
-error[E0019]: mutable references are not allowed in statics
+error[E0764]: mutable references are not allowed in statics
   --> $DIR/E0388.rs:5:39
    |
 LL | static STATIC_REF: &'static mut i32 = &mut X;
@@ -24,7 +24,7 @@ error[E0596]: cannot borrow immutable static item `X` as mutable
 LL | static STATIC_REF: &'static mut i32 = &mut X;
    |                                       ^^^^^^ cannot borrow as mutable
 
-error[E0019]: mutable references are not allowed in statics
+error[E0764]: mutable references are not allowed in statics
   --> $DIR/E0388.rs:8:38
    |
 LL | static CONST_REF: &'static mut i32 = &mut C;
@@ -32,5 +32,5 @@ LL | static CONST_REF: &'static mut i32 = &mut C;
 
 error: aborting due to 5 previous errors
 
-Some errors have detailed explanations: E0019, E0596.
+Some errors have detailed explanations: E0019, E0596, E0764.
 For more information about an error, try `rustc --explain E0019`.
diff --git a/src/test/ui/issues/issue-17718-const-bad-values.stderr b/src/test/ui/issues/issue-17718-const-bad-values.stderr
index b62adbd8493..7c50978d4eb 100644
--- a/src/test/ui/issues/issue-17718-const-bad-values.stderr
+++ b/src/test/ui/issues/issue-17718-const-bad-values.stderr
@@ -1,4 +1,4 @@
-error[E0019]: mutable references are not allowed in constants
+error[E0764]: mutable references are not allowed in constants
   --> $DIR/issue-17718-const-bad-values.rs:1:34
    |
 LL | const C1: &'static mut [usize] = &mut [];
@@ -20,7 +20,7 @@ LL | const C2: &'static mut usize = unsafe { &mut S };
    |
    = help: consider extracting the value of the `static` to a `const`, and referring to that
 
-error[E0019]: mutable references are not allowed in constants
+error[E0764]: mutable references are not allowed in constants
   --> $DIR/issue-17718-const-bad-values.rs:5:41
    |
 LL | const C2: &'static mut usize = unsafe { &mut S };
@@ -28,5 +28,5 @@ LL | const C2: &'static mut usize = unsafe { &mut S };
 
 error: aborting due to 4 previous errors
 
-Some errors have detailed explanations: E0013, E0019.
+Some errors have detailed explanations: E0013, E0764.
 For more information about an error, try `rustc --explain E0013`.
diff --git a/src/test/ui/issues/issue-46604.rs b/src/test/ui/issues/issue-46604.rs
index 3eba1bb20bd..273187a5a13 100644
--- a/src/test/ui/issues/issue-46604.rs
+++ b/src/test/ui/issues/issue-46604.rs
@@ -1,4 +1,4 @@
-static buf: &mut [u8] = &mut [1u8,2,3,4,5,7];   //~ ERROR E0019
+static buf: &mut [u8] = &mut [1u8,2,3,4,5,7];   //~ ERROR E0764
 fn write<T: AsRef<[u8]>>(buffer: T) { }
 
 fn main() {
diff --git a/src/test/ui/issues/issue-46604.stderr b/src/test/ui/issues/issue-46604.stderr
index b0acf9936c5..5421721dec2 100644
--- a/src/test/ui/issues/issue-46604.stderr
+++ b/src/test/ui/issues/issue-46604.stderr
@@ -1,4 +1,4 @@
-error[E0019]: mutable references are not allowed in statics
+error[E0764]: mutable references are not allowed in statics
   --> $DIR/issue-46604.rs:1:25
    |
 LL | static buf: &mut [u8] = &mut [1u8,2,3,4,5,7];
@@ -12,5 +12,5 @@ LL |     buf[0]=2;
 
 error: aborting due to 2 previous errors
 
-Some errors have detailed explanations: E0019, E0594.
-For more information about an error, try `rustc --explain E0019`.
+Some errors have detailed explanations: E0594, E0764.
+For more information about an error, try `rustc --explain E0594`.