about summary refs log tree commit diff
path: root/src/test/ui
diff options
context:
space:
mode:
authorEsteban Küber <esteban@kuber.com.ar>2020-09-22 19:25:27 -0700
committerEsteban Küber <esteban@kuber.com.ar>2020-10-09 14:44:24 -0700
commite89ce461d39686a899cd88e53dc13dcec9445c3f (patch)
tree1b1e2d6c999db64d9002d4d1f3d0db20ba8e0f40 /src/test/ui
parent5217007a2087d8364df8db91d503703c6b0be256 (diff)
Suggest removing bounds even when potential typo
Diffstat (limited to 'src/test/ui')
-rw-r--r--src/test/ui/traits/trait-bounds-not-on-struct.stderr18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/test/ui/traits/trait-bounds-not-on-struct.stderr b/src/test/ui/traits/trait-bounds-not-on-struct.stderr
index 526dac2db46..0f97e3bdf18 100644
--- a/src/test/ui/traits/trait-bounds-not-on-struct.stderr
+++ b/src/test/ui/traits/trait-bounds-not-on-struct.stderr
@@ -144,7 +144,23 @@ error[E0404]: expected trait, found struct `Traitor`
 LL | trait Trait {}
    | ----------- similarly named trait `Trait` defined here
 LL | fn g() -> Traitor + 'static {
-   |           ^^^^^^^ help: a trait with a similar name exists: `Trait`
+   |           ^^^^^^^ not a trait
+   |
+help: `+` is used to constrain a "trait object" type with lifetimes or auto-traits; structs and enums can't be bound in that way
+  --> $DIR/trait-bounds-not-on-struct.rs:35:21
+   |
+LL | fn g() -> Traitor + 'static {
+   |           -------   ^^^^^^^ ...because of this bound
+   |           |
+   |           expected this type to be a trait...
+help: if you meant to use a type and not a trait here, remove the bounds
+   |
+LL | fn g() -> Traitor {
+   |                 --
+help: a trait with a similar name exists
+   |
+LL | fn g() -> Trait + 'static {
+   |           ^^^^^
 
 error: aborting due to 11 previous errors