Skip to content

Instantly share code, notes, and snippets.

@decatur
Created September 11, 2023 12:56
Show Gist options
  • Save decatur/5f4ab6a8ab3dd3a395df4b772f340f77 to your computer and use it in GitHub Desktop.
Save decatur/5f4ab6a8ab3dd3a395df4b772f340f77 to your computer and use it in GitHub Desktop.
trait is not object safe
#[derive(Clone)]
struct S;
fn main() {
let s
// Uncomment this line to provoke an "trait is not object safe" error
: Box<dyn Clone>
= Box::new(S);
let _ = s.clone();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment