Skip to content

Commit 8045865

Browse files
committed
Auto merge of #70370 - petrochenkov:nosmatch, r=Centril
Remove attribute `#[structural_match]` and any references to it A small remaining part of #63438.
2 parents 150322f + 7332305 commit 8045865

21 files changed

+43
-48
lines changed

src/libcore/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@
134134
#![feature(f16c_target_feature)]
135135
#![feature(hexagon_target_feature)]
136136
#![feature(const_transmute)]
137-
#![feature(structural_match)]
138137
#![feature(abi_unadjusted)]
139138
#![feature(adx_target_feature)]
140139
#![feature(maybe_uninit_slice)]

src/libcore/marker.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -660,7 +660,6 @@ macro_rules! impls {
660660
///
661661
/// [drop check]: ../../nomicon/dropck.html
662662
#[lang = "phantom_data"]
663-
#[structural_match]
664663
#[stable(feature = "rust1", since = "1.0.0")]
665664
pub struct PhantomData<T: ?Sized>;
666665

src/librustc/ty/relate.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ pub fn super_relate_consts<R: TypeRelation<'tcx>>(
518518

519519
// Currently, the values that can be unified are primitive types,
520520
// and those that derive both `PartialEq` and `Eq`, corresponding
521-
// to `structural_match` types.
521+
// to structural-match types.
522522
let new_const_val = match (eagerly_eval(a), eagerly_eval(b)) {
523523
(ty::ConstKind::Infer(_), _) | (_, ty::ConstKind::Infer(_)) => {
524524
// The caller should handle these cases!

src/librustc_error_codes/error_codes/E0741.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Only `structural_match` types (that is, types that derive `PartialEq` and `Eq`)
1+
Only structural-match types (that is, types that derive `PartialEq` and `Eq`)
22
may be used as the types of const generic parameters.
33

44
```compile_fail,E0741

src/librustc_feature/active.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,8 @@ declare_features! (
173173
// no-tracking-issue-end
174174

175175
/// Allows using `#[structural_match]` which indicates that a type is structurally matchable.
176+
/// FIXME: Subsumed by trait `StructuralPartialEq`, cannot move to removed until a library
177+
/// feature with the same name exists.
176178
(active, structural_match, "1.8.0", Some(31434), None),
177179

178180
/// Allows using the `may_dangle` attribute (RFC 1327).

src/librustc_feature/builtin_attrs.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -376,11 +376,6 @@ pub const BUILTIN_ATTRIBUTES: &[BuiltinAttribute] = &[
376376
// ==========================================================================
377377

378378
gated!(fundamental, Whitelisted, template!(Word), experimental!(fundamental)),
379-
gated!(
380-
// RFC #1445.
381-
structural_match, Whitelisted, template!(Word),
382-
"the semantics of constant patterns is not yet settled",
383-
),
384379
gated!(
385380
may_dangle, Normal, template!(Word), dropck_eyepatch,
386381
"`may_dangle` has unstable semantics and may be removed in the future",

src/librustc_session/lint/builtin.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,7 +452,7 @@ declare_lint! {
452452
pub INDIRECT_STRUCTURAL_MATCH,
453453
// defaulting to allow until rust-lang/rust#62614 is fixed.
454454
Allow,
455-
"pattern with const indirectly referencing non-`#[structural_match]` type",
455+
"pattern with const indirectly referencing non-structural-match type",
456456
@future_incompatible = FutureIncompatibleInfo {
457457
reference: "issue #62411 <https://github.com/rust-lang/rust/issues/62411>",
458458
edition: None,

src/librustc_trait_selection/traits/structural_match.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ pub enum NonStructuralMatchTy<'tcx> {
1414
}
1515

1616
/// This method traverses the structure of `ty`, trying to find an
17-
/// instance of an ADT (i.e. struct or enum) that was declared without
18-
/// the `#[structural_match]` attribute, or a generic type parameter
19-
/// (which cannot be determined to be `structural_match`).
17+
/// instance of an ADT (i.e. struct or enum) that doesn't implement
18+
/// the structural-match traits, or a generic type parameter
19+
/// (which cannot be determined to be structural-match).
2020
///
2121
/// The "structure of a type" includes all components that would be
2222
/// considered when doing a pattern match on a constant of that
@@ -30,8 +30,8 @@ pub enum NonStructuralMatchTy<'tcx> {
3030
/// instantiated generic like `PhantomData<T>`.
3131
///
3232
/// The reason we do this search is Rust currently require all ADTs
33-
/// reachable from a constant's type to be annotated with
34-
/// `#[structural_match]`, an attribute which essentially says that
33+
/// reachable from a constant's type to implement the
34+
/// structural-match traits, which essentially say that
3535
/// the implementation of `PartialEq::eq` behaves *equivalently* to a
3636
/// comparison against the unfolded structure.
3737
///

src/test/ui/const-generics/const-param-type-depends-on-type-param.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
33

44
// Currently, const parameters cannot depend on type parameters, because there is no way to
5-
// enforce the `structural_match` property on an arbitrary type parameter. This restriction
5+
// enforce the structural-match property on an arbitrary type parameter. This restriction
66
// may be relaxed in the future. See https://github.com/rust-lang/rfcs/pull/2000 for more
77
// details.
88

src/test/ui/rfc1445/cant-hide-behind-direct-struct-embedded.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// This is part of a set of tests exploring the different ways a
2-
// `#[structural_match]` ADT might try to hold a
3-
// non-`#[structural_match]` in hidden manner that lets matches
2+
// structural-match ADT might try to hold a
3+
// non-structural-match in hidden manner that lets matches
44
// through that we had intended to reject.
55
//
66
// See discussion on rust-lang/rust#62307 and rust-lang/rust#62339

0 commit comments

Comments
 (0)