Add a compile-fail test for Drop
in constants in the presence of Option
s
This commit is contained in:
parent
efda6816bd
commit
506393eaaf
3 changed files with 34 additions and 2 deletions
|
@ -54,7 +54,19 @@ error[E0493]: destructors cannot be evaluated at compile-time
|
||||||
LL | (x, ()).1
|
LL | (x, ()).1
|
||||||
| ^^^^^^^ constant functions cannot evaluate destructors
|
| ^^^^^^^ constant functions cannot evaluate destructors
|
||||||
|
|
||||||
error: aborting due to 8 previous errors
|
error[E0493]: destructors cannot be evaluated at compile-time
|
||||||
|
--> $DIR/static-drop-scope.rs:31:34
|
||||||
|
|
|
||||||
|
LL | const EARLY_DROP_C_OPTION: i32 = (Some(WithDtor), 0).1;
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^ constants cannot evaluate destructors
|
||||||
|
|
||||||
|
error[E0493]: destructors cannot be evaluated at compile-time
|
||||||
|
--> $DIR/static-drop-scope.rs:36:43
|
||||||
|
|
|
||||||
|
LL | const EARLY_DROP_C_OPTION_CONSTANT: i32 = (HELPER, 0).1;
|
||||||
|
| ^^^^^^^^^^^ constants cannot evaluate destructors
|
||||||
|
|
||||||
|
error: aborting due to 10 previous errors
|
||||||
|
|
||||||
Some errors occurred: E0493, E0716.
|
Some errors occurred: E0493, E0716.
|
||||||
For more information about an error, try `rustc --explain E0493`.
|
For more information about an error, try `rustc --explain E0493`.
|
||||||
|
|
|
@ -28,4 +28,12 @@ const fn const_drop2<T>(x: T) {
|
||||||
//~^ ERROR destructors cannot be evaluated at compile-time
|
//~^ ERROR destructors cannot be evaluated at compile-time
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const EARLY_DROP_C_OPTION: i32 = (Some(WithDtor), 0).1;
|
||||||
|
//~^ ERROR destructors cannot be evaluated at compile-time
|
||||||
|
|
||||||
|
const HELPER: Option<WithDtor> = Some(WithDtor);
|
||||||
|
|
||||||
|
const EARLY_DROP_C_OPTION_CONSTANT: i32 = (HELPER, 0).1;
|
||||||
|
//~^ ERROR destructors cannot be evaluated at compile-time
|
||||||
|
|
||||||
fn main () {}
|
fn main () {}
|
||||||
|
|
|
@ -54,7 +54,19 @@ error[E0493]: destructors cannot be evaluated at compile-time
|
||||||
LL | (x, ()).1
|
LL | (x, ()).1
|
||||||
| ^^^^^^^ constant functions cannot evaluate destructors
|
| ^^^^^^^ constant functions cannot evaluate destructors
|
||||||
|
|
||||||
error: aborting due to 8 previous errors
|
error[E0493]: destructors cannot be evaluated at compile-time
|
||||||
|
--> $DIR/static-drop-scope.rs:31:34
|
||||||
|
|
|
||||||
|
LL | const EARLY_DROP_C_OPTION: i32 = (Some(WithDtor), 0).1;
|
||||||
|
| ^^^^^^^^^^^^^^^^^^^ constants cannot evaluate destructors
|
||||||
|
|
||||||
|
error[E0493]: destructors cannot be evaluated at compile-time
|
||||||
|
--> $DIR/static-drop-scope.rs:36:43
|
||||||
|
|
|
||||||
|
LL | const EARLY_DROP_C_OPTION_CONSTANT: i32 = (HELPER, 0).1;
|
||||||
|
| ^^^^^^^^^^^ constants cannot evaluate destructors
|
||||||
|
|
||||||
|
error: aborting due to 10 previous errors
|
||||||
|
|
||||||
Some errors occurred: E0493, E0597.
|
Some errors occurred: E0493, E0597.
|
||||||
For more information about an error, try `rustc --explain E0493`.
|
For more information about an error, try `rustc --explain E0493`.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue