Skip to content

Commit bc70836

Browse files
committed
make TrivialClone a #[marker]-trait to keep it from appearing in error messages
1 parent 3fc578b commit bc70836

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

core/src/clone.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,10 @@ pub const trait Clone: Sized {
275275
// its invariant holds whenever `Clone` is implemented, even if the actual
276276
// `TrivialClone` bound would not be satisfied because of lifetime bounds.
277277
#[rustc_unsafe_specialization_marker]
278+
// If `#[derive(Clone, Clone, Copy)]` is written, there will be multiple
279+
// implementations of `TrivialClone`. To keep it from appearing in error
280+
// messages, make it a `#[marker]` trait.
281+
#[marker]
278282
pub const unsafe trait TrivialClone: [const] Clone {}
279283

280284
/// Derive macro generating an impl of the trait `Clone`.

0 commit comments

Comments
 (0)