Skip to content

NLL: bad error message when converting anonymous lifetime to 'static #46983

Closed
@arielb1

Description

@arielb1

UPDATE: Mentoring instructions here.


Tested at 5165ee9 and current playpen

#![feature(nll)]

fn foo(x: &u32) -> &'static u32 {
    &*x
}

fn main() {}

Error message:

error: free region `` does not outlive free region `'static`
 --> src/main.rs:4:5
  |
4 |     &*x
  |     ^^^

error: aborting due to previous error

Metadata

Metadata

Assignees

Labels

A-NLLArea: Non-lexical lifetimes (NLL)A-diagnosticsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.E-mentorCall for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.NLL-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

Relationships

None yet

Development

No branches or pull requests

Issue actions