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

impl Trait creates conflicting duplicates of higher-ranked lifetimes in fn pointer types. #51185

Closed
eddyb opened this issue May 29, 2018 · 0 comments

Comments

@eddyb
Copy link
Member

eddyb commented May 29, 2018

Minimal testcase:

fn foo() -> impl Into<for<'a> fn(&'a ())> {
    |_| {} as for<'a> fn(&'a ())
}
error[E0261]: use of undeclared lifetime name `'a`
 --> src/main.rs:1:35
  |
1 | fn foo() -> impl Into<for<'a> fn(&'a ())> {
  |                                   ^^ undeclared lifetime

error[E0496]: lifetime name `'a` shadows a lifetime name that is already in scope
 --> src/main.rs:1:27
  |
1 | fn foo() -> impl Into<for<'a> fn(&'a ())> {
  |                           ^^      -- first declared here
  |                           |
  |                           lifetime 'a already in scope

Cause is known (mishandling in hir::lowering), using this issue to track the pending fix.

bors added a commit that referenced this issue May 30, 2018
 rustc: don't visit lifetime parameters through visit_lifetime.

Ideally we'd also not use the `Lifetime` struct for parameters, but I'll leave that to @varkor (#48149).
Fixes #51185 (discovered while auditing all the `visit_lifetime` implementations).
r? @nikomatsakis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant