2017-07-22 07:18:52 -05:00
|
|
|
struct WithDtor;
|
|
|
|
|
|
|
|
impl Drop for WithDtor {
|
|
|
|
fn drop(&mut self) {}
|
|
|
|
}
|
|
|
|
|
2017-08-31 04:21:11 -05:00
|
|
|
static PROMOTION_FAIL_S: Option<&'static WithDtor> = Some(&WithDtor);
|
2022-09-23 09:22:36 -05:00
|
|
|
//~^ ERROR destructor of
|
2019-04-22 02:40:08 -05:00
|
|
|
//~| ERROR temporary value dropped while borrowed
|
2017-07-22 07:18:52 -05:00
|
|
|
|
2017-08-31 04:21:11 -05:00
|
|
|
const PROMOTION_FAIL_C: Option<&'static WithDtor> = Some(&WithDtor);
|
2022-09-23 09:22:36 -05:00
|
|
|
//~^ ERROR destructor of
|
2019-04-22 02:40:08 -05:00
|
|
|
//~| ERROR temporary value dropped while borrowed
|
2017-08-31 04:21:11 -05:00
|
|
|
|
|
|
|
static EARLY_DROP_S: i32 = (WithDtor, 0).1;
|
2022-09-23 09:22:36 -05:00
|
|
|
//~^ ERROR destructor of
|
2017-07-22 07:18:52 -05:00
|
|
|
|
2017-08-31 04:21:11 -05:00
|
|
|
const EARLY_DROP_C: i32 = (WithDtor, 0).1;
|
2022-09-23 09:22:36 -05:00
|
|
|
//~^ ERROR destructor of
|
2017-08-31 04:21:11 -05:00
|
|
|
|
2018-01-09 20:57:50 -06:00
|
|
|
const fn const_drop<T>(_: T) {}
|
2022-09-23 09:22:36 -05:00
|
|
|
//~^ ERROR destructor of
|
2018-01-09 20:57:50 -06:00
|
|
|
|
|
|
|
const fn const_drop2<T>(x: T) {
|
|
|
|
(x, ()).1
|
2022-09-23 09:22:36 -05:00
|
|
|
//~^ ERROR destructor of
|
2018-01-09 20:57:50 -06:00
|
|
|
}
|
|
|
|
|
2019-01-23 09:21:33 -06:00
|
|
|
const EARLY_DROP_C_OPTION: i32 = (Some(WithDtor), 0).1;
|
2022-09-23 09:22:36 -05:00
|
|
|
//~^ ERROR destructor of
|
2019-01-23 09:21:33 -06:00
|
|
|
|
|
|
|
const HELPER: Option<WithDtor> = Some(WithDtor);
|
|
|
|
|
|
|
|
const EARLY_DROP_C_OPTION_CONSTANT: i32 = (HELPER, 0).1;
|
2022-09-23 09:22:36 -05:00
|
|
|
//~^ ERROR destructor of
|
2019-01-23 09:21:33 -06:00
|
|
|
|
2017-07-22 07:18:52 -05:00
|
|
|
fn main () {}
|