{
"$type": "site.standard.document",
"bskyPostRef": {
"cid": "bafyreigedwniyz3a4wjihyagujlpkm3uk6ehpgpgafebu2yzmoixkkq7ee",
"uri": "at://did:plc:ivbknywyskln22er3nkssdhl/app.bsky.feed.post/3mmyzon4mjmd2"
},
"path": "/t/warning-users-when-lacking-a-clone-impl-due-to-imperfect-derive/23635#post_4",
"publishedAt": "2026-05-29T16:36:29.000Z",
"site": "https://internals.rust-lang.org",
"textContent": "For reference, the current output is\n\n\n error[E0277]: the trait bound `Foo<DefaultNotClone>: Clone` is not satisfied\n --> src/main.rs:10:9\n |\n 10 | bar(Foo::<DefaultNotClone>::default());\n | --- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Clone` is not implemented for `Foo<DefaultNotClone>`\n | |\n | required by a bound introduced by this call\n |\n note: required for `Foo<DefaultNotClone>` to implement `Clone`\n --> src/main.rs:2:8\n |\n 1 | #[derive(Default, Clone)]\n | ----- in this derive macro expansion\n 2 | struct Foo<T>(std::marker::PhantomData<T>);\n | ^^^ - type parameter would need to implement `Clone`\n = help: consider manually implementing `Clone` to avoid undesired bounds\n note: required by a bound in `bar`\n --> src/main.rs:7:11\n |\n 7 | fn bar<T: Clone>(_: T) {}\n | ^^^^^ required by this bound in `bar`\n help: consider borrowing here\n |\n 10 | bar(&Foo::<DefaultNotClone>::default());\n | +\n",
"title": "Warning users when lacking a Clone impl due to imperfect derive"
}