From a23297f5c05d956f33ad0b515cc4daf99a2be4f1 Mon Sep 17 00:00:00 2001 From: Dylan MacKenzie Date: Tue, 29 Sep 2020 14:58:00 -0700 Subject: [PATCH] Bless mut tests --- .../src/transform/check_consts/ops.rs | 2 - .../assign-to-static-within-other-static-2.rs | 4 +- ...ign-to-static-within-other-static-2.stderr | 8 +- .../const-eval/mod-static-with-const-fn.rs | 7 +- .../mod-static-with-const-fn.stderr | 16 +- src/test/ui/consts/const_let_assign3.rs | 8 +- src/test/ui/consts/const_let_assign3.stderr | 14 +- .../min_const_fn/bad_const_fn_body_ice.rs | 1 - .../min_const_fn/bad_const_fn_body_ice.stderr | 13 +- .../ui/consts/min_const_fn/min_const_fn.rs | 12 ++ .../consts/min_const_fn/min_const_fn.stderr | 158 +++++++++++++++--- .../consts/min_const_fn/mutable_borrow.stderr | 8 +- src/test/ui/consts/projection_qualif.rs | 1 - .../ui/consts/projection_qualif.stock.stderr | 14 +- .../consts/static_mut_containing_mut_ref2.rs | 1 - ...tatic_mut_containing_mut_ref2.stock.stderr | 13 +- 16 files changed, 173 insertions(+), 107 deletions(-) diff --git a/compiler/rustc_mir/src/transform/check_consts/ops.rs b/compiler/rustc_mir/src/transform/check_consts/ops.rs index e57fcfa1fc8..fba6d0d2f80 100644 --- a/compiler/rustc_mir/src/transform/check_consts/ops.rs +++ b/compiler/rustc_mir/src/transform/check_consts/ops.rs @@ -515,8 +515,6 @@ pub mod ty { #[derive(Debug)] pub struct MutRef; impl NonConstOp for MutRef { - const STOPS_CONST_CHECKING: bool = true; - fn status_in_item(&self, _ccx: &ConstCx<'_, '_>) -> Status { Status::Unstable(sym::const_mut_refs) } diff --git a/src/test/ui/consts/const-eval/assign-to-static-within-other-static-2.rs b/src/test/ui/consts/const-eval/assign-to-static-within-other-static-2.rs index 4d3c714481a..037c6f9f7e6 100644 --- a/src/test/ui/consts/const-eval/assign-to-static-within-other-static-2.rs +++ b/src/test/ui/consts/const-eval/assign-to-static-within-other-static-2.rs @@ -1,7 +1,7 @@ // New test for #53818: modifying static memory at compile-time is not allowed. // The test should never compile successfully -#![feature(const_raw_ptr_deref)] +#![feature(const_raw_ptr_deref, const_mut_refs)] use std::cell::UnsafeCell; @@ -13,7 +13,7 @@ unsafe impl Sync for Foo {} static FOO: Foo = Foo(UnsafeCell::new(42)); static BAR: () = unsafe { - *FOO.0.get() = 5; //~ ERROR contains unimplemented expression type + *FOO.0.get() = 5; //~ ERROR }; fn main() {} diff --git a/src/test/ui/consts/const-eval/assign-to-static-within-other-static-2.stderr b/src/test/ui/consts/const-eval/assign-to-static-within-other-static-2.stderr index 14dcc074639..296a6bf5421 100644 --- a/src/test/ui/consts/const-eval/assign-to-static-within-other-static-2.stderr +++ b/src/test/ui/consts/const-eval/assign-to-static-within-other-static-2.stderr @@ -1,11 +1,9 @@ -error[E0019]: static contains unimplemented expression type +error[E0080]: could not evaluate static initializer --> $DIR/assign-to-static-within-other-static-2.rs:16:5 | LL | *FOO.0.get() = 5; - | ^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable + | ^^^^^^^^^^^^^^^^ modifying a static's initial value from another static's initializer 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 E0080`. diff --git a/src/test/ui/consts/const-eval/mod-static-with-const-fn.rs b/src/test/ui/consts/const-eval/mod-static-with-const-fn.rs index 32f0062168b..481e0469463 100644 --- a/src/test/ui/consts/const-eval/mod-static-with-const-fn.rs +++ b/src/test/ui/consts/const-eval/mod-static-with-const-fn.rs @@ -12,14 +12,9 @@ unsafe impl Sync for Foo {} static FOO: Foo = Foo(UnsafeCell::new(42)); -fn foo() {} - static BAR: () = unsafe { *FOO.0.get() = 5; - //~^ contains unimplemented expression - - foo(); - //~^ ERROR calls in statics are limited to constant functions, tuple structs and tuple variants + //~^ mutation through a reference }; fn main() { diff --git a/src/test/ui/consts/const-eval/mod-static-with-const-fn.stderr b/src/test/ui/consts/const-eval/mod-static-with-const-fn.stderr index 44ae1ecf047..12faf2e25e7 100644 --- a/src/test/ui/consts/const-eval/mod-static-with-const-fn.stderr +++ b/src/test/ui/consts/const-eval/mod-static-with-const-fn.stderr @@ -1,18 +1,12 @@ -error[E0019]: static contains unimplemented expression type - --> $DIR/mod-static-with-const-fn.rs:18:5 +error[E0658]: mutation through a reference is not allowed in statics + --> $DIR/mod-static-with-const-fn.rs:15:5 | LL | *FOO.0.get() = 5; | ^^^^^^^^^^^^^^^^ | + = note: see issue #57349 for more information = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable -error[E0015]: calls in statics are limited to constant functions, tuple structs and tuple variants - --> $DIR/mod-static-with-const-fn.rs:21:5 - | -LL | foo(); - | ^^^^^ +error: aborting due to previous error -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0015, E0019. -For more information about an error, try `rustc --explain E0015`. +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/consts/const_let_assign3.rs b/src/test/ui/consts/const_let_assign3.rs index 9d5ccb880aa..2fd6e060678 100644 --- a/src/test/ui/consts/const_let_assign3.rs +++ b/src/test/ui/consts/const_let_assign3.rs @@ -6,23 +6,21 @@ struct S { impl S { const fn foo(&mut self, x: u32) { - //~^ ERROR mutable references + //~^ ERROR mutable reference self.state = x; } } const FOO: S = { let mut s = S { state: 42 }; - s.foo(3); //~ ERROR mutable references are not allowed in constants + s.foo(3); //~ ERROR mutable reference s }; type Array = [u32; { let mut x = 2; - let y = &mut x; -//~^ ERROR mutable references are not allowed in constants + let y = &mut x; //~ ERROR mutable reference *y = 42; -//~^ ERROR constant contains unimplemented expression type *y }]; diff --git a/src/test/ui/consts/const_let_assign3.stderr b/src/test/ui/consts/const_let_assign3.stderr index 15badea0037..dc86e178a42 100644 --- a/src/test/ui/consts/const_let_assign3.stderr +++ b/src/test/ui/consts/const_let_assign3.stderr @@ -19,15 +19,7 @@ error[E0764]: mutable references are not allowed in constants LL | let y = &mut x; | ^^^^^^ `&mut` is only allowed in `const fn` -error[E0019]: constant contains unimplemented expression type - --> $DIR/const_let_assign3.rs:24:5 - | -LL | *y = 42; - | ^^^^^^^ - | - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable +error: aborting due to 3 previous errors -error: aborting due to 4 previous errors - -Some errors have detailed explanations: E0019, E0658, E0764. -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/min_const_fn/bad_const_fn_body_ice.rs b/src/test/ui/consts/min_const_fn/bad_const_fn_body_ice.rs index 589085871fb..4e1b7bf119c 100644 --- a/src/test/ui/consts/min_const_fn/bad_const_fn_body_ice.rs +++ b/src/test/ui/consts/min_const_fn/bad_const_fn_body_ice.rs @@ -1,7 +1,6 @@ const fn foo(a: i32) -> Vec { vec![1, 2, 3] //~^ ERROR allocations are not allowed - //~| ERROR unimplemented expression type //~| ERROR calls in constant functions } diff --git a/src/test/ui/consts/min_const_fn/bad_const_fn_body_ice.stderr b/src/test/ui/consts/min_const_fn/bad_const_fn_body_ice.stderr index 0f16890141f..23697a8e118 100644 --- a/src/test/ui/consts/min_const_fn/bad_const_fn_body_ice.stderr +++ b/src/test/ui/consts/min_const_fn/bad_const_fn_body_ice.stderr @@ -6,15 +6,6 @@ LL | vec![1, 2, 3] | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) -error[E0019]: constant function contains unimplemented expression type - --> $DIR/bad_const_fn_body_ice.rs:2:5 - | -LL | vec![1, 2, 3] - | ^^^^^^^^^^^^^ - | - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable - = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) - error[E0015]: calls in constant functions are limited to constant functions, tuple structs and tuple variants --> $DIR/bad_const_fn_body_ice.rs:2:5 | @@ -23,7 +14,7 @@ LL | vec![1, 2, 3] | = note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info) -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors -Some errors have detailed explanations: E0010, E0015, E0019. +Some errors have detailed explanations: E0010, E0015. For more information about an error, try `rustc --explain E0010`. diff --git a/src/test/ui/consts/min_const_fn/min_const_fn.rs b/src/test/ui/consts/min_const_fn/min_const_fn.rs index 06a44b27106..199295531d7 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn.rs +++ b/src/test/ui/consts/min_const_fn/min_const_fn.rs @@ -38,6 +38,9 @@ impl Foo { const fn get(&self) -> &T { &self.0 } const fn get_mut(&mut self) -> &mut T { &mut self.0 } //~^ mutable references + //~| mutable references + //~| mutable references + //~| mutable references } impl<'a, T> Foo { const fn new_lt(t: T) -> Self { Foo(t) } @@ -45,6 +48,9 @@ impl<'a, T> Foo { const fn get_lt(&'a self) -> &T { &self.0 } const fn get_mut_lt(&'a mut self) -> &mut T { &mut self.0 } //~^ mutable references + //~| mutable references + //~| mutable references + //~| mutable references } impl Foo { const fn new_s(t: T) -> Self { Foo(t) } @@ -52,11 +58,17 @@ impl Foo { const fn get_s(&self) -> &T { &self.0 } const fn get_mut_s(&mut self) -> &mut T { &mut self.0 } //~^ mutable references + //~| mutable references + //~| mutable references + //~| mutable references } impl Foo { const fn get_sq(&self) -> &T { &self.0 } const fn get_mut_sq(&mut self) -> &mut T { &mut self.0 } //~^ mutable references + //~| mutable references + //~| mutable references + //~| mutable references } diff --git a/src/test/ui/consts/min_const_fn/min_const_fn.stderr b/src/test/ui/consts/min_const_fn/min_const_fn.stderr index 5e6bf7ef890..6ec33089401 100644 --- a/src/test/ui/consts/min_const_fn/min_const_fn.stderr +++ b/src/test/ui/consts/min_const_fn/min_const_fn.stderr @@ -15,8 +15,35 @@ LL | const fn get_mut(&mut self) -> &mut T { &mut self.0 } = note: see issue #57349 for more information = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable +error[E0658]: mutable references are not allowed in constant functions + --> $DIR/min_const_fn.rs:39:22 + | +LL | const fn get_mut(&mut self) -> &mut T { &mut self.0 } + | ^^^^^^^^^ + | + = note: see issue #57349 for more information + = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable + +error[E0658]: mutable references are not allowed in constant functions + --> $DIR/min_const_fn.rs:39:36 + | +LL | const fn get_mut(&mut self) -> &mut T { &mut self.0 } + | ^^^^^^ + | + = note: see issue #57349 for more information + = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable + +error[E0658]: mutable references are not allowed in constant functions + --> $DIR/min_const_fn.rs:39:45 + | +LL | const fn get_mut(&mut self) -> &mut T { &mut self.0 } + | ^^^^^^^^^^^ + | + = note: see issue #57349 for more information + = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable + error[E0493]: destructors cannot be evaluated at compile-time - --> $DIR/min_const_fn.rs:44:28 + --> $DIR/min_const_fn.rs:47:28 | LL | const fn into_inner_lt(self) -> T { self.0 } | ^^^^ - value is dropped here @@ -24,7 +51,7 @@ LL | const fn into_inner_lt(self) -> T { self.0 } | constant functions cannot evaluate destructors error[E0658]: mutable references are not allowed in constant functions - --> $DIR/min_const_fn.rs:46:42 + --> $DIR/min_const_fn.rs:49:42 | LL | const fn get_mut_lt(&'a mut self) -> &mut T { &mut self.0 } | ^^^^^^ @@ -32,8 +59,35 @@ LL | const fn get_mut_lt(&'a mut self) -> &mut T { &mut self.0 } = note: see issue #57349 for more information = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable +error[E0658]: mutable references are not allowed in constant functions + --> $DIR/min_const_fn.rs:49:25 + | +LL | const fn get_mut_lt(&'a mut self) -> &mut T { &mut self.0 } + | ^^^^^^^^^^^^ + | + = note: see issue #57349 for more information + = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable + +error[E0658]: mutable references are not allowed in constant functions + --> $DIR/min_const_fn.rs:49:42 + | +LL | const fn get_mut_lt(&'a mut self) -> &mut T { &mut self.0 } + | ^^^^^^ + | + = note: see issue #57349 for more information + = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable + +error[E0658]: mutable references are not allowed in constant functions + --> $DIR/min_const_fn.rs:49:51 + | +LL | const fn get_mut_lt(&'a mut self) -> &mut T { &mut self.0 } + | ^^^^^^^^^^^ + | + = note: see issue #57349 for more information + = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable + error[E0493]: destructors cannot be evaluated at compile-time - --> $DIR/min_const_fn.rs:51:27 + --> $DIR/min_const_fn.rs:57:27 | LL | const fn into_inner_s(self) -> T { self.0 } | ^^^^ - value is dropped here @@ -41,7 +95,7 @@ LL | const fn into_inner_s(self) -> T { self.0 } | constant functions cannot evaluate destructors error[E0658]: mutable references are not allowed in constant functions - --> $DIR/min_const_fn.rs:53:38 + --> $DIR/min_const_fn.rs:59:38 | LL | const fn get_mut_s(&mut self) -> &mut T { &mut self.0 } | ^^^^^^ @@ -50,7 +104,34 @@ LL | const fn get_mut_s(&mut self) -> &mut T { &mut self.0 } = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable error[E0658]: mutable references are not allowed in constant functions - --> $DIR/min_const_fn.rs:58:39 + --> $DIR/min_const_fn.rs:59:24 + | +LL | const fn get_mut_s(&mut self) -> &mut T { &mut self.0 } + | ^^^^^^^^^ + | + = note: see issue #57349 for more information + = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable + +error[E0658]: mutable references are not allowed in constant functions + --> $DIR/min_const_fn.rs:59:38 + | +LL | const fn get_mut_s(&mut self) -> &mut T { &mut self.0 } + | ^^^^^^ + | + = note: see issue #57349 for more information + = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable + +error[E0658]: mutable references are not allowed in constant functions + --> $DIR/min_const_fn.rs:59:47 + | +LL | const fn get_mut_s(&mut self) -> &mut T { &mut self.0 } + | ^^^^^^^^^^^ + | + = note: see issue #57349 for more information + = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable + +error[E0658]: mutable references are not allowed in constant functions + --> $DIR/min_const_fn.rs:67:39 | LL | const fn get_mut_sq(&mut self) -> &mut T { &mut self.0 } | ^^^^^^ @@ -58,8 +139,35 @@ LL | const fn get_mut_sq(&mut self) -> &mut T { &mut self.0 } = note: see issue #57349 for more information = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable +error[E0658]: mutable references are not allowed in constant functions + --> $DIR/min_const_fn.rs:67:25 + | +LL | const fn get_mut_sq(&mut self) -> &mut T { &mut self.0 } + | ^^^^^^^^^ + | + = note: see issue #57349 for more information + = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable + +error[E0658]: mutable references are not allowed in constant functions + --> $DIR/min_const_fn.rs:67:39 + | +LL | const fn get_mut_sq(&mut self) -> &mut T { &mut self.0 } + | ^^^^^^ + | + = note: see issue #57349 for more information + = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable + +error[E0658]: mutable references are not allowed in constant functions + --> $DIR/min_const_fn.rs:67:48 + | +LL | const fn get_mut_sq(&mut self) -> &mut T { &mut self.0 } + | ^^^^^^^^^^^ + | + = note: see issue #57349 for more information + = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable + error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:76:16 + --> $DIR/min_const_fn.rs:88:16 | LL | const fn foo11(t: T) -> T { t } | ^ @@ -68,7 +176,7 @@ LL | const fn foo11(t: T) -> T { t } = help: add `#![feature(const_fn)]` to the crate attributes to enable error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:78:18 + --> $DIR/min_const_fn.rs:90:18 | LL | const fn foo11_2(t: T) -> T { t } | ^ @@ -77,7 +185,7 @@ LL | const fn foo11_2(t: T) -> T { t } = help: add `#![feature(const_fn)]` to the crate attributes to enable error[E0013]: constant functions cannot refer to statics - --> $DIR/min_const_fn.rs:82:27 + --> $DIR/min_const_fn.rs:94:27 | LL | const fn foo25() -> u32 { BAR } | ^^^ @@ -85,7 +193,7 @@ LL | const fn foo25() -> u32 { BAR } = help: consider extracting the value of the `static` to a `const`, and referring to that error[E0013]: constant functions cannot refer to statics - --> $DIR/min_const_fn.rs:83:37 + --> $DIR/min_const_fn.rs:95:37 | LL | const fn foo26() -> &'static u32 { &BAR } | ^^^ @@ -93,7 +201,7 @@ LL | const fn foo26() -> &'static u32 { &BAR } = help: consider extracting the value of the `static` to a `const`, and referring to that error[E0658]: casting pointers to integers in constant functions is unstable - --> $DIR/min_const_fn.rs:84:42 + --> $DIR/min_const_fn.rs:96:42 | LL | const fn foo30(x: *const u32) -> usize { x as usize } | ^^^^^^^^^^ @@ -102,7 +210,7 @@ LL | const fn foo30(x: *const u32) -> usize { x as usize } = help: add `#![feature(const_raw_ptr_to_usize_cast)]` to the crate attributes to enable error[E0658]: casting pointers to integers in constant functions is unstable - --> $DIR/min_const_fn.rs:86:63 + --> $DIR/min_const_fn.rs:98:63 | LL | const fn foo30_with_unsafe(x: *const u32) -> usize { unsafe { x as usize } } | ^^^^^^^^^^ @@ -111,7 +219,7 @@ LL | const fn foo30_with_unsafe(x: *const u32) -> usize { unsafe { x as usize } = help: add `#![feature(const_raw_ptr_to_usize_cast)]` to the crate attributes to enable error[E0658]: casting pointers to integers in constant functions is unstable - --> $DIR/min_const_fn.rs:88:42 + --> $DIR/min_const_fn.rs:100:42 | LL | const fn foo30_2(x: *mut u32) -> usize { x as usize } | ^^^^^^^^^^ @@ -120,7 +228,7 @@ LL | const fn foo30_2(x: *mut u32) -> usize { x as usize } = help: add `#![feature(const_raw_ptr_to_usize_cast)]` to the crate attributes to enable error[E0658]: casting pointers to integers in constant functions is unstable - --> $DIR/min_const_fn.rs:90:63 + --> $DIR/min_const_fn.rs:102:63 | LL | const fn foo30_2_with_unsafe(x: *mut u32) -> usize { unsafe { x as usize } } | ^^^^^^^^^^ @@ -129,7 +237,7 @@ LL | const fn foo30_2_with_unsafe(x: *mut u32) -> usize { unsafe { x as usize } = help: add `#![feature(const_raw_ptr_to_usize_cast)]` to the crate attributes to enable error[E0658]: mutable references are not allowed in constant functions - --> $DIR/min_const_fn.rs:93:14 + --> $DIR/min_const_fn.rs:105:14 | LL | const fn inc(x: &mut i32) { *x += 1 } | ^ @@ -138,7 +246,7 @@ LL | const fn inc(x: &mut i32) { *x += 1 } = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:102:6 + --> $DIR/min_const_fn.rs:114:6 | LL | impl Foo { | ^ @@ -147,7 +255,7 @@ LL | impl Foo { = help: add `#![feature(const_fn)]` to the crate attributes to enable error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:107:6 + --> $DIR/min_const_fn.rs:119:6 | LL | impl Foo { | ^ @@ -156,7 +264,7 @@ LL | impl Foo { = help: add `#![feature(const_fn)]` to the crate attributes to enable error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:112:6 + --> $DIR/min_const_fn.rs:124:6 | LL | impl Foo { | ^ @@ -165,7 +273,7 @@ LL | impl Foo { = help: add `#![feature(const_fn)]` to the crate attributes to enable error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:118:34 + --> $DIR/min_const_fn.rs:130:34 | LL | const fn no_apit2(_x: AlanTuring) {} | ^^^^^^^^^^^^^^^^^^^^ @@ -174,7 +282,7 @@ LL | const fn no_apit2(_x: AlanTuring) {} = help: add `#![feature(const_fn)]` to the crate attributes to enable error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:120:22 + --> $DIR/min_const_fn.rs:132:22 | LL | const fn no_apit(_x: impl std::fmt::Debug) {} | ^^^^^^^^^^^^^^^^^^^^ @@ -183,7 +291,7 @@ LL | const fn no_apit(_x: impl std::fmt::Debug) {} = help: add `#![feature(const_fn)]` to the crate attributes to enable error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:121:23 + --> $DIR/min_const_fn.rs:133:23 | LL | const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {} | ^^ @@ -192,7 +300,7 @@ LL | const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {} = help: add `#![feature(const_fn)]` to the crate attributes to enable error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:122:32 + --> $DIR/min_const_fn.rs:134:32 | LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -201,7 +309,7 @@ LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() } = help: add `#![feature(const_fn)]` to the crate attributes to enable error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable - --> $DIR/min_const_fn.rs:127:41 + --> $DIR/min_const_fn.rs:139:41 | LL | const fn really_no_traits_i_mean_it() { (&() as &dyn std::fmt::Debug, ()).1 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -210,7 +318,7 @@ LL | const fn really_no_traits_i_mean_it() { (&() as &dyn std::fmt::Debug, ()).1 = help: add `#![feature(const_fn)]` to the crate attributes to enable error[E0658]: function pointers cannot appear in constant functions - --> $DIR/min_const_fn.rs:130:21 + --> $DIR/min_const_fn.rs:142:21 | LL | const fn no_fn_ptrs(_x: fn()) {} | ^^ @@ -219,7 +327,7 @@ LL | const fn no_fn_ptrs(_x: fn()) {} = help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable error[E0658]: function pointers cannot appear in constant functions - --> $DIR/min_const_fn.rs:132:27 + --> $DIR/min_const_fn.rs:144:27 | LL | const fn no_fn_ptrs2() -> fn() { fn foo() {} foo } | ^^^^ @@ -227,7 +335,7 @@ LL | const fn no_fn_ptrs2() -> fn() { fn foo() {} foo } = note: see issue #57563 for more information = help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable -error: aborting due to 26 previous errors +error: aborting due to 38 previous errors Some errors have detailed explanations: E0013, E0493, E0658, E0723. For more information about an error, try `rustc --explain E0013`. diff --git a/src/test/ui/consts/min_const_fn/mutable_borrow.stderr b/src/test/ui/consts/min_const_fn/mutable_borrow.stderr index 4e5cdbb18aa..8e95a4c68a2 100644 --- a/src/test/ui/consts/min_const_fn/mutable_borrow.stderr +++ b/src/test/ui/consts/min_const_fn/mutable_borrow.stderr @@ -1,17 +1,17 @@ error[E0658]: mutable references are not allowed in constant functions - --> $DIR/mutable_borrow.rs:3:9 + --> $DIR/mutable_borrow.rs:3:13 | LL | let b = &mut a; - | ^ + | ^^^^^^ | = note: see issue #57349 for more information = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable error[E0658]: mutable references are not allowed in constant functions - --> $DIR/mutable_borrow.rs:12:13 + --> $DIR/mutable_borrow.rs:12:17 | LL | let b = &mut a; - | ^ + | ^^^^^^ | = note: see issue #57349 for more information = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable diff --git a/src/test/ui/consts/projection_qualif.rs b/src/test/ui/consts/projection_qualif.rs index 7db970cf137..5e2584a6e95 100644 --- a/src/test/ui/consts/projection_qualif.rs +++ b/src/test/ui/consts/projection_qualif.rs @@ -9,7 +9,6 @@ const FOO: &u32 = { { let b: *mut u32 = &mut a; //~ ERROR mutable references are not allowed in constants unsafe { *b = 5; } //~ ERROR dereferencing raw pointers in constants - //[stock]~^ contains unimplemented expression } &{a} }; diff --git a/src/test/ui/consts/projection_qualif.stock.stderr b/src/test/ui/consts/projection_qualif.stock.stderr index 212f1228645..fad8f011f75 100644 --- a/src/test/ui/consts/projection_qualif.stock.stderr +++ b/src/test/ui/consts/projection_qualif.stock.stderr @@ -13,15 +13,7 @@ LL | unsafe { *b = 5; } = note: see issue #51911 for more information = help: add `#![feature(const_raw_ptr_deref)]` to the crate attributes to enable -error[E0019]: constant contains unimplemented expression type - --> $DIR/projection_qualif.rs:11:18 - | -LL | unsafe { *b = 5; } - | ^^^^^^ - | - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable +error: aborting due to 2 previous errors -error: aborting due to 3 previous errors - -Some errors have detailed explanations: E0019, E0658, E0764. -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/static_mut_containing_mut_ref2.rs b/src/test/ui/consts/static_mut_containing_mut_ref2.rs index a6bbe8d6ec2..2821d1a0154 100644 --- a/src/test/ui/consts/static_mut_containing_mut_ref2.rs +++ b/src/test/ui/consts/static_mut_containing_mut_ref2.rs @@ -6,6 +6,5 @@ static mut STDERR_BUFFER_SPACE: u8 = 0; pub static mut STDERR_BUFFER: () = unsafe { *(&mut STDERR_BUFFER_SPACE) = 42; }; //~^ ERROR mutable references are not allowed in statics -//[stock]~| ERROR static contains unimplemented expression type fn main() {} 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 57fb27e642e..36c280ca5c6 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 @@ -4,15 +4,6 @@ error[E0764]: mutable references are not allowed in statics LL | pub static mut STDERR_BUFFER: () = unsafe { *(&mut STDERR_BUFFER_SPACE) = 42; }; | ^^^^^^^^^^^^^^^^^^^^^^^^^^ `&mut` is only allowed in `const fn` -error[E0019]: static contains unimplemented expression type - --> $DIR/static_mut_containing_mut_ref2.rs:7:45 - | -LL | pub static mut STDERR_BUFFER: () = unsafe { *(&mut STDERR_BUFFER_SPACE) = 42; }; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable +error: aborting due to previous error -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0019, E0764. -For more information about an error, try `rustc --explain E0019`. +For more information about this error, try `rustc --explain E0764`.