2022-12-27 17:56:46 -06:00
|
|
|
fn fn_once() -> _ {
|
|
|
|
//~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types [E0121]
|
|
|
|
//~| NOTE not allowed in type signatures
|
|
|
|
//~| HELP replace with an appropriate return type
|
|
|
|
//~| SUGGESTION impl FnOnce()
|
2023-01-03 18:26:53 -06:00
|
|
|
//~| NOTE for more information on `Fn` traits and closure types
|
2022-12-27 17:56:46 -06:00
|
|
|
let x = String::new();
|
|
|
|
|| {
|
|
|
|
drop(x);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn fn_mut() -> _ {
|
|
|
|
//~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types [E0121]
|
|
|
|
//~| NOTE not allowed in type signatures
|
|
|
|
//~| HELP replace with an appropriate return type
|
|
|
|
//~| SUGGESTION impl FnMut(char)
|
2023-01-03 18:26:53 -06:00
|
|
|
//~| NOTE for more information on `Fn` traits and closure types
|
2022-12-27 17:56:46 -06:00
|
|
|
let x = String::new();
|
2024-02-01 16:45:00 -06:00
|
|
|
//~^ HELP: consider changing this to be mutable
|
2024-04-18 15:41:43 -05:00
|
|
|
//~| NOTE binding `x` declared here
|
2024-02-01 16:45:00 -06:00
|
|
|
|c| { //~ NOTE: value captured here
|
2022-12-27 17:56:46 -06:00
|
|
|
x.push(c);
|
2024-02-01 16:45:00 -06:00
|
|
|
//~^ ERROR: does not live long enough
|
|
|
|
//~| NOTE: does not live long enough
|
|
|
|
//~| NOTE: cannot borrow as mutable
|
|
|
|
//~| ERROR: not declared as mutable
|
2022-12-27 17:56:46 -06:00
|
|
|
}
|
2024-02-01 16:45:00 -06:00
|
|
|
} //~ NOTE: borrow later used here
|
|
|
|
//~^ NOTE: dropped here
|
2022-12-27 17:56:46 -06:00
|
|
|
|
|
|
|
fn fun() -> _ {
|
|
|
|
//~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types [E0121]
|
|
|
|
//~| NOTE not allowed in type signatures
|
|
|
|
//~| HELP replace with an appropriate return type
|
|
|
|
//~| SUGGESTION impl Fn() -> i32
|
2023-01-03 18:26:53 -06:00
|
|
|
//~| NOTE for more information on `Fn` traits and closure types
|
2022-12-27 17:56:46 -06:00
|
|
|
|| 1i32
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|