]> git.proxmox.com Git - rustc.git/blame - tests/ui/static/static-drop-scope.rs
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / 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);
2b03887a 8//~^ ERROR destructor of
48663c56 9//~| ERROR temporary value dropped while borrowed
ea8adc8c
XL
10
11const PROMOTION_FAIL_C: Option<&'static WithDtor> = Some(&WithDtor);
2b03887a 12//~^ ERROR destructor of
48663c56 13//~| ERROR temporary value dropped while borrowed
ea8adc8c
XL
14
15static EARLY_DROP_S: i32 = (WithDtor, 0).1;
2b03887a 16//~^ ERROR destructor of
ea8adc8c
XL
17
18const EARLY_DROP_C: i32 = (WithDtor, 0).1;
2b03887a 19//~^ ERROR destructor of
ea8adc8c 20
2c00a5a8 21const fn const_drop<T>(_: T) {}
2b03887a 22//~^ ERROR destructor of
2c00a5a8
XL
23
24const fn const_drop2<T>(x: T) {
25 (x, ()).1
2b03887a 26 //~^ ERROR destructor of
2c00a5a8
XL
27}
28
9fa01778 29const EARLY_DROP_C_OPTION: i32 = (Some(WithDtor), 0).1;
2b03887a 30//~^ ERROR destructor of
9fa01778
XL
31
32const HELPER: Option<WithDtor> = Some(WithDtor);
33
34const EARLY_DROP_C_OPTION_CONSTANT: i32 = (HELPER, 0).1;
2b03887a 35//~^ ERROR destructor of
9fa01778 36
ea8adc8c 37fn main () {}