diff options
| author | Michael Goulet <michael@errs.io> | 2023-11-27 16:25:36 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2023-11-28 21:17:19 +0000 |
| commit | 89c2c85fe16c8b0551592f3e4d9acc2396087b42 (patch) | |
| tree | 40205ceb6aa4845e08cc15f4a0c5f0031abdd767 | |
| parent | 82a9e872d8cb9333a0f9b3f8d89ea0deaf7233b9 (diff) | |
| download | rust-89c2c85fe16c8b0551592f3e4d9acc2396087b42.tar.gz rust-89c2c85fe16c8b0551592f3e4d9acc2396087b42.zip | |
Add PartialEq<&B> for &A
| -rw-r--r-- | tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.rs | 9 | ||||
| -rw-r--r-- | tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.stderr | 47 |
2 files changed, 12 insertions, 44 deletions
diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.rs b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.rs index d79cf372b87..007d681f3eb 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.rs +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.rs @@ -344,6 +344,15 @@ trait PartialEq<Rhs: ?Sized = Self> { } } +impl<A: ?Sized, B: ?Sized> PartialEq<&B> for &A +where + A: PartialEq<B>, +{ + fn eq(&self, other: &&B) -> bool { + PartialEq::eq(*self, *other) + } +} + // FIXME(effects): again, this should not error without Rhs specified impl PartialEq<str> for str { fn eq(&self, other: &str) -> bool { diff --git a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.stderr b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.stderr index 19e6f6bffc6..461133e6c3e 100644 --- a/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.stderr +++ b/tests/ui/rfcs/rfc-2632-const-trait-impl/effects/minicore.stderr @@ -1,24 +1,5 @@ -warning: to use a constant of type `&str` in a pattern, the type must implement `PartialEq` - --> $DIR/minicore.rs:332:9 - | -LL | "true" => Ok(true), - | ^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #116122 <https://github.com/rust-lang/rust/issues/116122> - = note: `#[warn(const_patterns_without_partial_eq)]` on by default - -warning: to use a constant of type `&str` in a pattern, the type must implement `PartialEq` - --> $DIR/minicore.rs:333:9 - | -LL | "false" => Ok(false), - | ^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #116122 <https://github.com/rust-lang/rust/issues/116122> - error[E0493]: destructor of `Self` cannot be evaluated at compile-time - --> $DIR/minicore.rs:494:9 + --> $DIR/minicore.rs:503:9 | LL | *self = source.clone() | ^^^^^ @@ -27,35 +8,13 @@ LL | *self = source.clone() | value is dropped here error[E0493]: destructor of `T` cannot be evaluated at compile-time - --> $DIR/minicore.rs:504:35 + --> $DIR/minicore.rs:513:35 | LL | const fn drop<T: ~const Destruct>(_: T) {} | ^ - value is dropped here | | | the destructor for this type cannot be evaluated in constant functions -error: aborting due to 2 previous errors; 2 warnings emitted +error: aborting due to 2 previous errors For more information about this error, try `rustc --explain E0493`. -Future incompatibility report: Future breakage diagnostic: -warning: to use a constant of type `&str` in a pattern, the type must implement `PartialEq` - --> $DIR/minicore.rs:332:9 - | -LL | "true" => Ok(true), - | ^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #116122 <https://github.com/rust-lang/rust/issues/116122> - = note: `#[warn(const_patterns_without_partial_eq)]` on by default - -Future breakage diagnostic: -warning: to use a constant of type `&str` in a pattern, the type must implement `PartialEq` - --> $DIR/minicore.rs:333:9 - | -LL | "false" => Ok(false), - | ^^^^^^^ - | - = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release! - = note: for more information, see issue #116122 <https://github.com/rust-lang/rust/issues/116122> - = note: `#[warn(const_patterns_without_partial_eq)]` on by default - |
