mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 15:23:46 +00:00
update tests
This commit is contained in:
parent
e75fbaee45
commit
935516803e
@ -5,7 +5,9 @@ LL | ..SafeStruct{field1: SafeEnum::Va
|
|||||||
| ___________________________________________^
|
| ___________________________________________^
|
||||||
LL | |
|
LL | |
|
||||||
LL | | field2: SafeEnum::Variant1}};
|
LL | | field2: SafeEnum::Variant1}};
|
||||||
| |________________________________________________________________________________^ statics cannot evaluate destructors
|
| | ^- value is dropped here
|
||||||
|
| |________________________________________________________________________________|
|
||||||
|
| statics cannot evaluate destructors
|
||||||
|
|
||||||
error[E0010]: allocations are not allowed in statics
|
error[E0010]: allocations are not allowed in statics
|
||||||
--> $DIR/check-static-values-constraints.rs:79:33
|
--> $DIR/check-static-values-constraints.rs:79:33
|
||||||
|
@ -2,25 +2,33 @@ error[E0493]: destructors cannot be evaluated at compile-time
|
|||||||
--> $DIR/const_let.rs:16:32
|
--> $DIR/const_let.rs:16:32
|
||||||
|
|
|
|
||||||
LL | const Y: FakeNeedsDrop = { let mut x = FakeNeedsDrop; x = FakeNeedsDrop; x };
|
LL | const Y: FakeNeedsDrop = { let mut x = FakeNeedsDrop; x = FakeNeedsDrop; x };
|
||||||
| ^^^^^ constants cannot evaluate destructors
|
| ^^^^^ - value is dropped here
|
||||||
|
| |
|
||||||
|
| constants cannot evaluate destructors
|
||||||
|
|
||||||
error[E0493]: destructors cannot be evaluated at compile-time
|
error[E0493]: destructors cannot be evaluated at compile-time
|
||||||
--> $DIR/const_let.rs:20:33
|
--> $DIR/const_let.rs:20:33
|
||||||
|
|
|
|
||||||
LL | const Y2: FakeNeedsDrop = { let mut x; x = FakeNeedsDrop; x = FakeNeedsDrop; x };
|
LL | const Y2: FakeNeedsDrop = { let mut x; x = FakeNeedsDrop; x = FakeNeedsDrop; x };
|
||||||
| ^^^^^ constants cannot evaluate destructors
|
| ^^^^^ - value is dropped here
|
||||||
|
| |
|
||||||
|
| constants cannot evaluate destructors
|
||||||
|
|
||||||
error[E0493]: destructors cannot be evaluated at compile-time
|
error[E0493]: destructors cannot be evaluated at compile-time
|
||||||
--> $DIR/const_let.rs:24:21
|
--> $DIR/const_let.rs:24:21
|
||||||
|
|
|
|
||||||
LL | const Z: () = { let mut x = None; x = Some(FakeNeedsDrop); };
|
LL | const Z: () = { let mut x = None; x = Some(FakeNeedsDrop); };
|
||||||
| ^^^^^ constants cannot evaluate destructors
|
| ^^^^^ - value is dropped here
|
||||||
|
| |
|
||||||
|
| constants cannot evaluate destructors
|
||||||
|
|
||||||
error[E0493]: destructors cannot be evaluated at compile-time
|
error[E0493]: destructors cannot be evaluated at compile-time
|
||||||
--> $DIR/const_let.rs:28:22
|
--> $DIR/const_let.rs:28:22
|
||||||
|
|
|
|
||||||
LL | const Z2: () = { let mut x; x = None; x = Some(FakeNeedsDrop); };
|
LL | const Z2: () = { let mut x; x = None; x = Some(FakeNeedsDrop); };
|
||||||
| ^^^^^ constants cannot evaluate destructors
|
| ^^^^^ - value is dropped here
|
||||||
|
| |
|
||||||
|
| constants cannot evaluate destructors
|
||||||
|
|
||||||
error: aborting due to 4 previous errors
|
error: aborting due to 4 previous errors
|
||||||
|
|
||||||
|
@ -12,6 +12,9 @@ error[E0493]: destructors cannot be evaluated at compile-time
|
|||||||
|
|
|
|
||||||
LL | let mut x = Vec::<i32>::new();
|
LL | let mut x = Vec::<i32>::new();
|
||||||
| ^^^^^ constants cannot evaluate destructors
|
| ^^^^^ constants cannot evaluate destructors
|
||||||
|
...
|
||||||
|
LL | };
|
||||||
|
| - value is dropped here
|
||||||
|
|
||||||
error: aborting due to 2 previous errors
|
error: aborting due to 2 previous errors
|
||||||
|
|
||||||
|
20
src/test/ui/consts/const-eval/livedrop.rs
Normal file
20
src/test/ui/consts/const-eval/livedrop.rs
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#![feature(const_if_match)]
|
||||||
|
#![feature(const_loop)]
|
||||||
|
|
||||||
|
const _: Option<Vec<i32>> = {
|
||||||
|
let mut never_returned = Some(Vec::new());
|
||||||
|
let mut always_returned = None; //~ ERROR destructors cannot be evaluated at compile-time
|
||||||
|
|
||||||
|
let mut i = 0;
|
||||||
|
loop {
|
||||||
|
always_returned = never_returned;
|
||||||
|
never_returned = None;
|
||||||
|
|
||||||
|
i += 1;
|
||||||
|
if i == 10 {
|
||||||
|
break always_returned;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
fn main() {}
|
12
src/test/ui/consts/const-eval/livedrop.stderr
Normal file
12
src/test/ui/consts/const-eval/livedrop.stderr
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
error[E0493]: destructors cannot be evaluated at compile-time
|
||||||
|
--> $DIR/livedrop.rs:6:9
|
||||||
|
|
|
||||||
|
LL | let mut always_returned = None;
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^ constants cannot evaluate destructors
|
||||||
|
...
|
||||||
|
LL | always_returned = never_returned;
|
||||||
|
| --------------- value is dropped here
|
||||||
|
|
||||||
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
For more information about this error, try `rustc --explain E0493`.
|
@ -3,24 +3,36 @@ error[E0493]: destructors cannot be evaluated at compile-time
|
|||||||
|
|
|
|
||||||
LL | let x = Some(Vec::new());
|
LL | let x = Some(Vec::new());
|
||||||
| ^ constants cannot evaluate destructors
|
| ^ constants cannot evaluate destructors
|
||||||
|
...
|
||||||
|
LL | };
|
||||||
|
| - value is dropped here
|
||||||
|
|
||||||
error[E0493]: destructors cannot be evaluated at compile-time
|
error[E0493]: destructors cannot be evaluated at compile-time
|
||||||
--> $DIR/drop-fail.rs:23:9
|
--> $DIR/drop-fail.rs:23:9
|
||||||
|
|
|
|
||||||
LL | let vec_tuple = (Vec::new(),);
|
LL | let vec_tuple = (Vec::new(),);
|
||||||
| ^^^^^^^^^ constants cannot evaluate destructors
|
| ^^^^^^^^^ constants cannot evaluate destructors
|
||||||
|
...
|
||||||
|
LL | };
|
||||||
|
| - value is dropped here
|
||||||
|
|
||||||
error[E0493]: destructors cannot be evaluated at compile-time
|
error[E0493]: destructors cannot be evaluated at compile-time
|
||||||
--> $DIR/drop-fail.rs:31:9
|
--> $DIR/drop-fail.rs:31:9
|
||||||
|
|
|
|
||||||
LL | let x: Result<_, Vec<i32>> = Ok(Vec::new());
|
LL | let x: Result<_, Vec<i32>> = Ok(Vec::new());
|
||||||
| ^ constants cannot evaluate destructors
|
| ^ constants cannot evaluate destructors
|
||||||
|
...
|
||||||
|
LL | };
|
||||||
|
| - value is dropped here
|
||||||
|
|
||||||
error[E0493]: destructors cannot be evaluated at compile-time
|
error[E0493]: destructors cannot be evaluated at compile-time
|
||||||
--> $DIR/drop-fail.rs:41:9
|
--> $DIR/drop-fail.rs:41:9
|
||||||
|
|
|
|
||||||
LL | let mut tmp = None;
|
LL | let mut tmp = None;
|
||||||
| ^^^^^^^ constants cannot evaluate destructors
|
| ^^^^^^^ constants cannot evaluate destructors
|
||||||
|
...
|
||||||
|
LL | };
|
||||||
|
| - value is dropped here
|
||||||
|
|
||||||
error: aborting due to 4 previous errors
|
error: aborting due to 4 previous errors
|
||||||
|
|
||||||
|
@ -2,7 +2,9 @@ error[E0493]: destructors cannot be evaluated at compile-time
|
|||||||
--> $DIR/min_const_fn.rs:37:25
|
--> $DIR/min_const_fn.rs:37:25
|
||||||
|
|
|
|
||||||
LL | const fn into_inner(self) -> T { self.0 }
|
LL | const fn into_inner(self) -> T { self.0 }
|
||||||
| ^^^^ constant functions cannot evaluate destructors
|
| ^^^^ - value is dropped here
|
||||||
|
| |
|
||||||
|
| constant functions cannot evaluate destructors
|
||||||
|
|
||||||
error[E0723]: mutable references in const fn are unstable
|
error[E0723]: mutable references in const fn are unstable
|
||||||
--> $DIR/min_const_fn.rs:39:36
|
--> $DIR/min_const_fn.rs:39:36
|
||||||
@ -17,7 +19,9 @@ error[E0493]: destructors cannot be evaluated at compile-time
|
|||||||
--> $DIR/min_const_fn.rs:44:28
|
--> $DIR/min_const_fn.rs:44:28
|
||||||
|
|
|
|
||||||
LL | const fn into_inner_lt(self) -> T { self.0 }
|
LL | const fn into_inner_lt(self) -> T { self.0 }
|
||||||
| ^^^^ constant functions cannot evaluate destructors
|
| ^^^^ - value is dropped here
|
||||||
|
| |
|
||||||
|
| constant functions cannot evaluate destructors
|
||||||
|
|
||||||
error[E0723]: mutable references in const fn are unstable
|
error[E0723]: mutable references in const fn are unstable
|
||||||
--> $DIR/min_const_fn.rs:46:42
|
--> $DIR/min_const_fn.rs:46:42
|
||||||
@ -32,7 +36,9 @@ error[E0493]: destructors cannot be evaluated at compile-time
|
|||||||
--> $DIR/min_const_fn.rs:51:27
|
--> $DIR/min_const_fn.rs:51:27
|
||||||
|
|
|
|
||||||
LL | const fn into_inner_s(self) -> T { self.0 }
|
LL | const fn into_inner_s(self) -> T { self.0 }
|
||||||
| ^^^^ constant functions cannot evaluate destructors
|
| ^^^^ - value is dropped here
|
||||||
|
| |
|
||||||
|
| constant functions cannot evaluate destructors
|
||||||
|
|
||||||
error[E0723]: mutable references in const fn are unstable
|
error[E0723]: mutable references in const fn are unstable
|
||||||
--> $DIR/min_const_fn.rs:53:38
|
--> $DIR/min_const_fn.rs:53:38
|
||||||
|
@ -2,7 +2,9 @@ error[E0493]: destructors cannot be evaluated at compile-time
|
|||||||
--> $DIR/feature-gate-unleash_the_miri_inside_of_you.rs:11:20
|
--> $DIR/feature-gate-unleash_the_miri_inside_of_you.rs:11:20
|
||||||
|
|
|
|
||||||
LL | const F: u32 = (U::X, 42).1;
|
LL | const F: u32 = (U::X, 42).1;
|
||||||
| ^^^^^^^^^^ constants cannot evaluate destructors
|
| ^^^^^^^^^^ - value is dropped here
|
||||||
|
| |
|
||||||
|
| constants cannot evaluate destructors
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
@ -9,12 +9,18 @@ error[E0493]: destructors cannot be evaluated at compile-time
|
|||||||
|
|
|
|
||||||
LL | const fn unwrap_or_else<F: FnOnce() -> T>(self, f: F) -> T {
|
LL | const fn unwrap_or_else<F: FnOnce() -> T>(self, f: F) -> T {
|
||||||
| ^ constant functions cannot evaluate destructors
|
| ^ constant functions cannot evaluate destructors
|
||||||
|
...
|
||||||
|
LL | }
|
||||||
|
| - value is dropped here
|
||||||
|
|
||||||
error[E0493]: destructors cannot be evaluated at compile-time
|
error[E0493]: destructors cannot be evaluated at compile-time
|
||||||
--> $DIR/unstable-const-fn-in-libcore.rs:19:47
|
--> $DIR/unstable-const-fn-in-libcore.rs:19:47
|
||||||
|
|
|
|
||||||
LL | const fn unwrap_or_else<F: FnOnce() -> T>(self, f: F) -> T {
|
LL | const fn unwrap_or_else<F: FnOnce() -> T>(self, f: F) -> T {
|
||||||
| ^^^^ constant functions cannot evaluate destructors
|
| ^^^^ constant functions cannot evaluate destructors
|
||||||
|
...
|
||||||
|
LL | }
|
||||||
|
| - value is dropped here
|
||||||
|
|
||||||
error: aborting due to 3 previous errors
|
error: aborting due to 3 previous errors
|
||||||
|
|
||||||
|
@ -2,7 +2,9 @@ error[E0493]: destructors cannot be evaluated at compile-time
|
|||||||
--> $DIR/E0493.rs:17:17
|
--> $DIR/E0493.rs:17:17
|
||||||
|
|
|
|
||||||
LL | const F : Foo = (Foo { a : 0 }, Foo { a : 1 }).1;
|
LL | const F : Foo = (Foo { a : 0 }, Foo { a : 1 }).1;
|
||||||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ constants cannot evaluate destructors
|
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - value is dropped here
|
||||||
|
| |
|
||||||
|
| constants cannot evaluate destructors
|
||||||
|
|
||||||
error: aborting due to previous error
|
error: aborting due to previous error
|
||||||
|
|
||||||
|
@ -2,7 +2,9 @@ error[E0493]: destructors cannot be evaluated at compile-time
|
|||||||
--> $DIR/static-drop-scope.rs:9:60
|
--> $DIR/static-drop-scope.rs:9:60
|
||||||
|
|
|
|
||||||
LL | static PROMOTION_FAIL_S: Option<&'static WithDtor> = Some(&WithDtor);
|
LL | static PROMOTION_FAIL_S: Option<&'static WithDtor> = Some(&WithDtor);
|
||||||
| ^^^^^^^^ statics cannot evaluate destructors
|
| ^^^^^^^^- value is dropped here
|
||||||
|
| |
|
||||||
|
| statics cannot evaluate destructors
|
||||||
|
|
||||||
error[E0716]: temporary value dropped while borrowed
|
error[E0716]: temporary value dropped while borrowed
|
||||||
--> $DIR/static-drop-scope.rs:9:60
|
--> $DIR/static-drop-scope.rs:9:60
|
||||||
@ -18,7 +20,9 @@ error[E0493]: destructors cannot be evaluated at compile-time
|
|||||||
--> $DIR/static-drop-scope.rs:13:59
|
--> $DIR/static-drop-scope.rs:13:59
|
||||||
|
|
|
|
||||||
LL | const PROMOTION_FAIL_C: Option<&'static WithDtor> = Some(&WithDtor);
|
LL | const PROMOTION_FAIL_C: Option<&'static WithDtor> = Some(&WithDtor);
|
||||||
| ^^^^^^^^ constants cannot evaluate destructors
|
| ^^^^^^^^- value is dropped here
|
||||||
|
| |
|
||||||
|
| constants cannot evaluate destructors
|
||||||
|
|
||||||
error[E0716]: temporary value dropped while borrowed
|
error[E0716]: temporary value dropped while borrowed
|
||||||
--> $DIR/static-drop-scope.rs:13:59
|
--> $DIR/static-drop-scope.rs:13:59
|
||||||
@ -34,37 +38,50 @@ error[E0493]: destructors cannot be evaluated at compile-time
|
|||||||
--> $DIR/static-drop-scope.rs:17:28
|
--> $DIR/static-drop-scope.rs:17:28
|
||||||
|
|
|
|
||||||
LL | static EARLY_DROP_S: i32 = (WithDtor, 0).1;
|
LL | static EARLY_DROP_S: i32 = (WithDtor, 0).1;
|
||||||
| ^^^^^^^^^^^^^ statics cannot evaluate destructors
|
| ^^^^^^^^^^^^^ - value is dropped here
|
||||||
|
| |
|
||||||
|
| statics cannot evaluate destructors
|
||||||
|
|
||||||
error[E0493]: destructors cannot be evaluated at compile-time
|
error[E0493]: destructors cannot be evaluated at compile-time
|
||||||
--> $DIR/static-drop-scope.rs:20:27
|
--> $DIR/static-drop-scope.rs:20:27
|
||||||
|
|
|
|
||||||
LL | const EARLY_DROP_C: i32 = (WithDtor, 0).1;
|
LL | const EARLY_DROP_C: i32 = (WithDtor, 0).1;
|
||||||
| ^^^^^^^^^^^^^ constants cannot evaluate destructors
|
| ^^^^^^^^^^^^^ - value is dropped here
|
||||||
|
| |
|
||||||
|
| constants cannot evaluate destructors
|
||||||
|
|
||||||
error[E0493]: destructors cannot be evaluated at compile-time
|
error[E0493]: destructors cannot be evaluated at compile-time
|
||||||
--> $DIR/static-drop-scope.rs:23:24
|
--> $DIR/static-drop-scope.rs:23:24
|
||||||
|
|
|
|
||||||
LL | const fn const_drop<T>(_: T) {}
|
LL | const fn const_drop<T>(_: T) {}
|
||||||
| ^ constant functions cannot evaluate destructors
|
| ^ - value is dropped here
|
||||||
|
| |
|
||||||
|
| constant functions cannot evaluate destructors
|
||||||
|
|
||||||
error[E0493]: destructors cannot be evaluated at compile-time
|
error[E0493]: destructors cannot be evaluated at compile-time
|
||||||
--> $DIR/static-drop-scope.rs:27:5
|
--> $DIR/static-drop-scope.rs:27:5
|
||||||
|
|
|
|
||||||
LL | (x, ()).1
|
LL | (x, ()).1
|
||||||
| ^^^^^^^ constant functions cannot evaluate destructors
|
| ^^^^^^^ constant functions cannot evaluate destructors
|
||||||
|
LL |
|
||||||
|
LL | }
|
||||||
|
| - value is dropped here
|
||||||
|
|
||||||
error[E0493]: destructors cannot be evaluated at compile-time
|
error[E0493]: destructors cannot be evaluated at compile-time
|
||||||
--> $DIR/static-drop-scope.rs:31:34
|
--> $DIR/static-drop-scope.rs:31:34
|
||||||
|
|
|
|
||||||
LL | const EARLY_DROP_C_OPTION: i32 = (Some(WithDtor), 0).1;
|
LL | const EARLY_DROP_C_OPTION: i32 = (Some(WithDtor), 0).1;
|
||||||
| ^^^^^^^^^^^^^^^^^^^ constants cannot evaluate destructors
|
| ^^^^^^^^^^^^^^^^^^^ - value is dropped here
|
||||||
|
| |
|
||||||
|
| constants cannot evaluate destructors
|
||||||
|
|
||||||
error[E0493]: destructors cannot be evaluated at compile-time
|
error[E0493]: destructors cannot be evaluated at compile-time
|
||||||
--> $DIR/static-drop-scope.rs:36:43
|
--> $DIR/static-drop-scope.rs:36:43
|
||||||
|
|
|
|
||||||
LL | const EARLY_DROP_C_OPTION_CONSTANT: i32 = (HELPER, 0).1;
|
LL | const EARLY_DROP_C_OPTION_CONSTANT: i32 = (HELPER, 0).1;
|
||||||
| ^^^^^^^^^^^ constants cannot evaluate destructors
|
| ^^^^^^^^^^^ - value is dropped here
|
||||||
|
| |
|
||||||
|
| constants cannot evaluate destructors
|
||||||
|
|
||||||
error: aborting due to 10 previous errors
|
error: aborting due to 10 previous errors
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user