about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMatthias Krüger <matthias.krueger@famsik.de>2021-12-27 21:42:25 +0100
committerGitHub <noreply@github.com>2021-12-27 21:42:25 +0100
commitbd77fbfef1d7be3fd8d8db137b800476199fa11b (patch)
tree3316d110c63a53cbbfe0267126a3c74bdabbb43d /src
parentb57a6b38c5b3ac932cf5bc70558fc2b4d0792e91 (diff)
parent643484416b6f09cf40c7583b4259e685c1e30f03 (diff)
downloadrust-bd77fbfef1d7be3fd8d8db137b800476199fa11b.tar.gz
rust-bd77fbfef1d7be3fd8d8db137b800476199fa11b.zip
Rollup merge of #92112 - SparrowLii:issue92010, r=cjgillot
Fix the error of checking `base_expr` twice in type_changing_struct_update

Fixes #92010
Diffstat (limited to 'src')
-rw-r--r--src/test/ui/rfcs/rfc-2528-type-changing-struct-update/issue-92010-trait-bound-not-satisfied.rs12
-rw-r--r--src/test/ui/rfcs/rfc-2528-type-changing-struct-update/issue-92010-trait-bound-not-satisfied.stderr12
2 files changed, 24 insertions, 0 deletions
diff --git a/src/test/ui/rfcs/rfc-2528-type-changing-struct-update/issue-92010-trait-bound-not-satisfied.rs b/src/test/ui/rfcs/rfc-2528-type-changing-struct-update/issue-92010-trait-bound-not-satisfied.rs
new file mode 100644
index 00000000000..f1a54ee5867
--- /dev/null
+++ b/src/test/ui/rfcs/rfc-2528-type-changing-struct-update/issue-92010-trait-bound-not-satisfied.rs
@@ -0,0 +1,12 @@
+#[derive(Clone)]
+struct P<T> {
+    x: T,
+    y: f64,
+}
+
+impl<T> P<T> {
+    fn y(&self, y: f64) -> Self { P{y, .. self.clone() } }
+                                       //~^ mismatched types [E0308]
+}
+
+fn main() {}
diff --git a/src/test/ui/rfcs/rfc-2528-type-changing-struct-update/issue-92010-trait-bound-not-satisfied.stderr b/src/test/ui/rfcs/rfc-2528-type-changing-struct-update/issue-92010-trait-bound-not-satisfied.stderr
new file mode 100644
index 00000000000..5957ea7c9ef
--- /dev/null
+++ b/src/test/ui/rfcs/rfc-2528-type-changing-struct-update/issue-92010-trait-bound-not-satisfied.stderr
@@ -0,0 +1,12 @@
+error[E0308]: mismatched types
+  --> $DIR/issue-92010-trait-bound-not-satisfied.rs:8:43
+   |
+LL |     fn y(&self, y: f64) -> Self { P{y, .. self.clone() } }
+   |                                           ^^^^^^^^^^^^ expected struct `P`, found `&P<T>`
+   |
+   = note: expected struct `P<T>`
+           found reference `&P<T>`
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0308`.