about summary refs log tree commit diff
path: root/tests/ui/union
diff options
context:
space:
mode:
authorBoxy <rust@boxyuwu.dev>2025-01-22 06:40:43 +0000
committerBoxy <rust@boxyuwu.dev>2025-01-22 06:55:38 +0000
commit3ef506fb4dc9415620d4f09be022834d02201257 (patch)
treefe46995cf169ed1acd7399a70116daf1642a789b /tests/ui/union
parentc234b839d1681a7aa3abb1bda6f6f350714eacfe (diff)
downloadrust-3ef506fb4dc9415620d4f09be022834d02201257.tar.gz
rust-3ef506fb4dc9415620d4f09be022834d02201257.zip
Don't pick `T: FnPtr` nested goals
Diffstat (limited to 'tests/ui/union')
-rw-r--r--tests/ui/union/union-derive-eq.current.stderr (renamed from tests/ui/union/union-derive-eq.stderr)2
-rw-r--r--tests/ui/union/union-derive-eq.next.stderr19
-rw-r--r--tests/ui/union/union-derive-eq.rs16
3 files changed, 34 insertions, 3 deletions
diff --git a/tests/ui/union/union-derive-eq.stderr b/tests/ui/union/union-derive-eq.current.stderr
index b068edd6d69..151ceebe1ba 100644
--- a/tests/ui/union/union-derive-eq.stderr
+++ b/tests/ui/union/union-derive-eq.current.stderr
@@ -1,5 +1,5 @@
 error[E0277]: the trait bound `PartialEqNotEq: Eq` is not satisfied
-  --> $DIR/union-derive-eq.rs:13:5
+  --> $DIR/union-derive-eq.rs:21:5
    |
 LL | #[derive(Eq)]
    |          -- in this derive macro expansion
diff --git a/tests/ui/union/union-derive-eq.next.stderr b/tests/ui/union/union-derive-eq.next.stderr
new file mode 100644
index 00000000000..3952b1f1284
--- /dev/null
+++ b/tests/ui/union/union-derive-eq.next.stderr
@@ -0,0 +1,19 @@
+error[E0277]: the trait bound `PartialEqNotEq: Eq` is not satisfied
+  --> $DIR/union-derive-eq.rs:21:5
+   |
+LL | #[derive(Eq)]
+   |          -- in this derive macro expansion
+LL | union U2 {
+LL |     a: PartialEqNotEq,
+   |     ^^^^^^^^^^^^^^^^^ the trait `Eq` is not implemented for `PartialEqNotEq`
+   |
+   = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
+help: consider annotating `PartialEqNotEq` with `#[derive(Eq)]`
+   |
+LL + #[derive(Eq)]
+LL | struct PartialEqNotEq;
+   |
+
+error: aborting due to 1 previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/tests/ui/union/union-derive-eq.rs b/tests/ui/union/union-derive-eq.rs
index e689f8c27d7..085262a72a1 100644
--- a/tests/ui/union/union-derive-eq.rs
+++ b/tests/ui/union/union-derive-eq.rs
@@ -1,9 +1,17 @@
+//@ revisions: current next
+//@[next] compile-flags: -Znext-solver
+//@ ignore-compare-mode-next-solver (explicit revisions)
+
 #[derive(Eq)] // OK
 union U1 {
     a: u8,
 }
 
-impl PartialEq for U1 { fn eq(&self, rhs: &Self) -> bool { true } }
+impl PartialEq for U1 {
+    fn eq(&self, rhs: &Self) -> bool {
+        true
+    }
+}
 
 #[derive(PartialEq, Copy, Clone)]
 struct PartialEqNotEq;
@@ -13,6 +21,10 @@ union U2 {
     a: PartialEqNotEq, //~ ERROR the trait bound `PartialEqNotEq: Eq` is not satisfied
 }
 
-impl PartialEq for U2 { fn eq(&self, rhs: &Self) -> bool { true } }
+impl PartialEq for U2 {
+    fn eq(&self, rhs: &Self) -> bool {
+        true
+    }
+}
 
 fn main() {}