Created
September 11, 2023 12:56
-
-
Save decatur/5f4ab6a8ab3dd3a395df4b772f340f77 to your computer and use it in GitHub Desktop.
trait is not object safe
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[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