2018-05-08 06:59:26 -05:00
|
|
|
fn main() {}
|
|
|
|
|
|
|
|
struct FakeNeedsDrop;
|
|
|
|
|
|
|
|
impl Drop for FakeNeedsDrop {
|
|
|
|
fn drop(&mut self) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ok
|
|
|
|
const X: FakeNeedsDrop = { let x = FakeNeedsDrop; x };
|
|
|
|
|
2019-07-01 12:06:30 -05:00
|
|
|
// ok (used to incorrectly error, see #62273)
|
|
|
|
const X2: FakeNeedsDrop = { let x; x = FakeNeedsDrop; x };
|
|
|
|
|
2018-05-08 06:59:26 -05:00
|
|
|
// error
|
|
|
|
const Y: FakeNeedsDrop = { let mut x = FakeNeedsDrop; x = FakeNeedsDrop; x };
|
2022-09-23 09:22:36 -05:00
|
|
|
//~^ ERROR destructor of
|
2019-07-01 12:06:30 -05:00
|
|
|
|
|
|
|
// error
|
|
|
|
const Y2: FakeNeedsDrop = { let mut x; x = FakeNeedsDrop; x = FakeNeedsDrop; x };
|
2022-09-23 09:22:36 -05:00
|
|
|
//~^ ERROR destructor of
|
2018-05-08 06:59:26 -05:00
|
|
|
|
|
|
|
// error
|
|
|
|
const Z: () = { let mut x = None; x = Some(FakeNeedsDrop); };
|
2022-09-23 09:22:36 -05:00
|
|
|
//~^ ERROR destructor of
|
2019-07-01 12:06:30 -05:00
|
|
|
|
|
|
|
// error
|
|
|
|
const Z2: () = { let mut x; x = None; x = Some(FakeNeedsDrop); };
|
2022-09-23 09:22:36 -05:00
|
|
|
//~^ ERROR destructor of
|