about summary refs log tree commit diff
path: root/tests/ui/generic-const-items
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2024-10-24 22:16:43 +0000
committerEsteban Küber <esteban@kuber.com.ar>2024-11-02 03:08:04 +0000
commitb7fc1a743122e3c45f105a5d1169a042a2c6e8bf (patch)
tree1e26a4fee38823f1ba577c5aae2109643c955136 /tests/ui/generic-const-items
parent7c7bb7dc017545db732f5cffec684bbaeae0a9a0 (diff)
downloadrust-b7fc1a743122e3c45f105a5d1169a042a2c6e8bf.tar.gz
rust-b7fc1a743122e3c45f105a5d1169a042a2c6e8bf.zip
Add trait diff highlighting logic and use it in E0277
When a trait is not implemented for a type, but there *is* an `impl`
for another type or different trait params, we format the output to
use highlighting in the same way that E0308 does for types.

The logic accounts for 3 cases:
- When both the type and trait in the expected predicate and the candidate are different
- When only the types are different
- When only the trait generic params are different

For each case, we use slightly different formatting and wording.
Diffstat (limited to 'tests/ui/generic-const-items')
-rw-r--r--tests/ui/generic-const-items/unsatisfied-bounds.stderr6
1 files changed, 4 insertions, 2 deletions
diff --git a/tests/ui/generic-const-items/unsatisfied-bounds.stderr b/tests/ui/generic-const-items/unsatisfied-bounds.stderr
index 14894cef770..de252b816e5 100644
--- a/tests/ui/generic-const-items/unsatisfied-bounds.stderr
+++ b/tests/ui/generic-const-items/unsatisfied-bounds.stderr
@@ -16,7 +16,8 @@ error[E0277]: the trait bound `Infallible: From<()>` is not satisfied
 LL |     let () = K::<()>;
    |                  ^^ the trait `From<()>` is not implemented for `Infallible`
    |
-   = help: the trait `From<!>` is implemented for `Infallible`
+   = help: the trait `From<()>` is not implemented for `Infallible`
+           but trait `From<!>` is implemented for it
    = help: for that trait implementation, expected `!`, found `()`
 note: required by a bound in `K`
   --> $DIR/unsatisfied-bounds.rs:12:17
@@ -48,7 +49,8 @@ error[E0277]: the trait bound `Infallible: From<()>` is not satisfied
 LL |     let _ = <() as Trait<&'static str>>::B::<()>;
    |                                              ^^ the trait `From<()>` is not implemented for `Infallible`
    |
-   = help: the trait `From<!>` is implemented for `Infallible`
+   = help: the trait `From<()>` is not implemented for `Infallible`
+           but trait `From<!>` is implemented for it
    = help: for that trait implementation, expected `!`, found `()`
 note: required by a bound in `Trait::B`
   --> $DIR/unsatisfied-bounds.rs:21:21