Skip to content

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

Closed
@eddyb

Description

@eddyb

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions