Skip to content

[NLL] Loss of span for consider adding an explicit lifetime bound suggestions #96332

Open
@marmeladema

Description

@marmeladema

In tests like:

Under NLL we rightfully suggest to add a lifetime bound:

   |
LL |     Box::new(B(&*v)) as Box<dyn X>
   |              ^^^^^^
   |
   = help: consider adding an explicit lifetime bound `T: 'static`...

but the actual span where the lifetime bound should be added is lost when we compare to non-nll mode:

LL | fn f<'a, T, U>(v: Box<A<T> + 'static>) -> Box<X + 'static> {
   |          - help: consider adding an explicit lifetime bound...: `T: 'static`

This is a diagnostic regression that should be fixed.

@rustbot label +A-NLL +NLL-diagnostics

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-NLLArea: Non-lexical lifetimes (NLL)A-diagnosticsArea: Messages for errors, warnings, and lintsNLL-diagnosticsWorking towards the "diagnostic parity" goalT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions