rust/src/test/ui/traits/bound/not-on-struct.stderr

169 lines
6.2 KiB
Plaintext
Raw Normal View History

2020-09-22 21:19:33 -05:00
error[E0226]: only a single explicit lifetime bound is permitted
2021-02-08 16:15:45 -06:00
--> $DIR/not-on-struct.rs:25:25
2020-09-22 21:19:33 -05:00
|
LL | fn e() -> 'static + A + 'static {
| ^^^^^^^
error[E0226]: only a single explicit lifetime bound is permitted
2021-02-08 16:15:45 -06:00
--> $DIR/not-on-struct.rs:29:53
2020-09-22 21:19:33 -05:00
|
LL | fn f<'a,T,E>(iter: Iterator<Item='a + Result<T,E> + 'a>) {
| ^^
2018-08-08 07:28:26 -05:00
error[E0404]: expected trait, found struct `Foo`
2021-02-08 16:15:45 -06:00
--> $DIR/not-on-struct.rs:8:16
2018-08-08 07:28:26 -05:00
|
2019-03-09 06:03:44 -06:00
LL | fn foo(_x: Box<Foo + Send>) { }
2018-08-08 07:28:26 -05:00
| ^^^ not a trait
|
2020-09-22 21:19:33 -05:00
help: `+` is used to constrain a "trait object" type with lifetimes or auto-traits; structs and enums can't be bound in that way
2021-02-08 16:15:45 -06:00
--> $DIR/not-on-struct.rs:8:22
|
LL | fn foo(_x: Box<Foo + Send>) { }
2020-09-22 21:19:33 -05:00
| --- ^^^^ ...because of this bound
| |
| expected this type to be a trait...
2018-08-08 07:28:26 -05:00
error[E0404]: expected trait, found struct `Vec`
2021-02-08 16:15:45 -06:00
--> $DIR/not-on-struct.rs:10:29
2020-09-22 21:19:33 -05:00
|
LL | type TypeAlias<T> = Box<dyn Vec<T>>;
| ^^^^^^ not a trait
error[E0404]: expected trait, found struct `A`
2021-02-08 16:15:45 -06:00
--> $DIR/not-on-struct.rs:13:11
2020-09-22 21:19:33 -05:00
|
LL | fn a() -> A + 'static {
| ^ 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
2021-02-08 16:15:45 -06:00
--> $DIR/not-on-struct.rs:13:15
2020-09-22 21:19:33 -05:00
|
LL | fn a() -> A + '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 a() -> A {
| --
error[E0404]: expected trait, found enum `Result`
2021-02-08 16:15:45 -06:00
--> $DIR/not-on-struct.rs:16:34
2020-09-22 21:19:33 -05:00
|
LL | fn b<'a,T,E>(iter: Iterator<Item=Result<T,E> + 'a>) {
| ^^^^^^^^^^^ 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
2021-02-08 16:15:45 -06:00
--> $DIR/not-on-struct.rs:16:48
2020-09-22 21:19:33 -05:00
|
LL | fn b<'a,T,E>(iter: Iterator<Item=Result<T,E> + 'a>) {
| ----------- ^^ ...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 b<'a,T,E>(iter: Iterator<Item=Result<T,E>>) {
| --
error[E0404]: expected trait, found struct `A`
2021-02-08 16:15:45 -06:00
--> $DIR/not-on-struct.rs:19:21
2020-09-22 21:19:33 -05:00
|
LL | fn c() -> 'static + A {
| ^ 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
2021-02-08 16:15:45 -06:00
--> $DIR/not-on-struct.rs:19:11
2020-09-22 21:19:33 -05:00
|
LL | fn c() -> 'static + A {
| ^^^^^^^ - expected this type to be a trait...
| |
| ...because of this bound
help: if you meant to use a type and not a trait here, remove the bounds
|
LL | fn c() -> A {
| --
error[E0404]: expected trait, found enum `Result`
2021-02-08 16:15:45 -06:00
--> $DIR/not-on-struct.rs:22:39
2020-09-22 21:19:33 -05:00
|
LL | fn d<'a,T,E>(iter: Iterator<Item='a + Result<T,E>>) {
| ^^^^^^^^^^^ 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
2021-02-08 16:15:45 -06:00
--> $DIR/not-on-struct.rs:22:34
2020-09-22 21:19:33 -05:00
|
LL | fn d<'a,T,E>(iter: Iterator<Item='a + Result<T,E>>) {
| ^^ ----------- expected this type to be a trait...
| |
| ...because of this bound
help: if you meant to use a type and not a trait here, remove the bounds
|
LL | fn d<'a,T,E>(iter: Iterator<Item=Result<T,E>>) {
| --
error[E0404]: expected trait, found struct `A`
2021-02-08 16:15:45 -06:00
--> $DIR/not-on-struct.rs:25:21
2020-09-22 21:19:33 -05:00
|
LL | fn e() -> 'static + A + 'static {
| ^ 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
2021-02-08 16:15:45 -06:00
--> $DIR/not-on-struct.rs:25:11
2020-09-22 21:19:33 -05:00
|
LL | fn e() -> 'static + A + 'static {
| ^^^^^^^ - ^^^^^^^ ...because of these bounds
| |
| 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 e() -> A {
| ---
error[E0404]: expected trait, found enum `Result`
2021-02-08 16:15:45 -06:00
--> $DIR/not-on-struct.rs:29:39
2020-09-22 21:19:33 -05:00
|
LL | fn f<'a,T,E>(iter: Iterator<Item='a + Result<T,E> + 'a>) {
| ^^^^^^^^^^^ 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
2021-02-08 16:15:45 -06:00
--> $DIR/not-on-struct.rs:29:34
2020-09-22 21:19:33 -05:00
|
LL | fn f<'a,T,E>(iter: Iterator<Item='a + Result<T,E> + 'a>) {
| ^^ ----------- ^^ ...because of these bounds
| |
| 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 f<'a,T,E>(iter: Iterator<Item=Result<T,E>>) {
| -- --
error[E0404]: expected trait, found struct `Traitor`
2021-02-08 16:15:45 -06:00
--> $DIR/not-on-struct.rs:35:11
2018-08-08 07:28:26 -05:00
|
2020-09-22 21:19:33 -05:00
LL | trait Trait {}
| ----------- similarly named trait `Trait` defined here
LL | fn g() -> Traitor + 'static {
| ^^^^^^^ 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
2021-02-08 16:15:45 -06:00
--> $DIR/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 {
| ^^^^^
2018-08-08 07:28:26 -05:00
2020-09-22 21:19:33 -05:00
error: aborting due to 11 previous errors
2018-08-08 07:28:26 -05:00
2020-09-22 21:19:33 -05:00
Some errors have detailed explanations: E0226, E0404.
For more information about an error, try `rustc --explain E0226`.