|
| 1 | +error[E0404]: expected trait, found builtin type `usize` |
| 2 | + --> $DIR/suggestion-trait-object-issue-139174.rs:3:36 |
| 3 | + | |
| 4 | +LL | fn f<'a>(x: Box<dyn Fn() -> Option<usize + 'a>>) -> usize { |
| 5 | + | ^^^^^ not a trait |
| 6 | + |
| 7 | +error[E0404]: expected trait, found builtin type `usize` |
| 8 | + --> $DIR/suggestion-trait-object-issue-139174.rs:9:32 |
| 9 | + | |
| 10 | +LL | fn create_adder<'a>(x: i32) -> usize + 'a { |
| 11 | + | ^^^^^ not a trait |
| 12 | + |
| 13 | +error[E0404]: expected trait, found builtin type `usize` |
| 14 | + --> $DIR/suggestion-trait-object-issue-139174.rs:16:8 |
| 15 | + | |
| 16 | +LL | x: usize + 'a, |
| 17 | + | ^^^^^ not a trait |
| 18 | + |
| 19 | +error[E0782]: expected a type, found a trait |
| 20 | + --> $DIR/suggestion-trait-object-issue-139174.rs:3:36 |
| 21 | + | |
| 22 | +LL | fn f<'a>(x: Box<dyn Fn() -> Option<usize + 'a>>) -> usize { |
| 23 | + | ^^^^^^^^^^ |
| 24 | + | |
| 25 | +help: you can add the `dyn` keyword if you want a trait object |
| 26 | + | |
| 27 | +LL | fn f<'a>(x: Box<dyn Fn() -> Option<dyn usize + 'a>>) -> usize { |
| 28 | + | +++ |
| 29 | + |
| 30 | +error[E0782]: expected a type, found a trait |
| 31 | + --> $DIR/suggestion-trait-object-issue-139174.rs:9:32 |
| 32 | + | |
| 33 | +LL | fn create_adder<'a>(x: i32) -> usize + 'a { |
| 34 | + | ^^^^^^^^^^ |
| 35 | + | |
| 36 | +help: `usize + 'a` is dyn-incompatible, use `impl usize + 'a` to return an opaque type, as long as you return a single underlying type |
| 37 | + | |
| 38 | +LL | fn create_adder<'a>(x: i32) -> impl usize + 'a { |
| 39 | + | ++++ |
| 40 | + |
| 41 | +error[E0782]: expected a type, found a trait |
| 42 | + --> $DIR/suggestion-trait-object-issue-139174.rs:16:8 |
| 43 | + | |
| 44 | +LL | x: usize + 'a, |
| 45 | + | ^^^^^^^^^^ |
| 46 | + | |
| 47 | +help: you can add the `dyn` keyword if you want a trait object |
| 48 | + | |
| 49 | +LL | x: dyn usize + 'a, |
| 50 | + | +++ |
| 51 | + |
| 52 | +error: aborting due to 6 previous errors |
| 53 | + |
| 54 | +Some errors have detailed explanations: E0404, E0782. |
| 55 | +For more information about an error, try `rustc --explain E0404`. |
0 commit comments