about summary refs log tree commit diff
path: root/src/test/ui/span
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/span
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/span')
-rw-r--r--src/test/ui/span/issue-39018.stderr17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/test/ui/span/issue-39018.stderr b/src/test/ui/span/issue-39018.stderr
index c5a0448e798..92e86bf5d6c 100644
--- a/src/test/ui/span/issue-39018.stderr
+++ b/src/test/ui/span/issue-39018.stderr
@@ -20,7 +20,22 @@ LL |     let y = World::Hello + World::Goodbye;
    |             |
    |             World
    |
-   = note: an implementation of `std::ops::Add` might be missing for `World`
+note: an implementation of `Add<_>` might be missing for `World`
+  --> $DIR/issue-39018.rs:15:1
+   |
+LL | enum World {
+   | ^^^^^^^^^^ must implement `Add<_>`
+note: the following trait must be implemented
+  --> $SRC_DIR/core/src/ops/arith.rs:LL:COL
+   |
+LL | / pub trait Add<Rhs = Self> {
+LL | |     /// The resulting type after applying the `+` operator.
+LL | |     #[stable(feature = "rust1", since = "1.0.0")]
+LL | |     type Output;
+...  |
+LL | |     fn add(self, rhs: Rhs) -> Self::Output;
+LL | | }
+   | |_^
 
 error[E0369]: cannot add `String` to `&str`
   --> $DIR/issue-39018.rs:11:22