Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression from 1.66 to nightly. Compile error: expected named lifetime parameter #106508

Closed
Veetaha opened this issue Jan 5, 2023 · 2 comments
Closed
Labels
C-bug Category: This is a bug.

Comments

@Veetaha
Copy link
Contributor

Veetaha commented Jan 5, 2023

I tried this code:

fn _foo<'a>(_: impl FnOnce(&'a ()) -> &()) {}

I expected to see this happen: the code compiles on nightly without errors as it does on 1.66.0

Instead, this happened: a compile error was produced:

error[E0658]: anonymous lifetimes in `impl Trait` are unstable
 --> crates/scratch/src/lib.rs:2:40
  |
2 | fn _foo<'a>(_: impl FnOnce(&'a ()) -> &()) {}
  |                                        ^ expected named lifetime parameter
  |
  = help: add `#![feature(anonymous_lifetime_in_impl_trait)]` to the crate attributes to enable
help: consider introducing a named lifetime parameter
  |
2 | fn _foo<'a, 'a>(_: impl FnOnce(&'a ()) -> &'a ()) {}
  |         +++                                ++

For more information about this error, try `rustc --explain E0658`.
error: could not compile `scratch` due to previous error

Meta

rustc --version --verbose:

rustc 1.66.0 (69f9c33d7 2022-12-12)

rustc +nightly --version:

rustc 1.68.0-nightly (ad8ae0504 2022-12-29)
@Veetaha Veetaha added the C-bug Category: This is a bug. label Jan 5, 2023
@compiler-errors
Copy link
Member

This is fixed by #106501

@Veetaha
Copy link
Contributor Author

Veetaha commented Jan 5, 2023

Good, thank you ❤️

@Veetaha Veetaha closed this as completed Jan 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug.
Projects
None yet
Development

No branches or pull requests

2 participants