diff --git a/src/test/ui/check-static-values-constraints.rs b/src/test/ui/check-static-values-constraints.rs index acfb3b5e44b..3d1b5a08227 100644 --- a/src/test/ui/check-static-values-constraints.rs +++ b/src/test/ui/check-static-values-constraints.rs @@ -78,7 +78,6 @@ struct MyOwned; static STATIC11: Box = box MyOwned; //~^ ERROR allocations are not allowed in statics -//~| ERROR static contains unimplemented expression type static mut STATIC12: UnsafeStruct = UnsafeStruct; @@ -93,16 +92,12 @@ static mut STATIC14: SafeStruct = SafeStruct { static STATIC15: &'static [Box] = &[ box MyOwned, //~ ERROR allocations are not allowed in statics - //~| ERROR contains unimplemented expression box MyOwned, //~ ERROR allocations are not allowed in statics - //~| ERROR contains unimplemented expression ]; static STATIC16: (&'static Box, &'static Box) = ( &box MyOwned, //~ ERROR allocations are not allowed in statics - //~| ERROR contains unimplemented expression &box MyOwned, //~ ERROR allocations are not allowed in statics - //~| ERROR contains unimplemented expression ); static mut STATIC17: SafeEnum = SafeEnum::Variant1; @@ -110,11 +105,9 @@ static mut STATIC17: SafeEnum = SafeEnum::Variant1; static STATIC19: Box = box 3; //~^ ERROR allocations are not allowed in statics - //~| ERROR contains unimplemented expression pub fn main() { let y = { static x: Box = box 3; x }; //~^ ERROR allocations are not allowed in statics //~| ERROR cannot move out of static item - //~| ERROR contains unimplemented expression } diff --git a/src/test/ui/check-static-values-constraints.stderr b/src/test/ui/check-static-values-constraints.stderr index 50c1b5088e7..eb640c88e02 100644 --- a/src/test/ui/check-static-values-constraints.stderr +++ b/src/test/ui/check-static-values-constraints.stderr @@ -15,92 +15,44 @@ error[E0010]: allocations are not allowed in statics LL | static STATIC11: Box = box MyOwned; | ^^^^^^^^^^^ allocation not allowed in statics -error[E0019]: static contains unimplemented expression type - --> $DIR/check-static-values-constraints.rs:79:37 - | -LL | static STATIC11: Box = box MyOwned; - | ^^^^^^^ - | - = 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/check-static-values-constraints.rs:90:32 + --> $DIR/check-static-values-constraints.rs:89:32 | LL | field2: SafeEnum::Variant4("str".to_string()) | ^^^^^^^^^^^^^^^^^ +error[E0010]: allocations are not allowed in statics + --> $DIR/check-static-values-constraints.rs:94:5 + | +LL | box MyOwned, + | ^^^^^^^^^^^ allocation not allowed in statics + error[E0010]: allocations are not allowed in statics --> $DIR/check-static-values-constraints.rs:95:5 | LL | box MyOwned, | ^^^^^^^^^^^ allocation not allowed in statics -error[E0019]: static contains unimplemented expression type - --> $DIR/check-static-values-constraints.rs:95:9 - | -LL | box MyOwned, - | ^^^^^^^ - | - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable - error[E0010]: allocations are not allowed in statics - --> $DIR/check-static-values-constraints.rs:97:5 - | -LL | box MyOwned, - | ^^^^^^^^^^^ allocation not allowed in statics - -error[E0019]: static contains unimplemented expression type - --> $DIR/check-static-values-constraints.rs:97:9 - | -LL | box MyOwned, - | ^^^^^^^ - | - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable - -error[E0010]: allocations are not allowed in statics - --> $DIR/check-static-values-constraints.rs:102:6 + --> $DIR/check-static-values-constraints.rs:99:6 | LL | &box MyOwned, | ^^^^^^^^^^^ allocation not allowed in statics -error[E0019]: static contains unimplemented expression type - --> $DIR/check-static-values-constraints.rs:102:10 - | -LL | &box MyOwned, - | ^^^^^^^ - | - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable - error[E0010]: allocations are not allowed in statics - --> $DIR/check-static-values-constraints.rs:104:6 + --> $DIR/check-static-values-constraints.rs:100:6 | LL | &box MyOwned, | ^^^^^^^^^^^ allocation not allowed in statics -error[E0019]: static contains unimplemented expression type - --> $DIR/check-static-values-constraints.rs:104:10 - | -LL | &box MyOwned, - | ^^^^^^^ - | - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable - error[E0010]: allocations are not allowed in statics - --> $DIR/check-static-values-constraints.rs:111:5 + --> $DIR/check-static-values-constraints.rs:106:5 | LL | box 3; | ^^^^^ allocation not allowed in statics -error[E0019]: static contains unimplemented expression type - --> $DIR/check-static-values-constraints.rs:111:9 - | -LL | box 3; - | ^ - | - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable - error[E0507]: cannot move out of static item `x` - --> $DIR/check-static-values-constraints.rs:116:45 + --> $DIR/check-static-values-constraints.rs:110:45 | LL | let y = { static x: Box = box 3; x }; | ^ @@ -109,20 +61,12 @@ LL | let y = { static x: Box = box 3; x }; | help: consider borrowing here: `&x` error[E0010]: allocations are not allowed in statics - --> $DIR/check-static-values-constraints.rs:116:38 + --> $DIR/check-static-values-constraints.rs:110:38 | LL | let y = { static x: Box = box 3; x }; | ^^^^^ allocation not allowed in statics -error[E0019]: static contains unimplemented expression type - --> $DIR/check-static-values-constraints.rs:116:42 - | -LL | let y = { static x: Box = box 3; x }; - | ^ - | - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable +error: aborting due to 10 previous errors -error: aborting due to 17 previous errors - -Some errors have detailed explanations: E0010, E0015, E0019, E0493, E0507. +Some errors have detailed explanations: E0010, E0015, E0493, E0507. For more information about an error, try `rustc --explain E0010`. diff --git a/src/test/ui/const-suggest-feature.rs b/src/test/ui/const-suggest-feature.rs index 89fafbbe6f0..d11b91edb88 100644 --- a/src/test/ui/const-suggest-feature.rs +++ b/src/test/ui/const-suggest-feature.rs @@ -2,8 +2,6 @@ const WRITE: () = unsafe { *std::ptr::null_mut() = 0; //~^ ERROR dereferencing raw pointers in constants is unstable //~| HELP add `#![feature(const_raw_ptr_deref)]` to the crate attributes to enable - //~| ERROR constant contains unimplemented expression type - //~| HELP add `#![feature(const_mut_refs)]` to the crate attributes to enable }; fn main() {} diff --git a/src/test/ui/const-suggest-feature.stderr b/src/test/ui/const-suggest-feature.stderr index 6b91df6b42d..1ccc3d754ff 100644 --- a/src/test/ui/const-suggest-feature.stderr +++ b/src/test/ui/const-suggest-feature.stderr @@ -7,15 +7,6 @@ LL | *std::ptr::null_mut() = 0; = 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/const-suggest-feature.rs:2:5 - | -LL | *std::ptr::null_mut() = 0; - | ^^^^^^^^^^^^^^^^^^^^^^^^^ - | - = 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, E0658. -For more information about an error, try `rustc --explain E0019`. +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/consts/const-extern-fn/const-extern-fn-min-const-fn.stderr b/src/test/ui/consts/const-extern-fn/const-extern-fn-min-const-fn.stderr index 455a822e2d0..54067b462f8 100644 --- a/src/test/ui/consts/const-extern-fn/const-extern-fn-min-const-fn.stderr +++ b/src/test/ui/consts/const-extern-fn/const-extern-fn-min-const-fn.stderr @@ -1,8 +1,8 @@ error[E0658]: function pointers cannot appear in constant functions - --> $DIR/const-extern-fn-min-const-fn.rs:4:41 + --> $DIR/const-extern-fn-min-const-fn.rs:4:48 | LL | const unsafe extern "C" fn closure() -> fn() { || {} } - | ^^^^ + | ^^^^^ | = note: see issue #57563 for more information = help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable diff --git a/src/test/ui/consts/min_const_fn/cast_errors.stderr b/src/test/ui/consts/min_const_fn/cast_errors.stderr index ac77c181afd..32eb1095e08 100644 --- a/src/test/ui/consts/min_const_fn/cast_errors.stderr +++ b/src/test/ui/consts/min_const_fn/cast_errors.stderr @@ -1,8 +1,8 @@ error[E0658]: function pointers cannot appear in constant functions - --> $DIR/cast_errors.rs:4:23 + --> $DIR/cast_errors.rs:4:30 | LL | const fn closure() -> fn() { || {} } - | ^^^^ + | ^^^^^ | = note: see issue #57563 for more information = help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable @@ -17,10 +17,10 @@ LL | (|| {}) as 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/cast_errors.rs:10:28 + --> $DIR/cast_errors.rs:10:16 | LL | const fn reify(f: fn()) -> unsafe fn() { f } - | ^^^^^^^^^^^ + | ^ | = note: see issue #57563 for more information = help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable 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 199295531d7..4c06aeb76c7 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 @@ -40,7 +40,6 @@ impl Foo { //~^ mutable references //~| mutable references //~| mutable references - //~| mutable references } impl<'a, T> Foo { const fn new_lt(t: T) -> Self { Foo(t) } @@ -50,7 +49,6 @@ impl<'a, T> Foo { //~^ mutable references //~| mutable references //~| mutable references - //~| mutable references } impl Foo { const fn new_s(t: T) -> Self { Foo(t) } @@ -60,7 +58,6 @@ impl Foo { //~^ mutable references //~| mutable references //~| mutable references - //~| mutable references } impl Foo { const fn get_sq(&self) -> &T { &self.0 } @@ -68,7 +65,6 @@ impl Foo { //~^ 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 6ec33089401..638276a4d06 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 @@ -6,15 +6,6 @@ LL | const fn into_inner(self) -> T { self.0 } | | | constant functions cannot evaluate destructors -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:22 | @@ -43,7 +34,7 @@ LL | const fn get_mut(&mut self) -> &mut T { &mut self.0 } = 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:47:28 + --> $DIR/min_const_fn.rs:46:28 | LL | const fn into_inner_lt(self) -> T { self.0 } | ^^^^ - value is dropped here @@ -51,16 +42,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: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:25 + --> $DIR/min_const_fn.rs:48:25 | LL | const fn get_mut_lt(&'a mut self) -> &mut T { &mut self.0 } | ^^^^^^^^^^^^ @@ -69,7 +51,7 @@ LL | const fn get_mut_lt(&'a 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:49:42 + --> $DIR/min_const_fn.rs:48:42 | LL | const fn get_mut_lt(&'a mut self) -> &mut T { &mut self.0 } | ^^^^^^ @@ -78,7 +60,7 @@ LL | const fn get_mut_lt(&'a 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:49:51 + --> $DIR/min_const_fn.rs:48:51 | LL | const fn get_mut_lt(&'a mut self) -> &mut T { &mut self.0 } | ^^^^^^^^^^^ @@ -87,7 +69,7 @@ LL | const fn get_mut_lt(&'a mut self) -> &mut T { &mut self.0 } = 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:57:27 + --> $DIR/min_const_fn.rs:55:27 | LL | const fn into_inner_s(self) -> T { self.0 } | ^^^^ - value is dropped here @@ -95,16 +77,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: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:24 + --> $DIR/min_const_fn.rs:57:24 | LL | const fn get_mut_s(&mut self) -> &mut T { &mut self.0 } | ^^^^^^^^^ @@ -113,7 +86,7 @@ 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:59:38 + --> $DIR/min_const_fn.rs:57:38 | LL | const fn get_mut_s(&mut self) -> &mut T { &mut self.0 } | ^^^^^^ @@ -122,7 +95,7 @@ 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:59:47 + --> $DIR/min_const_fn.rs:57:47 | LL | const fn get_mut_s(&mut self) -> &mut T { &mut self.0 } | ^^^^^^^^^^^ @@ -131,16 +104,7 @@ 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: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:25 + --> $DIR/min_const_fn.rs:64:25 | LL | const fn get_mut_sq(&mut self) -> &mut T { &mut self.0 } | ^^^^^^^^^ @@ -149,7 +113,7 @@ LL | const fn get_mut_sq(&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:67:39 + --> $DIR/min_const_fn.rs:64:39 | LL | const fn get_mut_sq(&mut self) -> &mut T { &mut self.0 } | ^^^^^^ @@ -158,7 +122,7 @@ LL | const fn get_mut_sq(&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:67:48 + --> $DIR/min_const_fn.rs:64:48 | LL | const fn get_mut_sq(&mut self) -> &mut T { &mut self.0 } | ^^^^^^^^^^^ @@ -167,7 +131,7 @@ LL | const fn get_mut_sq(&mut self) -> &mut T { &mut self.0 } = 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:88:16 + --> $DIR/min_const_fn.rs:84:16 | LL | const fn foo11(t: T) -> T { t } | ^ @@ -176,7 +140,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:90:18 + --> $DIR/min_const_fn.rs:86:18 | LL | const fn foo11_2(t: T) -> T { t } | ^ @@ -185,7 +149,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:94:27 + --> $DIR/min_const_fn.rs:90:27 | LL | const fn foo25() -> u32 { BAR } | ^^^ @@ -193,7 +157,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:95:37 + --> $DIR/min_const_fn.rs:91:37 | LL | const fn foo26() -> &'static u32 { &BAR } | ^^^ @@ -201,7 +165,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:96:42 + --> $DIR/min_const_fn.rs:92:42 | LL | const fn foo30(x: *const u32) -> usize { x as usize } | ^^^^^^^^^^ @@ -210,7 +174,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:98:63 + --> $DIR/min_const_fn.rs:94:63 | LL | const fn foo30_with_unsafe(x: *const u32) -> usize { unsafe { x as usize } } | ^^^^^^^^^^ @@ -219,7 +183,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:100:42 + --> $DIR/min_const_fn.rs:96:42 | LL | const fn foo30_2(x: *mut u32) -> usize { x as usize } | ^^^^^^^^^^ @@ -228,7 +192,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:102:63 + --> $DIR/min_const_fn.rs:98:63 | LL | const fn foo30_2_with_unsafe(x: *mut u32) -> usize { unsafe { x as usize } } | ^^^^^^^^^^ @@ -237,7 +201,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:105:14 + --> $DIR/min_const_fn.rs:101:14 | LL | const fn inc(x: &mut i32) { *x += 1 } | ^ @@ -246,7 +210,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:114:6 + --> $DIR/min_const_fn.rs:110:6 | LL | impl Foo { | ^ @@ -255,7 +219,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:119:6 + --> $DIR/min_const_fn.rs:115:6 | LL | impl Foo { | ^ @@ -264,7 +228,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:124:6 + --> $DIR/min_const_fn.rs:120:6 | LL | impl Foo { | ^ @@ -273,7 +237,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:130:34 + --> $DIR/min_const_fn.rs:126:34 | LL | const fn no_apit2(_x: AlanTuring) {} | ^^^^^^^^^^^^^^^^^^^^ @@ -282,7 +246,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:132:22 + --> $DIR/min_const_fn.rs:128:22 | LL | const fn no_apit(_x: impl std::fmt::Debug) {} | ^^^^^^^^^^^^^^^^^^^^ @@ -291,7 +255,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:133:23 + --> $DIR/min_const_fn.rs:129:23 | LL | const fn no_dyn_trait(_x: &dyn std::fmt::Debug) {} | ^^ @@ -300,16 +264,16 @@ 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:134:32 + --> $DIR/min_const_fn.rs:130:63 | LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() } - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + | ^^^ | = note: see issue #57563 for more information = 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:139:41 + --> $DIR/min_const_fn.rs:135:41 | LL | const fn really_no_traits_i_mean_it() { (&() as &dyn std::fmt::Debug, ()).1 } | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ @@ -318,7 +282,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:142:21 + --> $DIR/min_const_fn.rs:138:21 | LL | const fn no_fn_ptrs(_x: fn()) {} | ^^ @@ -327,7 +291,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:144:27 + --> $DIR/min_const_fn.rs:140:27 | LL | const fn no_fn_ptrs2() -> fn() { fn foo() {} foo } | ^^^^ @@ -335,7 +299,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 38 previous errors +error: aborting due to 34 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/error-codes/E0010-teach.rs b/src/test/ui/error-codes/E0010-teach.rs index da51035ab55..fc5dffb37cf 100644 --- a/src/test/ui/error-codes/E0010-teach.rs +++ b/src/test/ui/error-codes/E0010-teach.rs @@ -4,6 +4,5 @@ #![allow(warnings)] const CON : Box = box 0; //~ ERROR E0010 -//~^ ERROR constant contains unimplemented expression type fn main() {} diff --git a/src/test/ui/error-codes/E0010-teach.stderr b/src/test/ui/error-codes/E0010-teach.stderr index c15ab5c655a..33de9fd685e 100644 --- a/src/test/ui/error-codes/E0010-teach.stderr +++ b/src/test/ui/error-codes/E0010-teach.stderr @@ -6,17 +6,6 @@ LL | const CON : Box = box 0; | = note: The value of statics and constants must be known at compile time, and they live for the entire lifetime of a program. Creating a boxed value allocates memory on the heap at runtime, and therefore cannot be done at compile time. -error[E0019]: constant contains unimplemented expression type - --> $DIR/E0010-teach.rs:6:28 - | -LL | const CON : Box = box 0; - | ^ - | - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable - = note: A function call isn't allowed in the const's initialization expression because the expression's value must be known at compile-time. - = note: Remember: you can't use a function call inside a const's initialization expression! However, you can use it anywhere else. +error: aborting due to previous error -error: aborting due to 2 previous errors - -Some errors have detailed explanations: E0010, E0019. -For more information about an error, try `rustc --explain E0010`. +For more information about this error, try `rustc --explain E0010`. diff --git a/src/test/ui/error-codes/E0010.rs b/src/test/ui/error-codes/E0010.rs index 3398e2c28ba..e62997640f4 100644 --- a/src/test/ui/error-codes/E0010.rs +++ b/src/test/ui/error-codes/E0010.rs @@ -2,6 +2,5 @@ #![allow(warnings)] const CON : Box = box 0; //~ ERROR E0010 -//~^ ERROR constant contains unimplemented expression type fn main() {} diff --git a/src/test/ui/error-codes/E0010.stderr b/src/test/ui/error-codes/E0010.stderr index f49fb9c4632..0042333b98a 100644 --- a/src/test/ui/error-codes/E0010.stderr +++ b/src/test/ui/error-codes/E0010.stderr @@ -4,15 +4,6 @@ error[E0010]: allocations are not allowed in constants LL | const CON : Box = box 0; | ^^^^^ allocation not allowed in constants -error[E0019]: constant contains unimplemented expression type - --> $DIR/E0010.rs:4:28 - | -LL | const CON : Box = box 0; - | ^ - | - = 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: E0010, E0019. -For more information about an error, try `rustc --explain E0010`. +For more information about this error, try `rustc --explain E0010`. diff --git a/src/test/ui/error-codes/E0017.rs b/src/test/ui/error-codes/E0017.rs index 54d3cc54a84..262f7bc72c7 100644 --- a/src/test/ui/error-codes/E0017.rs +++ b/src/test/ui/error-codes/E0017.rs @@ -5,8 +5,8 @@ static mut M: i32 = 3; const CR: &'static mut i32 = &mut C; //~ ERROR E0764 //~| WARN taking a mutable static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0764 - //~| ERROR E0019 //~| ERROR cannot borrow + static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0764 //~| WARN taking a mutable static STATIC_MUT_REF: &'static mut i32 = unsafe { &mut M }; //~ ERROR E0764 diff --git a/src/test/ui/error-codes/E0017.stderr b/src/test/ui/error-codes/E0017.stderr index 40ef6bd97b3..ea591587e6d 100644 --- a/src/test/ui/error-codes/E0017.stderr +++ b/src/test/ui/error-codes/E0017.stderr @@ -19,14 +19,6 @@ error[E0764]: mutable references are not allowed in constants LL | const CR: &'static mut i32 = &mut C; | ^^^^^^ `&mut` is only allowed in `const fn` -error[E0019]: static contains unimplemented expression type - --> $DIR/E0017.rs:7:39 - | -LL | static STATIC_REF: &'static mut i32 = &mut X; - | ^^^^^^ - | - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable - error[E0764]: mutable references are not allowed in statics --> $DIR/E0017.rs:7:39 | @@ -65,7 +57,7 @@ error[E0764]: mutable references are not allowed in statics LL | static STATIC_MUT_REF: &'static mut i32 = unsafe { &mut M }; | ^^^^^^ `&mut` is only allowed in `const fn` -error: aborting due to 6 previous errors; 2 warnings emitted +error: aborting due to 5 previous errors; 2 warnings emitted -Some errors have detailed explanations: E0019, E0596, E0764. -For more information about an error, try `rustc --explain E0019`. +Some errors have detailed explanations: E0596, E0764. +For more information about an error, try `rustc --explain E0596`. diff --git a/src/test/ui/error-codes/E0388.rs b/src/test/ui/error-codes/E0388.rs index 8ad586bb30f..bb0c4979b9a 100644 --- a/src/test/ui/error-codes/E0388.rs +++ b/src/test/ui/error-codes/E0388.rs @@ -3,9 +3,9 @@ const C: i32 = 2; const CR: &'static mut i32 = &mut C; //~ ERROR E0764 //~| WARN taking a mutable -static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0019 - //~| ERROR cannot borrow +static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR cannot borrow //~| ERROR E0764 + static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0764 //~| WARN taking a mutable diff --git a/src/test/ui/error-codes/E0388.stderr b/src/test/ui/error-codes/E0388.stderr index 39bc717ceec..73e0b139cd0 100644 --- a/src/test/ui/error-codes/E0388.stderr +++ b/src/test/ui/error-codes/E0388.stderr @@ -19,14 +19,6 @@ error[E0764]: mutable references are not allowed in constants LL | const CR: &'static mut i32 = &mut C; | ^^^^^^ `&mut` is only allowed in `const fn` -error[E0019]: static contains unimplemented expression type - --> $DIR/E0388.rs:6:39 - | -LL | static STATIC_REF: &'static mut i32 = &mut X; - | ^^^^^^ - | - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable - error[E0764]: mutable references are not allowed in statics --> $DIR/E0388.rs:6:39 | @@ -59,7 +51,7 @@ error[E0764]: mutable references are not allowed in statics LL | static CONST_REF: &'static mut i32 = &mut C; | ^^^^^^ `&mut` is only allowed in `const fn` -error: aborting due to 5 previous errors; 2 warnings emitted +error: aborting due to 4 previous errors; 2 warnings emitted -Some errors have detailed explanations: E0019, E0596, E0764. -For more information about an error, try `rustc --explain E0019`. +Some errors have detailed explanations: E0596, E0764. +For more information about an error, try `rustc --explain E0596`. diff --git a/src/test/ui/issues/issue-7364.rs b/src/test/ui/issues/issue-7364.rs index 39452897e67..29a1644673d 100644 --- a/src/test/ui/issues/issue-7364.rs +++ b/src/test/ui/issues/issue-7364.rs @@ -6,6 +6,5 @@ use std::cell::RefCell; static boxed: Box> = box RefCell::new(0); //~^ ERROR allocations are not allowed in statics //~| ERROR `RefCell` cannot be shared between threads safely [E0277] -//~| ERROR static contains unimplemented expression type fn main() { } diff --git a/src/test/ui/issues/issue-7364.stderr b/src/test/ui/issues/issue-7364.stderr index 90f3bf53a7b..8ceb3be7ec9 100644 --- a/src/test/ui/issues/issue-7364.stderr +++ b/src/test/ui/issues/issue-7364.stderr @@ -4,14 +4,6 @@ error[E0010]: allocations are not allowed in statics LL | static boxed: Box> = box RefCell::new(0); | ^^^^^^^^^^^^^^^^^^^ allocation not allowed in statics -error[E0019]: static contains unimplemented expression type - --> $DIR/issue-7364.rs:6:41 - | -LL | static boxed: Box> = box RefCell::new(0); - | ^^^^^^^^^^^^^^^ - | - = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable - error[E0277]: `RefCell` cannot be shared between threads safely --> $DIR/issue-7364.rs:6:1 | @@ -23,7 +15,7 @@ LL | static boxed: Box> = box RefCell::new(0); = note: required because it appears within the type `Box>` = note: shared static variables must have a type that implements `Sync` -error: aborting due to 3 previous errors +error: aborting due to 2 previous errors -Some errors have detailed explanations: E0010, E0019, E0277. +Some errors have detailed explanations: E0010, E0277. For more information about an error, try `rustc --explain E0010`. diff --git a/src/test/ui/static/static-mut-not-constant.rs b/src/test/ui/static/static-mut-not-constant.rs index 84d401c9fa6..2091fffd418 100644 --- a/src/test/ui/static/static-mut-not-constant.rs +++ b/src/test/ui/static/static-mut-not-constant.rs @@ -2,6 +2,5 @@ static mut a: Box = box 3; //~^ ERROR allocations are not allowed in statics -//~| ERROR static contains unimplemented expression type fn main() {} diff --git a/src/test/ui/static/static-mut-not-constant.stderr b/src/test/ui/static/static-mut-not-constant.stderr index a618b49d108..a0fa245156f 100644 --- a/src/test/ui/static/static-mut-not-constant.stderr +++ b/src/test/ui/static/static-mut-not-constant.stderr @@ -4,15 +4,6 @@ error[E0010]: allocations are not allowed in statics LL | static mut a: Box = box 3; | ^^^^^ allocation not allowed in statics -error[E0019]: static contains unimplemented expression type - --> $DIR/static-mut-not-constant.rs:3:32 - | -LL | static mut a: Box = box 3; - | ^ - | - = 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: E0010, E0019. -For more information about an error, try `rustc --explain E0010`. +For more information about this error, try `rustc --explain E0010`. diff --git a/src/test/ui/unsafe/ranged_ints2_const.stderr b/src/test/ui/unsafe/ranged_ints2_const.stderr index 1a6bcd36ee1..5ce4296458e 100644 --- a/src/test/ui/unsafe/ranged_ints2_const.stderr +++ b/src/test/ui/unsafe/ranged_ints2_const.stderr @@ -1,17 +1,17 @@ error[E0658]: mutable references are not allowed in constant functions - --> $DIR/ranged_ints2_const.rs:11:9 + --> $DIR/ranged_ints2_const.rs:11:13 | LL | let y = &mut x.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/ranged_ints2_const.rs:18:9 + --> $DIR/ranged_ints2_const.rs:18:22 | LL | let y = unsafe { &mut x.0 }; - | ^ + | ^^^^^^^^ | = note: see issue #57349 for more information = help: add `#![feature(const_mut_refs)]` to the crate attributes to enable