|
| 1 | +error[E0226]: only a single explicit lifetime bound is permitted |
| 2 | + --> $DIR/trait-bounds-not-on-struct.rs:25:25 |
| 3 | + | |
| 4 | +LL | fn e() -> 'static + A + 'static { |
| 5 | + | ^^^^^^^ |
| 6 | + |
| 7 | +error[E0226]: only a single explicit lifetime bound is permitted |
| 8 | + --> $DIR/trait-bounds-not-on-struct.rs:29:53 |
| 9 | + | |
| 10 | +LL | fn f<'a,T,E>(iter: Iterator<Item='a + Result<T,E> + 'a>) { |
| 11 | + | ^^ |
| 12 | + |
1 | 13 | error[E0404]: expected trait, found struct `Foo`
|
2 |
| - --> $DIR/trait-bounds-not-on-struct.rs:5:16 |
| 14 | + --> $DIR/trait-bounds-not-on-struct.rs:8:16 |
3 | 15 | |
|
4 | 16 | LL | fn foo(_x: Box<Foo + Send>) { }
|
5 | 17 | | ^^^ not a trait
|
6 | 18 | |
|
7 |
| -help: `+` can be used to constrain a "trait object" type with lifetimes or auto-traits, structs and enums can't be bound in that way |
8 |
| - --> $DIR/trait-bounds-not-on-struct.rs:5:16 |
| 19 | +help: `+` is used to constrain a "trait object" type with lifetimes or auto-traits; structs and enums can't be bound in that way |
| 20 | + --> $DIR/trait-bounds-not-on-struct.rs:8:22 |
9 | 21 | |
|
10 | 22 | LL | fn foo(_x: Box<Foo + Send>) { }
|
11 |
| - | ^^^^^^^^^^ |
| 23 | + | --- ^^^^ ...because of this bound |
| 24 | + | | |
| 25 | + | expected this type to be a trait... |
12 | 26 |
|
13 | 27 | error[E0404]: expected trait, found struct `Vec`
|
14 |
| - --> $DIR/trait-bounds-not-on-struct.rs:7:21 |
| 28 | + --> $DIR/trait-bounds-not-on-struct.rs:10:29 |
| 29 | + | |
| 30 | +LL | type TypeAlias<T> = Box<dyn Vec<T>>; |
| 31 | + | ^^^^^^ not a trait |
| 32 | + |
| 33 | +error[E0404]: expected trait, found struct `A` |
| 34 | + --> $DIR/trait-bounds-not-on-struct.rs:13:11 |
| 35 | + | |
| 36 | +LL | fn a() -> A + 'static { |
| 37 | + | ^ not a trait |
| 38 | + | |
| 39 | +help: `+` is used to constrain a "trait object" type with lifetimes or auto-traits; structs and enums can't be bound in that way |
| 40 | + --> $DIR/trait-bounds-not-on-struct.rs:13:15 |
| 41 | + | |
| 42 | +LL | fn a() -> A + 'static { |
| 43 | + | - ^^^^^^^ ...because of this bound |
| 44 | + | | |
| 45 | + | expected this type to be a trait... |
| 46 | +help: if you meant to use a type and not a trait here, remove the bounds |
| 47 | + | |
| 48 | +LL | fn a() -> A { |
| 49 | + | -- |
| 50 | + |
| 51 | +error[E0404]: expected trait, found enum `Result` |
| 52 | + --> $DIR/trait-bounds-not-on-struct.rs:16:34 |
| 53 | + | |
| 54 | +LL | fn b<'a,T,E>(iter: Iterator<Item=Result<T,E> + 'a>) { |
| 55 | + | ^^^^^^^^^^^ not a trait |
| 56 | + | |
| 57 | +help: `+` is used to constrain a "trait object" type with lifetimes or auto-traits; structs and enums can't be bound in that way |
| 58 | + --> $DIR/trait-bounds-not-on-struct.rs:16:48 |
| 59 | + | |
| 60 | +LL | fn b<'a,T,E>(iter: Iterator<Item=Result<T,E> + 'a>) { |
| 61 | + | ----------- ^^ ...because of this bound |
| 62 | + | | |
| 63 | + | expected this type to be a trait... |
| 64 | +help: if you meant to use a type and not a trait here, remove the bounds |
| 65 | + | |
| 66 | +LL | fn b<'a,T,E>(iter: Iterator<Item=Result<T,E>>) { |
| 67 | + | -- |
| 68 | + |
| 69 | +error[E0404]: expected trait, found struct `A` |
| 70 | + --> $DIR/trait-bounds-not-on-struct.rs:19:21 |
| 71 | + | |
| 72 | +LL | fn c() -> 'static + A { |
| 73 | + | ^ not a trait |
| 74 | + | |
| 75 | +help: `+` is used to constrain a "trait object" type with lifetimes or auto-traits; structs and enums can't be bound in that way |
| 76 | + --> $DIR/trait-bounds-not-on-struct.rs:19:11 |
| 77 | + | |
| 78 | +LL | fn c() -> 'static + A { |
| 79 | + | ^^^^^^^ - expected this type to be a trait... |
| 80 | + | | |
| 81 | + | ...because of this bound |
| 82 | +help: if you meant to use a type and not a trait here, remove the bounds |
| 83 | + | |
| 84 | +LL | fn c() -> A { |
| 85 | + | -- |
| 86 | + |
| 87 | +error[E0404]: expected trait, found enum `Result` |
| 88 | + --> $DIR/trait-bounds-not-on-struct.rs:22:39 |
| 89 | + | |
| 90 | +LL | fn d<'a,T,E>(iter: Iterator<Item='a + Result<T,E>>) { |
| 91 | + | ^^^^^^^^^^^ not a trait |
| 92 | + | |
| 93 | +help: `+` is used to constrain a "trait object" type with lifetimes or auto-traits; structs and enums can't be bound in that way |
| 94 | + --> $DIR/trait-bounds-not-on-struct.rs:22:34 |
| 95 | + | |
| 96 | +LL | fn d<'a,T,E>(iter: Iterator<Item='a + Result<T,E>>) { |
| 97 | + | ^^ ----------- expected this type to be a trait... |
| 98 | + | | |
| 99 | + | ...because of this bound |
| 100 | +help: if you meant to use a type and not a trait here, remove the bounds |
| 101 | + | |
| 102 | +LL | fn d<'a,T,E>(iter: Iterator<Item=Result<T,E>>) { |
| 103 | + | -- |
| 104 | + |
| 105 | +error[E0404]: expected trait, found struct `A` |
| 106 | + --> $DIR/trait-bounds-not-on-struct.rs:25:21 |
| 107 | + | |
| 108 | +LL | fn e() -> 'static + A + 'static { |
| 109 | + | ^ not a trait |
| 110 | + | |
| 111 | +help: `+` is used to constrain a "trait object" type with lifetimes or auto-traits; structs and enums can't be bound in that way |
| 112 | + --> $DIR/trait-bounds-not-on-struct.rs:25:11 |
| 113 | + | |
| 114 | +LL | fn e() -> 'static + A + 'static { |
| 115 | + | ^^^^^^^ - ^^^^^^^ ...because of these bounds |
| 116 | + | | |
| 117 | + | expected this type to be a trait... |
| 118 | +help: if you meant to use a type and not a trait here, remove the bounds |
| 119 | + | |
| 120 | +LL | fn e() -> A { |
| 121 | + | --- |
| 122 | + |
| 123 | +error[E0404]: expected trait, found enum `Result` |
| 124 | + --> $DIR/trait-bounds-not-on-struct.rs:29:39 |
| 125 | + | |
| 126 | +LL | fn f<'a,T,E>(iter: Iterator<Item='a + Result<T,E> + 'a>) { |
| 127 | + | ^^^^^^^^^^^ not a trait |
| 128 | + | |
| 129 | +help: `+` is used to constrain a "trait object" type with lifetimes or auto-traits; structs and enums can't be bound in that way |
| 130 | + --> $DIR/trait-bounds-not-on-struct.rs:29:34 |
| 131 | + | |
| 132 | +LL | fn f<'a,T,E>(iter: Iterator<Item='a + Result<T,E> + 'a>) { |
| 133 | + | ^^ ----------- ^^ ...because of these bounds |
| 134 | + | | |
| 135 | + | expected this type to be a trait... |
| 136 | +help: if you meant to use a type and not a trait here, remove the bounds |
| 137 | + | |
| 138 | +LL | fn f<'a,T,E>(iter: Iterator<Item=Result<T,E>>) { |
| 139 | + | -- -- |
| 140 | + |
| 141 | +error[E0404]: expected trait, found struct `Traitor` |
| 142 | + --> $DIR/trait-bounds-not-on-struct.rs:35:11 |
15 | 143 | |
|
16 |
| -LL | type A<T> = Box<dyn Vec<T>>; |
17 |
| - | ^^^^^^ not a trait |
| 144 | +LL | trait Trait {} |
| 145 | + | ----------- similarly named trait `Trait` defined here |
| 146 | +LL | fn g() -> Traitor + 'static { |
| 147 | + | ^^^^^^^ help: a trait with a similar name exists: `Trait` |
18 | 148 |
|
19 |
| -error: aborting due to 2 previous errors |
| 149 | +error: aborting due to 11 previous errors |
20 | 150 |
|
21 |
| -For more information about this error, try `rustc --explain E0404`. |
| 151 | +Some errors have detailed explanations: E0226, E0404. |
| 152 | +For more information about an error, try `rustc --explain E0226`. |
0 commit comments