Bless tests
This commit is contained in:
parent
b400871b9c
commit
51fbd555f0
21 changed files with 75 additions and 246 deletions
|
@ -78,7 +78,6 @@ struct MyOwned;
|
||||||
|
|
||||||
static STATIC11: Box<MyOwned> = box MyOwned;
|
static STATIC11: Box<MyOwned> = box MyOwned;
|
||||||
//~^ ERROR allocations are not allowed in statics
|
//~^ ERROR allocations are not allowed in statics
|
||||||
//~| ERROR static contains unimplemented expression type
|
|
||||||
|
|
||||||
static mut STATIC12: UnsafeStruct = UnsafeStruct;
|
static mut STATIC12: UnsafeStruct = UnsafeStruct;
|
||||||
|
|
||||||
|
@ -93,16 +92,12 @@ static mut STATIC14: SafeStruct = SafeStruct {
|
||||||
|
|
||||||
static STATIC15: &'static [Box<MyOwned>] = &[
|
static STATIC15: &'static [Box<MyOwned>] = &[
|
||||||
box MyOwned, //~ ERROR allocations are not allowed in statics
|
box MyOwned, //~ ERROR allocations are not allowed in statics
|
||||||
//~| ERROR contains unimplemented expression
|
|
||||||
box MyOwned, //~ ERROR allocations are not allowed in statics
|
box MyOwned, //~ ERROR allocations are not allowed in statics
|
||||||
//~| ERROR contains unimplemented expression
|
|
||||||
];
|
];
|
||||||
|
|
||||||
static STATIC16: (&'static Box<MyOwned>, &'static Box<MyOwned>) = (
|
static STATIC16: (&'static Box<MyOwned>, &'static Box<MyOwned>) = (
|
||||||
&box MyOwned, //~ ERROR allocations are not allowed in statics
|
&box MyOwned, //~ ERROR allocations are not allowed in statics
|
||||||
//~| ERROR contains unimplemented expression
|
|
||||||
&box MyOwned, //~ ERROR allocations are not allowed in statics
|
&box MyOwned, //~ ERROR allocations are not allowed in statics
|
||||||
//~| ERROR contains unimplemented expression
|
|
||||||
);
|
);
|
||||||
|
|
||||||
static mut STATIC17: SafeEnum = SafeEnum::Variant1;
|
static mut STATIC17: SafeEnum = SafeEnum::Variant1;
|
||||||
|
@ -110,11 +105,9 @@ static mut STATIC17: SafeEnum = SafeEnum::Variant1;
|
||||||
static STATIC19: Box<isize> =
|
static STATIC19: Box<isize> =
|
||||||
box 3;
|
box 3;
|
||||||
//~^ ERROR allocations are not allowed in statics
|
//~^ ERROR allocations are not allowed in statics
|
||||||
//~| ERROR contains unimplemented expression
|
|
||||||
|
|
||||||
pub fn main() {
|
pub fn main() {
|
||||||
let y = { static x: Box<isize> = box 3; x };
|
let y = { static x: Box<isize> = box 3; x };
|
||||||
//~^ ERROR allocations are not allowed in statics
|
//~^ ERROR allocations are not allowed in statics
|
||||||
//~| ERROR cannot move out of static item
|
//~| ERROR cannot move out of static item
|
||||||
//~| ERROR contains unimplemented expression
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,92 +15,44 @@ error[E0010]: allocations are not allowed in statics
|
||||||
LL | static STATIC11: Box<MyOwned> = box MyOwned;
|
LL | static STATIC11: Box<MyOwned> = box MyOwned;
|
||||||
| ^^^^^^^^^^^ allocation not allowed in statics
|
| ^^^^^^^^^^^ allocation not allowed in statics
|
||||||
|
|
||||||
error[E0019]: static contains unimplemented expression type
|
|
||||||
--> $DIR/check-static-values-constraints.rs:79:37
|
|
||||||
|
|
|
||||||
LL | static STATIC11: Box<MyOwned> = 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
|
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())
|
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
|
error[E0010]: allocations are not allowed in statics
|
||||||
--> $DIR/check-static-values-constraints.rs:95:5
|
--> $DIR/check-static-values-constraints.rs:95:5
|
||||||
|
|
|
|
||||||
LL | box MyOwned,
|
LL | box MyOwned,
|
||||||
| ^^^^^^^^^^^ allocation not allowed in statics
|
| ^^^^^^^^^^^ 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
|
error[E0010]: allocations are not allowed in statics
|
||||||
--> $DIR/check-static-values-constraints.rs:97:5
|
--> $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: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
|
|
||||||
|
|
|
|
||||||
LL | &box MyOwned,
|
LL | &box MyOwned,
|
||||||
| ^^^^^^^^^^^ allocation not allowed in statics
|
| ^^^^^^^^^^^ 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
|
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,
|
LL | &box MyOwned,
|
||||||
| ^^^^^^^^^^^ allocation not allowed in statics
|
| ^^^^^^^^^^^ 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
|
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;
|
LL | box 3;
|
||||||
| ^^^^^ allocation not allowed in statics
|
| ^^^^^ 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`
|
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<isize> = box 3; x };
|
LL | let y = { static x: Box<isize> = box 3; x };
|
||||||
| ^
|
| ^
|
||||||
|
@ -109,20 +61,12 @@ LL | let y = { static x: Box<isize> = box 3; x };
|
||||||
| help: consider borrowing here: `&x`
|
| help: consider borrowing here: `&x`
|
||||||
|
|
||||||
error[E0010]: allocations are not allowed in statics
|
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<isize> = box 3; x };
|
LL | let y = { static x: Box<isize> = box 3; x };
|
||||||
| ^^^^^ allocation not allowed in statics
|
| ^^^^^ allocation not allowed in statics
|
||||||
|
|
||||||
error[E0019]: static contains unimplemented expression type
|
error: aborting due to 10 previous errors
|
||||||
--> $DIR/check-static-values-constraints.rs:116:42
|
|
||||||
|
|
|
||||||
LL | let y = { static x: Box<isize> = box 3; x };
|
|
||||||
| ^
|
|
||||||
|
|
|
||||||
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error: aborting due to 17 previous errors
|
Some errors have detailed explanations: E0010, E0015, E0493, E0507.
|
||||||
|
|
||||||
Some errors have detailed explanations: E0010, E0015, E0019, E0493, E0507.
|
|
||||||
For more information about an error, try `rustc --explain E0010`.
|
For more information about an error, try `rustc --explain E0010`.
|
||||||
|
|
|
@ -2,8 +2,6 @@ const WRITE: () = unsafe {
|
||||||
*std::ptr::null_mut() = 0;
|
*std::ptr::null_mut() = 0;
|
||||||
//~^ ERROR dereferencing raw pointers in constants is unstable
|
//~^ ERROR dereferencing raw pointers in constants is unstable
|
||||||
//~| HELP add `#![feature(const_raw_ptr_deref)]` to the crate attributes to enable
|
//~| 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() {}
|
fn main() {}
|
||||||
|
|
|
@ -7,15 +7,6 @@ LL | *std::ptr::null_mut() = 0;
|
||||||
= note: see issue #51911 <https://github.com/rust-lang/rust/issues/51911> for more information
|
= note: see issue #51911 <https://github.com/rust-lang/rust/issues/51911> for more information
|
||||||
= help: add `#![feature(const_raw_ptr_deref)]` to the crate attributes to enable
|
= help: add `#![feature(const_raw_ptr_deref)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0019]: constant contains unimplemented expression type
|
error: aborting due to previous error
|
||||||
--> $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 2 previous errors
|
For more information about this error, try `rustc --explain E0658`.
|
||||||
|
|
||||||
Some errors have detailed explanations: E0019, E0658.
|
|
||||||
For more information about an error, try `rustc --explain E0019`.
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
error[E0658]: function pointers cannot appear in constant functions
|
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() { || {} }
|
LL | const unsafe extern "C" fn closure() -> fn() { || {} }
|
||||||
| ^^^^
|
| ^^^^^
|
||||||
|
|
|
|
||||||
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
|
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
|
||||||
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
|
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
error[E0658]: function pointers cannot appear in constant functions
|
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() { || {} }
|
LL | const fn closure() -> fn() { || {} }
|
||||||
| ^^^^
|
| ^^^^^
|
||||||
|
|
|
|
||||||
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
|
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
|
||||||
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
|
= 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
|
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0658]: function pointers cannot appear in constant functions
|
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 }
|
LL | const fn reify(f: fn()) -> unsafe fn() { f }
|
||||||
| ^^^^^^^^^^^
|
| ^
|
||||||
|
|
|
|
||||||
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
|
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
|
||||||
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
|
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
|
||||||
|
|
|
@ -40,7 +40,6 @@ impl<T> Foo<T> {
|
||||||
//~^ mutable references
|
//~^ mutable references
|
||||||
//~| mutable references
|
//~| mutable references
|
||||||
//~| mutable references
|
//~| mutable references
|
||||||
//~| mutable references
|
|
||||||
}
|
}
|
||||||
impl<'a, T> Foo<T> {
|
impl<'a, T> Foo<T> {
|
||||||
const fn new_lt(t: T) -> Self { Foo(t) }
|
const fn new_lt(t: T) -> Self { Foo(t) }
|
||||||
|
@ -50,7 +49,6 @@ impl<'a, T> Foo<T> {
|
||||||
//~^ mutable references
|
//~^ mutable references
|
||||||
//~| mutable references
|
//~| mutable references
|
||||||
//~| mutable references
|
//~| mutable references
|
||||||
//~| mutable references
|
|
||||||
}
|
}
|
||||||
impl<T: Sized> Foo<T> {
|
impl<T: Sized> Foo<T> {
|
||||||
const fn new_s(t: T) -> Self { Foo(t) }
|
const fn new_s(t: T) -> Self { Foo(t) }
|
||||||
|
@ -60,7 +58,6 @@ impl<T: Sized> Foo<T> {
|
||||||
//~^ mutable references
|
//~^ mutable references
|
||||||
//~| mutable references
|
//~| mutable references
|
||||||
//~| mutable references
|
//~| mutable references
|
||||||
//~| mutable references
|
|
||||||
}
|
}
|
||||||
impl<T: ?Sized> Foo<T> {
|
impl<T: ?Sized> Foo<T> {
|
||||||
const fn get_sq(&self) -> &T { &self.0 }
|
const fn get_sq(&self) -> &T { &self.0 }
|
||||||
|
@ -68,7 +65,6 @@ impl<T: ?Sized> Foo<T> {
|
||||||
//~^ mutable references
|
//~^ mutable references
|
||||||
//~| mutable references
|
//~| mutable references
|
||||||
//~| mutable references
|
//~| mutable references
|
||||||
//~| mutable references
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,15 +6,6 @@ LL | const fn into_inner(self) -> T { self.0 }
|
||||||
| |
|
| |
|
||||||
| constant functions cannot evaluate destructors
|
| 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 <https://github.com/rust-lang/rust/issues/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
|
error[E0658]: mutable references are not allowed in constant functions
|
||||||
--> $DIR/min_const_fn.rs:39:22
|
--> $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
|
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0493]: destructors cannot be evaluated at compile-time
|
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 }
|
LL | const fn into_inner_lt(self) -> T { self.0 }
|
||||||
| ^^^^ - value is dropped here
|
| ^^^^ - value is dropped here
|
||||||
|
@ -51,16 +42,7 @@ LL | const fn into_inner_lt(self) -> T { self.0 }
|
||||||
| constant functions cannot evaluate destructors
|
| constant functions cannot evaluate destructors
|
||||||
|
|
||||||
error[E0658]: mutable references are not allowed in constant functions
|
error[E0658]: mutable references are not allowed in constant functions
|
||||||
--> $DIR/min_const_fn.rs:49:42
|
--> $DIR/min_const_fn.rs:48:25
|
||||||
|
|
|
||||||
LL | const fn get_mut_lt(&'a mut self) -> &mut T { &mut self.0 }
|
|
||||||
| ^^^^^^
|
|
||||||
|
|
|
||||||
= note: see issue #57349 <https://github.com/rust-lang/rust/issues/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 }
|
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
|
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0658]: mutable references are not allowed in constant functions
|
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 }
|
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
|
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0658]: mutable references are not allowed in constant functions
|
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 }
|
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
|
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0493]: destructors cannot be evaluated at compile-time
|
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 }
|
LL | const fn into_inner_s(self) -> T { self.0 }
|
||||||
| ^^^^ - value is dropped here
|
| ^^^^ - value is dropped here
|
||||||
|
@ -95,16 +77,7 @@ LL | const fn into_inner_s(self) -> T { self.0 }
|
||||||
| constant functions cannot evaluate destructors
|
| constant functions cannot evaluate destructors
|
||||||
|
|
||||||
error[E0658]: mutable references are not allowed in constant functions
|
error[E0658]: mutable references are not allowed in constant functions
|
||||||
--> $DIR/min_const_fn.rs:59:38
|
--> $DIR/min_const_fn.rs:57:24
|
||||||
|
|
|
||||||
LL | const fn get_mut_s(&mut self) -> &mut T { &mut self.0 }
|
|
||||||
| ^^^^^^
|
|
||||||
|
|
|
||||||
= note: see issue #57349 <https://github.com/rust-lang/rust/issues/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
|
|
||||||
|
|
|
|
||||||
LL | const fn get_mut_s(&mut self) -> &mut T { &mut self.0 }
|
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
|
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0658]: mutable references are not allowed in constant functions
|
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 }
|
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
|
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0658]: mutable references are not allowed in constant functions
|
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 }
|
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
|
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0658]: mutable references are not allowed in constant functions
|
error[E0658]: mutable references are not allowed in constant functions
|
||||||
--> $DIR/min_const_fn.rs:67:39
|
--> $DIR/min_const_fn.rs:64:25
|
||||||
|
|
|
||||||
LL | const fn get_mut_sq(&mut self) -> &mut T { &mut self.0 }
|
|
||||||
| ^^^^^^
|
|
||||||
|
|
|
||||||
= note: see issue #57349 <https://github.com/rust-lang/rust/issues/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 }
|
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
|
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0658]: mutable references are not allowed in constant functions
|
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 }
|
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
|
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0658]: mutable references are not allowed in constant functions
|
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 }
|
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
|
= 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
|
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: std::fmt::Display>(t: T) -> T { t }
|
LL | const fn foo11<T: std::fmt::Display>(t: T) -> T { t }
|
||||||
| ^
|
| ^
|
||||||
|
@ -176,7 +140,7 @@ LL | const fn foo11<T: std::fmt::Display>(t: T) -> T { t }
|
||||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
|
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: Send>(t: T) -> T { t }
|
LL | const fn foo11_2<T: Send>(t: T) -> T { t }
|
||||||
| ^
|
| ^
|
||||||
|
@ -185,7 +149,7 @@ LL | const fn foo11_2<T: Send>(t: T) -> T { t }
|
||||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0013]: constant functions cannot refer to statics
|
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 }
|
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
|
= help: consider extracting the value of the `static` to a `const`, and referring to that
|
||||||
|
|
||||||
error[E0013]: constant functions cannot refer to statics
|
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 }
|
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
|
= 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
|
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 }
|
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
|
= 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
|
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 } }
|
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
|
= 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
|
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 }
|
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
|
= 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
|
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 } }
|
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
|
= 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
|
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 }
|
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
|
= 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
|
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<T: std::fmt::Debug> Foo<T> {
|
LL | impl<T: std::fmt::Debug> Foo<T> {
|
||||||
| ^
|
| ^
|
||||||
|
@ -255,7 +219,7 @@ LL | impl<T: std::fmt::Debug> Foo<T> {
|
||||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
|
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<T: std::fmt::Debug + Sized> Foo<T> {
|
LL | impl<T: std::fmt::Debug + Sized> Foo<T> {
|
||||||
| ^
|
| ^
|
||||||
|
@ -264,7 +228,7 @@ LL | impl<T: std::fmt::Debug + Sized> Foo<T> {
|
||||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
|
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<T: Sync + Sized> Foo<T> {
|
LL | impl<T: Sync + Sized> Foo<T> {
|
||||||
| ^
|
| ^
|
||||||
|
@ -273,7 +237,7 @@ LL | impl<T: Sync + Sized> Foo<T> {
|
||||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
|
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<impl std::fmt::Debug>) {}
|
LL | const fn no_apit2(_x: AlanTuring<impl std::fmt::Debug>) {}
|
||||||
| ^^^^^^^^^^^^^^^^^^^^
|
| ^^^^^^^^^^^^^^^^^^^^
|
||||||
|
@ -282,7 +246,7 @@ LL | const fn no_apit2(_x: AlanTuring<impl std::fmt::Debug>) {}
|
||||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
|
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) {}
|
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
|
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
|
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) {}
|
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
|
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
|
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 { &() }
|
LL | const fn no_dyn_trait_ret() -> &'static dyn std::fmt::Debug { &() }
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
| ^^^
|
||||||
|
|
|
|
||||||
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
|
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
|
||||||
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0723]: trait bounds other than `Sized` on const fn parameters are unstable
|
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 }
|
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
|
= help: add `#![feature(const_fn)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0658]: function pointers cannot appear in constant functions
|
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()) {}
|
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
|
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0658]: function pointers cannot appear in constant functions
|
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 }
|
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 <https://github.com/rust-lang/rust/issues/57563> for more information
|
= note: see issue #57563 <https://github.com/rust-lang/rust/issues/57563> for more information
|
||||||
= help: add `#![feature(const_fn_fn_ptr_basics)]` to the crate attributes to enable
|
= 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.
|
Some errors have detailed explanations: E0013, E0493, E0658, E0723.
|
||||||
For more information about an error, try `rustc --explain E0013`.
|
For more information about an error, try `rustc --explain E0013`.
|
||||||
|
|
|
@ -4,6 +4,5 @@
|
||||||
#![allow(warnings)]
|
#![allow(warnings)]
|
||||||
|
|
||||||
const CON : Box<i32> = box 0; //~ ERROR E0010
|
const CON : Box<i32> = box 0; //~ ERROR E0010
|
||||||
//~^ ERROR constant contains unimplemented expression type
|
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -6,17 +6,6 @@ LL | const CON : Box<i32> = 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.
|
= 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
|
error: aborting due to previous error
|
||||||
--> $DIR/E0010-teach.rs:6:28
|
|
||||||
|
|
|
||||||
LL | const CON : Box<i32> = 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 2 previous errors
|
For more information about this error, try `rustc --explain E0010`.
|
||||||
|
|
||||||
Some errors have detailed explanations: E0010, E0019.
|
|
||||||
For more information about an error, try `rustc --explain E0010`.
|
|
||||||
|
|
|
@ -2,6 +2,5 @@
|
||||||
#![allow(warnings)]
|
#![allow(warnings)]
|
||||||
|
|
||||||
const CON : Box<i32> = box 0; //~ ERROR E0010
|
const CON : Box<i32> = box 0; //~ ERROR E0010
|
||||||
//~^ ERROR constant contains unimplemented expression type
|
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -4,15 +4,6 @@ error[E0010]: allocations are not allowed in constants
|
||||||
LL | const CON : Box<i32> = box 0;
|
LL | const CON : Box<i32> = box 0;
|
||||||
| ^^^^^ allocation not allowed in constants
|
| ^^^^^ allocation not allowed in constants
|
||||||
|
|
||||||
error[E0019]: constant contains unimplemented expression type
|
error: aborting due to previous error
|
||||||
--> $DIR/E0010.rs:4:28
|
|
||||||
|
|
|
||||||
LL | const CON : Box<i32> = box 0;
|
|
||||||
| ^
|
|
||||||
|
|
|
||||||
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
For more information about this error, try `rustc --explain E0010`.
|
||||||
|
|
||||||
Some errors have detailed explanations: E0010, E0019.
|
|
||||||
For more information about an error, try `rustc --explain E0010`.
|
|
||||||
|
|
|
@ -5,8 +5,8 @@ static mut M: i32 = 3;
|
||||||
const CR: &'static mut i32 = &mut C; //~ ERROR E0764
|
const CR: &'static mut i32 = &mut C; //~ ERROR E0764
|
||||||
//~| WARN taking a mutable
|
//~| WARN taking a mutable
|
||||||
static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0764
|
static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0764
|
||||||
//~| ERROR E0019
|
|
||||||
//~| ERROR cannot borrow
|
//~| ERROR cannot borrow
|
||||||
|
|
||||||
static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0764
|
static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0764
|
||||||
//~| WARN taking a mutable
|
//~| WARN taking a mutable
|
||||||
static STATIC_MUT_REF: &'static mut i32 = unsafe { &mut M }; //~ ERROR E0764
|
static STATIC_MUT_REF: &'static mut i32 = unsafe { &mut M }; //~ ERROR E0764
|
||||||
|
|
|
@ -19,14 +19,6 @@ error[E0764]: mutable references are not allowed in constants
|
||||||
LL | const CR: &'static mut i32 = &mut C;
|
LL | const CR: &'static mut i32 = &mut C;
|
||||||
| ^^^^^^ `&mut` is only allowed in `const fn`
|
| ^^^^^^ `&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
|
error[E0764]: mutable references are not allowed in statics
|
||||||
--> $DIR/E0017.rs:7:39
|
--> $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 };
|
LL | static STATIC_MUT_REF: &'static mut i32 = unsafe { &mut M };
|
||||||
| ^^^^^^ `&mut` is only allowed in `const fn`
|
| ^^^^^^ `&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.
|
Some errors have detailed explanations: E0596, E0764.
|
||||||
For more information about an error, try `rustc --explain E0019`.
|
For more information about an error, try `rustc --explain E0596`.
|
||||||
|
|
|
@ -3,9 +3,9 @@ const C: i32 = 2;
|
||||||
|
|
||||||
const CR: &'static mut i32 = &mut C; //~ ERROR E0764
|
const CR: &'static mut i32 = &mut C; //~ ERROR E0764
|
||||||
//~| WARN taking a mutable
|
//~| WARN taking a mutable
|
||||||
static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR E0019
|
static STATIC_REF: &'static mut i32 = &mut X; //~ ERROR cannot borrow
|
||||||
//~| ERROR cannot borrow
|
|
||||||
//~| ERROR E0764
|
//~| ERROR E0764
|
||||||
|
|
||||||
static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0764
|
static CONST_REF: &'static mut i32 = &mut C; //~ ERROR E0764
|
||||||
//~| WARN taking a mutable
|
//~| WARN taking a mutable
|
||||||
|
|
||||||
|
|
|
@ -19,14 +19,6 @@ error[E0764]: mutable references are not allowed in constants
|
||||||
LL | const CR: &'static mut i32 = &mut C;
|
LL | const CR: &'static mut i32 = &mut C;
|
||||||
| ^^^^^^ `&mut` is only allowed in `const fn`
|
| ^^^^^^ `&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
|
error[E0764]: mutable references are not allowed in statics
|
||||||
--> $DIR/E0388.rs:6:39
|
--> $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;
|
LL | static CONST_REF: &'static mut i32 = &mut C;
|
||||||
| ^^^^^^ `&mut` is only allowed in `const fn`
|
| ^^^^^^ `&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.
|
Some errors have detailed explanations: E0596, E0764.
|
||||||
For more information about an error, try `rustc --explain E0019`.
|
For more information about an error, try `rustc --explain E0596`.
|
||||||
|
|
|
@ -6,6 +6,5 @@ use std::cell::RefCell;
|
||||||
static boxed: Box<RefCell<isize>> = box RefCell::new(0);
|
static boxed: Box<RefCell<isize>> = box RefCell::new(0);
|
||||||
//~^ ERROR allocations are not allowed in statics
|
//~^ ERROR allocations are not allowed in statics
|
||||||
//~| ERROR `RefCell<isize>` cannot be shared between threads safely [E0277]
|
//~| ERROR `RefCell<isize>` cannot be shared between threads safely [E0277]
|
||||||
//~| ERROR static contains unimplemented expression type
|
|
||||||
|
|
||||||
fn main() { }
|
fn main() { }
|
||||||
|
|
|
@ -4,14 +4,6 @@ error[E0010]: allocations are not allowed in statics
|
||||||
LL | static boxed: Box<RefCell<isize>> = box RefCell::new(0);
|
LL | static boxed: Box<RefCell<isize>> = box RefCell::new(0);
|
||||||
| ^^^^^^^^^^^^^^^^^^^ allocation not allowed in statics
|
| ^^^^^^^^^^^^^^^^^^^ allocation not allowed in statics
|
||||||
|
|
||||||
error[E0019]: static contains unimplemented expression type
|
|
||||||
--> $DIR/issue-7364.rs:6:41
|
|
||||||
|
|
|
||||||
LL | static boxed: Box<RefCell<isize>> = box RefCell::new(0);
|
|
||||||
| ^^^^^^^^^^^^^^^
|
|
||||||
|
|
|
||||||
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error[E0277]: `RefCell<isize>` cannot be shared between threads safely
|
error[E0277]: `RefCell<isize>` cannot be shared between threads safely
|
||||||
--> $DIR/issue-7364.rs:6:1
|
--> $DIR/issue-7364.rs:6:1
|
||||||
|
|
|
|
||||||
|
@ -23,7 +15,7 @@ LL | static boxed: Box<RefCell<isize>> = box RefCell::new(0);
|
||||||
= note: required because it appears within the type `Box<RefCell<isize>>`
|
= note: required because it appears within the type `Box<RefCell<isize>>`
|
||||||
= note: shared static variables must have a type that implements `Sync`
|
= 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`.
|
For more information about an error, try `rustc --explain E0010`.
|
||||||
|
|
|
@ -2,6 +2,5 @@
|
||||||
|
|
||||||
static mut a: Box<isize> = box 3;
|
static mut a: Box<isize> = box 3;
|
||||||
//~^ ERROR allocations are not allowed in statics
|
//~^ ERROR allocations are not allowed in statics
|
||||||
//~| ERROR static contains unimplemented expression type
|
|
||||||
|
|
||||||
fn main() {}
|
fn main() {}
|
||||||
|
|
|
@ -4,15 +4,6 @@ error[E0010]: allocations are not allowed in statics
|
||||||
LL | static mut a: Box<isize> = box 3;
|
LL | static mut a: Box<isize> = box 3;
|
||||||
| ^^^^^ allocation not allowed in statics
|
| ^^^^^ allocation not allowed in statics
|
||||||
|
|
||||||
error[E0019]: static contains unimplemented expression type
|
error: aborting due to previous error
|
||||||
--> $DIR/static-mut-not-constant.rs:3:32
|
|
||||||
|
|
|
||||||
LL | static mut a: Box<isize> = box 3;
|
|
||||||
| ^
|
|
||||||
|
|
|
||||||
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
|
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
For more information about this error, try `rustc --explain E0010`.
|
||||||
|
|
||||||
Some errors have detailed explanations: E0010, E0019.
|
|
||||||
For more information about an error, try `rustc --explain E0010`.
|
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
error[E0658]: mutable references are not allowed in constant functions
|
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;
|
LL | let y = &mut x.0;
|
||||||
| ^
|
| ^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
|
= note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
|
||||||
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
|
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
|
||||||
|
|
||||||
error[E0658]: mutable references are not allowed in constant functions
|
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 };
|
LL | let y = unsafe { &mut x.0 };
|
||||||
| ^
|
| ^^^^^^^^
|
||||||
|
|
|
|
||||||
= note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
|
= note: see issue #57349 <https://github.com/rust-lang/rust/issues/57349> for more information
|
||||||
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
|
= help: add `#![feature(const_mut_refs)]` to the crate attributes to enable
|
||||||
|
|
Loading…
Add table
Reference in a new issue