about summary refs log tree commit diff
path: root/src/test/ui/destructuring-assignment
diff options
context:
space:
mode:
authorEsteban Kuber <esteban@kuber.com.ar>2021-09-28 14:48:54 +0000
committerEsteban Kuber <esteban@kuber.com.ar>2021-10-05 23:34:13 +0000
commite8fc076f231699d9a44fc44a1e298ea4f70fdb48 (patch)
treec4d83e0d4aa46d9c82d90f2cb50c98322ce5dafa /src/test/ui/destructuring-assignment
parent074f63648bd2368d5ca19aed02b5763a144e5d05 (diff)
downloadrust-e8fc076f231699d9a44fc44a1e298ea4f70fdb48.tar.gz
rust-e8fc076f231699d9a44fc44a1e298ea4f70fdb48.zip
Consider unfulfilled obligations in binop errors
When encountering a binop where the types would have been accepted, if
all the predicates had been fulfilled, include information about the
predicates and suggest appropriate `#[derive]`s if possible.

Point at trait(s) that needs to be `impl`emented.
Diffstat (limited to 'src/test/ui/destructuring-assignment')
-rw-r--r--src/test/ui/destructuring-assignment/note-unsupported.stderr17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/test/ui/destructuring-assignment/note-unsupported.stderr b/src/test/ui/destructuring-assignment/note-unsupported.stderr
index a81324b99e5..7b9788ca0fe 100644
--- a/src/test/ui/destructuring-assignment/note-unsupported.stderr
+++ b/src/test/ui/destructuring-assignment/note-unsupported.stderr
@@ -99,7 +99,22 @@ LL |     S { x: a, y: b } += s;
    |     |
    |     cannot use `+=` on type `S`
    |
-   = note: an implementation of `std::ops::AddAssign` might be missing for `S`
+note: an implementation of `AddAssign<_>` might be missing for `S`
+  --> $DIR/note-unsupported.rs:1:1
+   |
+LL | struct S { x: u8, y: u8 }
+   | ^^^^^^^^ must implement `AddAssign<_>`
+note: the following trait must be implemented
+  --> $SRC_DIR/core/src/ops/arith.rs:LL:COL
+   |
+LL | / pub trait AddAssign<Rhs = Self> {
+LL | |     /// Performs the `+=` operation.
+LL | |     ///
+LL | |     /// # Example
+...  |
+LL | |     fn add_assign(&mut self, rhs: Rhs);
+LL | | }
+   | |_^
 
 error[E0067]: invalid left-hand side of assignment
   --> $DIR/note-unsupported.rs:17:22