summaryrefslogtreecommitdiffstats
path: root/src/test/ui/deriving
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/ui/deriving')
-rw-r--r--src/test/ui/deriving/deriving-all-codegen.rs2
-rw-r--r--src/test/ui/deriving/deriving-all-codegen.stdout65
-rw-r--r--src/test/ui/deriving/issue-103157.rs12
-rw-r--r--src/test/ui/deriving/issue-103157.stderr30
-rw-r--r--src/test/ui/deriving/issue-89188-gat-hrtb.rs2
5 files changed, 49 insertions, 62 deletions
diff --git a/src/test/ui/deriving/deriving-all-codegen.rs b/src/test/ui/deriving/deriving-all-codegen.rs
index aef79ae8a..ba7809413 100644
--- a/src/test/ui/deriving/deriving-all-codegen.rs
+++ b/src/test/ui/deriving/deriving-all-codegen.rs
@@ -85,7 +85,7 @@ enum Mixed {
P,
Q,
R(u32),
- S { d1: u32, d2: u32 },
+ S { d1: Option<u32>, d2: Option<i32> },
}
// An enum with no fieldless variants. Note that `Default` cannot be derived
diff --git a/src/test/ui/deriving/deriving-all-codegen.stdout b/src/test/ui/deriving/deriving-all-codegen.stdout
index 21fe663f0..56efc2a59 100644
--- a/src/test/ui/deriving/deriving-all-codegen.stdout
+++ b/src/test/ui/deriving/deriving-all-codegen.stdout
@@ -122,10 +122,6 @@ impl ::core::cmp::PartialEq for Point {
fn eq(&self, other: &Point) -> bool {
self.x == other.x && self.y == other.y
}
- #[inline]
- fn ne(&self, other: &Point) -> bool {
- self.x != other.x || self.y != other.y
- }
}
impl ::core::marker::StructuralEq for Point {}
#[automatically_derived]
@@ -239,13 +235,6 @@ impl ::core::cmp::PartialEq for Big {
self.b6 == other.b6 && self.b7 == other.b7 &&
self.b8 == other.b8
}
- #[inline]
- fn ne(&self, other: &Big) -> bool {
- self.b1 != other.b1 || self.b2 != other.b2 || self.b3 != other.b3 ||
- self.b4 != other.b4 || self.b5 != other.b5 ||
- self.b6 != other.b6 || self.b7 != other.b7 ||
- self.b8 != other.b8
- }
}
impl ::core::marker::StructuralEq for Big {}
#[automatically_derived]
@@ -361,8 +350,6 @@ impl ::core::marker::StructuralPartialEq for Unsized {}
impl ::core::cmp::PartialEq for Unsized {
#[inline]
fn eq(&self, other: &Unsized) -> bool { self.0 == other.0 }
- #[inline]
- fn ne(&self, other: &Unsized) -> bool { self.0 != other.0 }
}
impl ::core::marker::StructuralEq for Unsized {}
#[automatically_derived]
@@ -428,8 +415,6 @@ impl ::core::marker::StructuralPartialEq for PackedCopy {}
impl ::core::cmp::PartialEq for PackedCopy {
#[inline]
fn eq(&self, other: &PackedCopy) -> bool { { self.0 } == { other.0 } }
- #[inline]
- fn ne(&self, other: &PackedCopy) -> bool { { self.0 } != { other.0 } }
}
impl ::core::marker::StructuralEq for PackedCopy {}
#[automatically_derived]
@@ -503,12 +488,6 @@ impl ::core::cmp::PartialEq for PackedNonCopy {
let Self(ref __self_1_0) = *other;
*__self_0_0 == *__self_1_0
}
- #[inline]
- fn ne(&self, other: &PackedNonCopy) -> bool {
- let Self(ref __self_0_0) = *self;
- let Self(ref __self_1_0) = *other;
- *__self_0_0 != *__self_1_0
- }
}
impl ::core::marker::StructuralEq for PackedNonCopy {}
#[automatically_derived]
@@ -638,13 +617,6 @@ impl ::core::cmp::PartialEq for Enum1 {
*__self_0 == *__arg1_0,
}
}
- #[inline]
- fn ne(&self, other: &Enum1) -> bool {
- match (self, other) {
- (Enum1::Single { x: __self_0 }, Enum1::Single { x: __arg1_0 }) =>
- *__self_0 != *__arg1_0,
- }
- }
}
impl ::core::marker::StructuralEq for Enum1 {}
#[automatically_derived]
@@ -817,8 +789,8 @@ enum Mixed {
Q,
R(u32),
S {
- d1: u32,
- d2: u32,
+ d1: Option<u32>,
+ d2: Option<i32>,
},
}
#[automatically_derived]
@@ -826,6 +798,8 @@ impl ::core::clone::Clone for Mixed {
#[inline]
fn clone(&self) -> Mixed {
let _: ::core::clone::AssertParamIsClone<u32>;
+ let _: ::core::clone::AssertParamIsClone<Option<u32>>;
+ let _: ::core::clone::AssertParamIsClone<Option<i32>>;
*self
}
}
@@ -883,20 +857,6 @@ impl ::core::cmp::PartialEq for Mixed {
_ => true,
}
}
- #[inline]
- fn ne(&self, other: &Mixed) -> bool {
- let __self_tag = ::core::intrinsics::discriminant_value(self);
- let __arg1_tag = ::core::intrinsics::discriminant_value(other);
- __self_tag != __arg1_tag ||
- match (self, other) {
- (Mixed::R(__self_0), Mixed::R(__arg1_0)) =>
- *__self_0 != *__arg1_0,
- (Mixed::S { d1: __self_0, d2: __self_1 }, Mixed::S {
- d1: __arg1_0, d2: __arg1_1 }) =>
- *__self_0 != *__arg1_0 || *__self_1 != *__arg1_1,
- _ => false,
- }
- }
}
impl ::core::marker::StructuralEq for Mixed {}
#[automatically_derived]
@@ -906,6 +866,8 @@ impl ::core::cmp::Eq for Mixed {
#[no_coverage]
fn assert_receiver_is_total_eq(&self) -> () {
let _: ::core::cmp::AssertParamIsEq<u32>;
+ let _: ::core::cmp::AssertParamIsEq<Option<u32>>;
+ let _: ::core::cmp::AssertParamIsEq<Option<i32>>;
}
}
#[automatically_derived]
@@ -1023,21 +985,6 @@ impl ::core::cmp::PartialEq for Fielded {
_ => unsafe { ::core::intrinsics::unreachable() }
}
}
- #[inline]
- fn ne(&self, other: &Fielded) -> bool {
- let __self_tag = ::core::intrinsics::discriminant_value(self);
- let __arg1_tag = ::core::intrinsics::discriminant_value(other);
- __self_tag != __arg1_tag ||
- match (self, other) {
- (Fielded::X(__self_0), Fielded::X(__arg1_0)) =>
- *__self_0 != *__arg1_0,
- (Fielded::Y(__self_0), Fielded::Y(__arg1_0)) =>
- *__self_0 != *__arg1_0,
- (Fielded::Z(__self_0), Fielded::Z(__arg1_0)) =>
- *__self_0 != *__arg1_0,
- _ => unsafe { ::core::intrinsics::unreachable() }
- }
- }
}
impl ::core::marker::StructuralEq for Fielded {}
#[automatically_derived]
diff --git a/src/test/ui/deriving/issue-103157.rs b/src/test/ui/deriving/issue-103157.rs
new file mode 100644
index 000000000..52b4c7898
--- /dev/null
+++ b/src/test/ui/deriving/issue-103157.rs
@@ -0,0 +1,12 @@
+// check-fail
+
+#[derive(PartialEq, Eq)]
+pub enum Value {
+ Boolean(Option<bool>),
+ Float(Option<f64>), //~ ERROR the trait bound `f64: Eq` is not satisfied
+}
+
+fn main() {
+ let a = Value::Float(Some(f64::NAN));
+ assert!(a == a);
+}
diff --git a/src/test/ui/deriving/issue-103157.stderr b/src/test/ui/deriving/issue-103157.stderr
new file mode 100644
index 000000000..ee3528fe1
--- /dev/null
+++ b/src/test/ui/deriving/issue-103157.stderr
@@ -0,0 +1,30 @@
+error[E0277]: the trait bound `f64: Eq` is not satisfied
+ --> $DIR/issue-103157.rs:6:11
+ |
+LL | #[derive(PartialEq, Eq)]
+ | -- in this derive macro expansion
+...
+LL | Float(Option<f64>),
+ | ^^^^^^^^^^^ the trait `Eq` is not implemented for `f64`
+ |
+ = help: the following other types implement trait `Eq`:
+ i128
+ i16
+ i32
+ i64
+ i8
+ isize
+ u128
+ u16
+ and 4 others
+ = note: required for `Option<f64>` to implement `Eq`
+note: required by a bound in `AssertParamIsEq`
+ --> $SRC_DIR/core/src/cmp.rs:LL:COL
+ |
+LL | pub struct AssertParamIsEq<T: Eq + ?Sized> {
+ | ^^ required by this bound in `AssertParamIsEq`
+ = note: this error originates in the derive macro `Eq` (in Nightly builds, run with -Z macro-backtrace for more info)
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0277`.
diff --git a/src/test/ui/deriving/issue-89188-gat-hrtb.rs b/src/test/ui/deriving/issue-89188-gat-hrtb.rs
index abd85a616..e8118f0c6 100644
--- a/src/test/ui/deriving/issue-89188-gat-hrtb.rs
+++ b/src/test/ui/deriving/issue-89188-gat-hrtb.rs
@@ -1,7 +1,5 @@
// check-pass
-#![feature(generic_associated_types)]
-
trait CallWithShim: Sized {
type Shim<'s>
where