2018-08-30 07:18:55 -05:00
|
|
|
// run-pass
|
2014-07-30 19:47:54 -05:00
|
|
|
static mut DROP_RAN: bool = false;
|
|
|
|
|
2015-02-12 09:29:52 -06:00
|
|
|
trait Bar {
|
2014-07-30 19:47:54 -05:00
|
|
|
fn do_something(&mut self);
|
|
|
|
}
|
|
|
|
|
2015-02-12 09:29:52 -06:00
|
|
|
struct BarImpl;
|
2014-07-30 19:47:54 -05:00
|
|
|
|
2015-02-12 09:29:52 -06:00
|
|
|
impl Bar for BarImpl {
|
2014-07-30 19:47:54 -05:00
|
|
|
fn do_something(&mut self) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2022-07-25 15:36:03 -05:00
|
|
|
struct Foo<B: Bar>(#[allow(unused_tuple_struct_fields)] B);
|
2014-07-30 19:47:54 -05:00
|
|
|
|
2015-02-12 09:29:52 -06:00
|
|
|
impl<B: Bar> Drop for Foo<B> {
|
2014-07-30 19:47:54 -05:00
|
|
|
fn drop(&mut self) {
|
|
|
|
unsafe {
|
|
|
|
DROP_RAN = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
{
|
2015-02-12 09:29:52 -06:00
|
|
|
let _x: Foo<BarImpl> = Foo(BarImpl);
|
2014-07-30 19:47:54 -05:00
|
|
|
}
|
|
|
|
unsafe {
|
|
|
|
assert_eq!(DROP_RAN, true);
|
|
|
|
}
|
|
|
|
}
|