Closed
Description
struct Foo<'a> { foo: &'a u8 }
impl<'a> Drop for Foo<'a> {
fn drop(&mut self) {
}
}
This gives a very surprising error:
cannot implement a destructor on a structure that does not satisfy Send
use "#[unsafe_destructor]" on the implementation to force the compiler to allow this
The problem is not really about ability to send between tasks — a destructor on a structure that can't be shared should be even safer than a destructor on a shared structure, so the message is confusing/misleading.
I've been told that Send is used to declare that the object has no cycles, but this seems like a hack/wart in the language:
- I would expect the compiler to be able to detect that cycles are impossible in trivial cases like this
- "Send" is a poor name for "guaranteed not to have reference cycles".
Metadata
Metadata
Assignees
Labels
No labels