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