Skip to content

Spurious additional lifetime appearing in printout of type involving HRT lifetimes #102392

Closed
@steffahn

Description

@steffahn

“Related” to #102346, and #101280, as this, too, is about diagnostic printing of types with HRT lifetimes (unlike the former related issue, this issue is not a recent regression):

fn g(f: for<'a> fn(fn(&str, &'a str))) -> bool {
    f
}
error[E0308]: mismatched types
 --> src/lib.rs:2:5
  |
1 | fn g(f: for<'a> fn(fn(&str, &'a str))) -> bool {
  |                                           ---- expected `bool` because of return type
2 |     f
  |     ^ expected `bool`, found fn pointer
  |
  = note:    expected type `bool`
          found fn pointer `for<'a> fn(for<'b, 'a> fn(&'b str, &'a str))`

The way this type is displayed includes an additional superflous/confusing/wrong quantification of 'a in the inner for. Correct would be for<'a> fn(for<'b> fn(&'b str, &'a str)), not for<'a> fn(for<'b, 'a> fn(&'b str, &'a str)).

cc @b-naber who is currently working on the above-mentioned “related” issues.

@rustbot label regression-from-stable-to-stable, E-needs-bisection

Regresses between 1.54 and 1.55:

1.54

  = note:    expected type `bool`
          found fn pointer `for<'a> fn(for<'r> fn(&'r str, &'a str))`

1.55

  = note:    expected type `bool`
          found fn pointer `for<'a> fn(for<'r, 'a> fn(&'r str, &'a str))`

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-diagnosticsArea: Messages for errors, warnings, and lintsP-lowLow priorityT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.regression-from-stable-to-stablePerformance or correctness regression from one stable version to another.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions