about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-01-26 00:17:00 +0000
committerbors <bors@rust-lang.org>2024-01-26 00:17:00 +0000
commitbb121d111d7be01461e7ae1bcf8a060afce0fa57 (patch)
treea957735a5aa36e8e52df7fc67a06c7f01de65706
parentd645e1638d876a5691897cf7d00eb1e0959650dd (diff)
parent215284a490a382cf9c1e2bde12484d7daa72e9aa (diff)
downloadrust-bb121d111d7be01461e7ae1bcf8a060afce0fa57.tar.gz
rust-bb121d111d7be01461e7ae1bcf8a060afce0fa57.zip
Auto merge of #116167 - RalfJung:structural-eq, r=lcnr
remove StructuralEq trait

The documentation given for the trait is outdated: *all* function pointers implement `PartialEq` and `Eq` these days. So the `StructuralEq` trait doesn't really seem to have any reason to exist any more.

One side-effect of this PR is that we allow matching on some consts that do not implement `Eq`. However, we already allowed matching on floats and consts containing floats, so this is not new, it is just allowed in more cases now. IMO it makes no sense at all to allow float matching but also sometimes require an `Eq` instance. If we want to require `Eq` we should adjust https://github.com/rust-lang/rust/pull/115893 to check for `Eq`, and rule out float matching for good.

Fixes https://github.com/rust-lang/rust/issues/115881
-rw-r--r--example/mini_core.rs3
-rw-r--r--tests/run/static.rs3
2 files changed, 0 insertions, 6 deletions
diff --git a/example/mini_core.rs b/example/mini_core.rs
index db94bc1c86a..230009741dc 100644
--- a/example/mini_core.rs
+++ b/example/mini_core.rs
@@ -100,9 +100,6 @@ unsafe impl<T: ?Sized> Freeze for &mut T {}
 #[lang = "structural_peq"]
 pub trait StructuralPartialEq {}
 
-#[lang = "structural_teq"]
-pub trait StructuralEq {}
-
 #[lang = "not"]
 pub trait Not {
     type Output;
diff --git a/tests/run/static.rs b/tests/run/static.rs
index 0b933754c29..e7c46ae3fcc 100644
--- a/tests/run/static.rs
+++ b/tests/run/static.rs
@@ -61,9 +61,6 @@ mod libc {
 #[lang = "structural_peq"]
 pub trait StructuralPartialEq {}
 
-#[lang = "structural_teq"]
-pub trait StructuralEq {}
-
 #[lang = "drop_in_place"]
 #[allow(unconditional_recursion)]
 pub unsafe fn drop_in_place<T: ?Sized>(to_drop: *mut T) {