Closed
Description
I was playing around with AtomicOption
and realized that it does not require the correct bound (which I believe should be Send
) for its type parameter. Thus, you can do this:
use std::sync::atomic::{AtomicOption, SeqCst};
struct Foo<'a> { foo: AtomicOption<&'a Foo<'a>>, id: Box<u8> }
fn main() {
let foo = Foo { foo: AtomicOption::empty(), id: box 10 };
foo.foo.fill(box &foo, SeqCst);
spawn(proc() {
let foo = foo;
println!("{}", foo.foo.take(SeqCst).unwrap().id);
});
}
Segmentation fault: 11