Code
fn main() {
//let cl: for<'a> fn(&'a str) -> (&'a str, &'a str) = |x| { x.split_at(0) };
let cl = for<'a> |x: &'a str| -> (&'a str, &'a str) { x.split_at(0) };
let (_x, _y) = cl("42");
}
Current output
error[E0658]: `for<...>` binders for closures are experimental
--> f83.rs:3:14
|
3 | let cl = for<'a> |x: &'a str| -> (&'a str, &'a str) { x.split_at(0) };
| ^^^^^^^
|
= note: see issue #97362 <https://github.com/rust-lang/rust/issues/97362> for more information
= help: add `#![feature(closure_lifetime_binder)]` to the crate attributes to enable
= help: consider removing `for<...>`
Desired output
error[E0658]: `for<...>` binders for closures are experimental
--> f83.rs:3:14
|
3 | let cl = for<'a> |x: &'a str| -> (&'a str, &'a str) { x.split_at(0) };
| ^^^^^^^
|
= note: see issue #97362 <https://github.com/rust-lang/rust/issues/97362> for more information
= help: add `#![feature(closure_lifetime_binder)]` to the crate attributes to enable
= help: consider setting the binding type instead
|
3 - let cl = for<'a> |x: &'a str| -> (&'a str, &'a str) { x.split_at(0) };
3 + let cl: for<'a> fn(&'a str) -> (&'a str, &'a str) = |x| { x.split_at(0) };
|
Rationale and extra context
Although the feature is unstable, someone trying to deal with lifetime errors might accidentally arrive to this code, but the feature gate doesn't actually provide reasonable guideline on what to do instead.
Other cases
Rust Version
Anything else?
Noticed while looking at #58525.
Code
Current output
Desired output
Rationale and extra context
Although the feature is unstable, someone trying to deal with lifetime errors might accidentally arrive to this code, but the feature gate doesn't actually provide reasonable guideline on what to do instead.
Other cases
Rust Version
Anything else?
Noticed while looking at #58525.