Remove attribute #[structural_match] and any references to it

This commit is contained in:
Vadim Petrochenkov
2020-03-24 21:52:22 +03:00
parent 2dcf54f564
commit 7332305305
21 changed files with 43 additions and 48 deletions

View File

@@ -2,7 +2,7 @@
//~^ WARN the feature `const_generics` is incomplete and may cause the compiler to crash
// Currently, const parameters cannot depend on type parameters, because there is no way to
// enforce the `structural_match` property on an arbitrary type parameter. This restriction
// enforce the structural-match property on an arbitrary type parameter. This restriction
// may be relaxed in the future. See https://github.com/rust-lang/rfcs/pull/2000 for more
// details.

View File

@@ -1,6 +1,6 @@
// This is part of a set of tests exploring the different ways a
// `#[structural_match]` ADT might try to hold a
// non-`#[structural_match]` in hidden manner that lets matches
// structural-match ADT might try to hold a
// non-structural-match in hidden manner that lets matches
// through that we had intended to reject.
//
// See discussion on rust-lang/rust#62307 and rust-lang/rust#62339

View File

@@ -1,6 +1,6 @@
// This is part of a set of tests exploring the different ways a
// `#[structural_match]` ADT might try to hold a
// non-`#[structural_match]` in hidden manner that lets matches
// structural-match ADT might try to hold a
// non-structural-match in hidden manner that lets matches
// through that we had intended to reject.
//
// See discussion on rust-lang/rust#62307 and rust-lang/rust#62339

View File

@@ -1,6 +1,6 @@
// This is part of a set of tests exploring the different ways a
// `#[structural_match]` ADT might try to hold a
// non-`#[structural_match]` in hidden manner that lets matches
// structural-match ADT might try to hold a
// non-structural-match in hidden manner that lets matches
// through that we had intended to reject.
//
// See discussion on rust-lang/rust#62307 and rust-lang/rust#62339

View File

@@ -1,6 +1,6 @@
// This is part of a set of tests exploring the different ways a
// `#[structural_match]` ADT might try to hold a
// non-`#[structural_match]` in hidden manner that lets matches
// structural-match ADT might try to hold a
// non-structural-match in hidden manner that lets matches
// through that we had intended to reject.
//
// See discussion on rust-lang/rust#62307 and rust-lang/rust#62339

View File

@@ -1,6 +1,6 @@
// This is part of a set of tests exploring the different ways a
// `#[structural_match]` ADT might try to hold a
// non-`#[structural_match]` in hidden manner that lets matches
// structural-match ADT might try to hold a
// non-structural-match in hidden manner that lets matches
// through that we had intended to reject.
//
// See discussion on rust-lang/rust#62307 and rust-lang/rust#62339

View File

@@ -1,6 +1,6 @@
// This is part of a set of tests exploring the different ways a
// `#[structural_match]` ADT might try to hold a
// non-`#[structural_match]` in hidden manner that lets matches
// structural-match ADT might try to hold a
// non-structural-match in hidden manner that lets matches
// through that we had intended to reject.
//
// See discussion on rust-lang/rust#62307 and rust-lang/rust#62339

View File

@@ -1,4 +1,4 @@
// Test that structural match is only permitted with a feature gate,
// Test that use of structural-match traits is only permitted with a feature gate,
// and that if a feature gate is supplied, it permits the type to be
// used in a match.

View File

@@ -36,7 +36,7 @@ fn main() {
// a singleton type of the fn itself that the type inference would
// otherwise assign.
// Check that fn() is #[structural_match]
// Check that fn() is structural-match
const CFN1: Wrap<fn()> = Wrap(trivial);
let input: Wrap<fn()> = Wrap(trivial);
match Wrap(input) {
@@ -44,7 +44,7 @@ fn main() {
Wrap(_) => {}
};
// Check that fn(T) is #[structural_match] when T is too.
// Check that fn(T) is structural-match when T is too.
const CFN2: Wrap<fn(SM)> = Wrap(sm_to);
let input: Wrap<fn(SM)> = Wrap(sm_to);
match Wrap(input) {
@@ -52,7 +52,7 @@ fn main() {
Wrap(_) => {}
};
// Check that fn() -> T is #[structural_match] when T is too.
// Check that fn() -> T is structural-match when T is too.
const CFN3: Wrap<fn() -> SM> = Wrap(to_sm);
let input: Wrap<fn() -> SM> = Wrap(to_sm);
match Wrap(input) {
@@ -60,7 +60,7 @@ fn main() {
Wrap(_) => {}
};
// Check that fn(T) is #[structural_match] even if T is not.
// Check that fn(T) is structural-match even if T is not.
const CFN4: Wrap<fn(NotSM)> = Wrap(not_sm_to);
let input: Wrap<fn(NotSM)> = Wrap(not_sm_to);
match Wrap(input) {
@@ -68,7 +68,7 @@ fn main() {
Wrap(_) => {}
};
// Check that fn() -> T is #[structural_match] even if T is not.
// Check that fn() -> T is structural-match even if T is not.
const CFN5: Wrap<fn() -> NotSM> = Wrap(to_not_sm);
let input: Wrap<fn() -> NotSM> = Wrap(to_not_sm);
match Wrap(input) {
@@ -76,7 +76,7 @@ fn main() {
Wrap(_) => {}
};
// Check that fn(&T) is #[structural_match] when T is too.
// Check that fn(&T) is structural-match when T is too.
const CFN6: Wrap<fn(&SM)> = Wrap(r_sm_to);
let input: Wrap<fn(&SM)> = Wrap(r_sm_to);
match Wrap(input) {
@@ -84,7 +84,7 @@ fn main() {
Wrap(_) => {}
};
// Check that fn() -> &T is #[structural_match] when T is too.
// Check that fn() -> &T is structural-match when T is too.
const CFN7: Wrap<fn(&()) -> &SM> = Wrap(r_to_r_sm);
let input: Wrap<fn(&()) -> &SM> = Wrap(r_to_r_sm);
match Wrap(input) {
@@ -92,7 +92,7 @@ fn main() {
Wrap(_) => {}
};
// Check that fn(T) is #[structural_match] even if T is not.
// Check that fn(T) is structural-match even if T is not.
const CFN8: Wrap<fn(&NotSM)> = Wrap(r_not_sm_to);
let input: Wrap<fn(&NotSM)> = Wrap(r_not_sm_to);
match Wrap(input) {
@@ -100,7 +100,7 @@ fn main() {
Wrap(_) => {}
};
// Check that fn() -> T is #[structural_match] even if T is not.
// Check that fn() -> T is structural-match even if T is not.
const CFN9: Wrap<fn(&()) -> &NotSM> = Wrap(r_to_r_not_sm);
let input: Wrap<fn(&()) -> &NotSM> = Wrap(r_to_r_not_sm);
match Wrap(input) {
@@ -108,7 +108,7 @@ fn main() {
Wrap(_) => {}
};
// Check that a type which has fn ptrs is `#[structural_match]`.
// Check that a type which has fn ptrs is structural-match.
#[derive(PartialEq, Eq)]
struct Foo {
alpha: fn(NotSM),

View File

@@ -1,7 +1,7 @@
// Issue 61188 pointed out a case where we hit an ICE during code gen:
// the compiler assumed that `PartialEq` was always implemented on any
// use of a `const` item in a pattern context, but the pre-existing
// checking for the presence of `#[structural_match]` was too shallow
// structural-match checking was too shallow
// (see rust-lang/rust#62307), and so we hit cases where we were
// trying to dispatch to `PartialEq` on types that did not implement
// that trait.

View File

@@ -8,8 +8,8 @@
// resolve the question of what semantics is used for such matching.
// (See RFC 1445 for more details and discussion.)
// Issue 62307 pointed out a case where the checking for
// `#[structural_match]` was too shallow.
// Issue 62307 pointed out a case where the structural-match checking
// was too shallow.
#![warn(indirect_structural_match)]
// run-pass

View File

@@ -1,5 +1,5 @@
// Issue 62307 pointed out a case where the checking for
// `#[structural_match]` was too shallow.
// Issue 62307 pointed out a case where the structural-match checking
// was too shallow.
//
// Here we check similar behavior for non-empty arrays of types that
// do not derive `Eq`.

View File

@@ -14,25 +14,25 @@ fn main() {
#[derive(PartialEq, Eq)]
struct SM;
// Check that SM is #[structural_match]:
// Check that SM is structural-match:
const CSM: SM = SM;
match SM {
CSM => count += 1,
};
// Check that PhantomData<T> is #[structural_match] even if T is not.
// Check that PhantomData<T> is structural-match even if T is not.
const CPD1: PhantomData<NotSM> = PhantomData;
match PhantomData {
CPD1 => count += 1,
};
// Check that PhantomData<T> is #[structural_match] when T is.
// Check that PhantomData<T> is structural-match when T is.
const CPD2: PhantomData<SM> = PhantomData;
match PhantomData {
CPD2 => count += 1,
};
// Check that a type which has a PhantomData is `#[structural_match]`.
// Check that a type which has a PhantomData is structural-match.
#[derive(PartialEq, Eq, Default)]
struct Foo {
alpha: PhantomData<NotSM>,