Skip to content

Commit e158c85

Browse files
authored
Rollup merge of #104339 - compiler-errors:rustc_deny_explicit_impl, r=cjgillot
Add `rustc_deny_explicit_impl` Also adjust `E0322` error message to be more general, since it's used for `DiscriminantKind` and `Pointee` as well. Also add `rustc_deny_explicit_impl` on the `Tuple` and `Destruct` marker traits.
2 parents 3b185d2 + 1df0769 commit e158c85

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

core/src/marker.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,7 @@ unsafe impl<T: Sync + ?Sized> Send for &T {}
9696
)]
9797
#[fundamental] // for Default, for example, which requires that `[T]: !Default` be evaluatable
9898
#[rustc_specialization_trait]
99+
#[cfg_attr(not(bootstrap), rustc_deny_explicit_impl)]
99100
pub trait Sized {
100101
// Empty.
101102
}
@@ -127,6 +128,7 @@ pub trait Sized {
127128
/// [nomicon-coerce]: ../../nomicon/coercions.html
128129
#[unstable(feature = "unsize", issue = "27732")]
129130
#[lang = "unsize"]
131+
#[cfg_attr(not(bootstrap), rustc_deny_explicit_impl)]
130132
pub trait Unsize<T: ?Sized> {
131133
// Empty.
132134
}
@@ -693,6 +695,7 @@ impl<T: ?Sized> StructuralEq for PhantomData<T> {}
693695
reason = "this trait is unlikely to ever be stabilized, use `mem::discriminant` instead"
694696
)]
695697
#[lang = "discriminant_kind"]
698+
#[cfg_attr(not(bootstrap), rustc_deny_explicit_impl)]
696699
pub trait DiscriminantKind {
697700
/// The type of the discriminant, which must satisfy the trait
698701
/// bounds required by `mem::Discriminant`.
@@ -793,6 +796,7 @@ impl<T: ?Sized> Unpin for *mut T {}
793796
#[lang = "destruct"]
794797
#[rustc_on_unimplemented(message = "can't drop `{Self}`", append_const_msg)]
795798
#[const_trait]
799+
#[cfg_attr(not(bootstrap), rustc_deny_explicit_impl)]
796800
pub trait Destruct {}
797801

798802
/// A marker for tuple types.
@@ -802,6 +806,7 @@ pub trait Destruct {}
802806
#[unstable(feature = "tuple_trait", issue = "none")]
803807
#[lang = "tuple_trait"]
804808
#[rustc_on_unimplemented(message = "`{Self}` is not a tuple")]
809+
#[cfg_attr(not(bootstrap), rustc_deny_explicit_impl)]
805810
pub trait Tuple {}
806811

807812
/// Implementations of `Copy` for primitive types.

core/src/ptr/metadata.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ use crate::hash::{Hash, Hasher};
5050
///
5151
/// [`to_raw_parts`]: *const::to_raw_parts
5252
#[lang = "pointee_trait"]
53+
#[cfg_attr(not(bootstrap), rustc_deny_explicit_impl)]
5354
pub trait Pointee {
5455
/// The type for metadata in pointers and references to `Self`.
5556
#[lang = "metadata_type"]

0 commit comments

Comments
 (0)