blob: b2c1809867bb4ceded3d89bc2fd644b652b66c98 (
plain) (
tree)
|
|
//! Example of how `opaque!` prevents unsound `Drop`.
//!
//! NOTE: Also in trait `Opaque` documentation. Keep 'em in sync.
use std::cell::Cell;
use selfref::opaque;
struct Foo<'a> {
foo: Cell<Option<&'a Foo<'a>>>,
}
impl<'a> Drop for Foo<'a> {
fn drop(&mut self) {
}
}
struct FooKey;
opaque! {
impl Opaque for FooKey {
type Kind<'a> = Foo<'a>;
}
}
fn main() {
}
|