Skip to content

[NLL] Loss of suggestions to change/fix trait object lifetime bound #96277

Closed
@marmeladema

Description

@marmeladema

For tests like:

In NLL mode, we loose suggestions to change trait object lifetime bound like:

help: consider changing the trait object's explicit `'static` bound to the lifetime of argument `v`
   |
LL | fn g<'a, T: 'static>(v: Box<dyn A<T> + 'a>) -> Box<dyn X + 'a> {
   |                                                            ~~

or

help: alternatively, add an explicit `'static` bound to this reference
   |
LL | fn g<'a, T: 'static>(v: Box<(dyn A<T> + 'static)>) -> Box<dyn X + 'static> {
   |                         ~~~~~~~~~~~~~~~~~~~~~~~~~

The latter mentions a reference which is a bit wrong in this case since only Box-es are involved but it can probably be solved separately.
In any case, we should re-instate those suggestions in NLL mode.

@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