mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 15:23:46 +00:00
21 lines
277 B
Rust
21 lines
277 B
Rust
// run-pass
|
|
use std::rc::Rc;
|
|
|
|
struct Foo<'r>(&'r mut i32);
|
|
|
|
impl<'r> Drop for Foo<'r> {
|
|
fn drop(&mut self) {
|
|
*self.0 += 1;
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
let mut drops = 0;
|
|
|
|
{
|
|
let _: Rc<dyn Send> = Rc::new(Foo(&mut drops));
|
|
}
|
|
|
|
assert_eq!(1, drops);
|
|
}
|