]>
Commit | Line | Data |
---|---|---|
ea8adc8c XL |
1 | struct WithDtor; |
2 | ||
3 | impl Drop for WithDtor { | |
4 | fn drop(&mut self) {} | |
5 | } | |
6 | ||
7 | static PROMOTION_FAIL_S: Option<&'static WithDtor> = Some(&WithDtor); | |
8 | //~^ ERROR destructors cannot be evaluated at compile-time | |
48663c56 | 9 | //~| ERROR temporary value dropped while borrowed |
ea8adc8c XL |
10 | |
11 | const PROMOTION_FAIL_C: Option<&'static WithDtor> = Some(&WithDtor); | |
12 | //~^ ERROR destructors cannot be evaluated at compile-time | |
48663c56 | 13 | //~| ERROR temporary value dropped while borrowed |
ea8adc8c XL |
14 | |
15 | static EARLY_DROP_S: i32 = (WithDtor, 0).1; | |
16 | //~^ ERROR destructors cannot be evaluated at compile-time | |
17 | ||
18 | const EARLY_DROP_C: i32 = (WithDtor, 0).1; | |
19 | //~^ ERROR destructors cannot be evaluated at compile-time | |
20 | ||
2c00a5a8 XL |
21 | const fn const_drop<T>(_: T) {} |
22 | //~^ ERROR destructors cannot be evaluated at compile-time | |
23 | ||
24 | const fn const_drop2<T>(x: T) { | |
25 | (x, ()).1 | |
26 | //~^ ERROR destructors cannot be evaluated at compile-time | |
27 | } | |
28 | ||
9fa01778 XL |
29 | const EARLY_DROP_C_OPTION: i32 = (Some(WithDtor), 0).1; |
30 | //~^ ERROR destructors cannot be evaluated at compile-time | |
31 | ||
32 | const HELPER: Option<WithDtor> = Some(WithDtor); | |
33 | ||
34 | const EARLY_DROP_C_OPTION_CONSTANT: i32 = (HELPER, 0).1; | |
35 | //~^ ERROR destructors cannot be evaluated at compile-time | |
36 | ||
ea8adc8c | 37 | fn main () {} |