rust/tests/ui/traits/object/suggestion-trait-object-issue-139174.rs

24 lines
547 B
Rust

//@ edition: 2021
fn f<'a>(x: Box<dyn Fn() -> Option<usize + 'a>>) -> usize {
//~^ ERROR expected trait, found builtin type `usize`
//~| ERROR expected a type, found a trait [E0782]
0
}
fn create_adder<'a>(x: i32) -> usize + 'a {
//~^ ERROR expected trait, found builtin type `usize`
//~| ERROR expected a type, found a trait [E0782]
move |y| x + y
}
struct Struct<'a>{
x: usize + 'a,
//~^ ERROR expected trait, found builtin type `usize`
//~| ERROR expected a type, found a trait [E0782]
}
fn main() {
}