-
Notifications
You must be signed in to change notification settings - Fork 58
Open
Labels
Description
It seems that if I try to derive both Copy and Trace in a simple structure, I get this error:
The
Copytrait was implemented on a type with aDropimplementation.Erroneous code example:
#[derive(Copy)] struct Foo; // error! impl Drop for Foo { fn drop(&mut self) { } }Explicitly implementing both
DropandCopytrait on a type is currently
disallowed. This feature can make some sense in theory, but the current
implementation is incorrect and can lead to memory unsafety (see
issue #20126), so it has been disabled for now.
But from my understanding, a simple Copy structure such as:
#[derive(Debug, Clone, Copy, Trace)]
struct Sym(usize);should be easy to implement, and the Trace implementation could be empty, right? Is there a proper way to do this? It's currently blocking doing type-safe string interning in Boa.