]> git.proxmox.com Git - rustc.git/blame - src/test/ui/static/static-drop-scope.rs
New upstream version 1.54.0+dfsg1
[rustc.git] / src / test / ui / static / static-drop-scope.rs
CommitLineData
ea8adc8c
XL
1struct WithDtor;
2
3impl Drop for WithDtor {
4 fn drop(&mut self) {}
5}
6
7static 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
11const 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
15static EARLY_DROP_S: i32 = (WithDtor, 0).1;
16//~^ ERROR destructors cannot be evaluated at compile-time
17
18const EARLY_DROP_C: i32 = (WithDtor, 0).1;
19//~^ ERROR destructors cannot be evaluated at compile-time
20
2c00a5a8
XL
21const fn const_drop<T>(_: T) {}
22//~^ ERROR destructors cannot be evaluated at compile-time
23
24const fn const_drop2<T>(x: T) {
25 (x, ()).1
26 //~^ ERROR destructors cannot be evaluated at compile-time
27}
28
9fa01778
XL
29const EARLY_DROP_C_OPTION: i32 = (Some(WithDtor), 0).1;
30//~^ ERROR destructors cannot be evaluated at compile-time
31
32const HELPER: Option<WithDtor> = Some(WithDtor);
33
34const EARLY_DROP_C_OPTION_CONSTANT: i32 = (HELPER, 0).1;
35//~^ ERROR destructors cannot be evaluated at compile-time
36
ea8adc8c 37fn main () {}