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 {
|
2024-02-07 02:42:01 +00:00
|
|
|
fn do_something(&mut self); //~ WARN method `do_something` is never used
|
2014-07-31 00:47:54 +00:00
|
|
|
}
|
|
|
|
|
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) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2023-12-27 22:11:58 +00:00
|
|
|
struct Foo<B: Bar>(#[allow(dead_code)] 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);
|
|
|
|
}
|
|
|
|
}
|