Skip to content

nll should respect lifetime annotations from multi-segment paths #54574

Closed
@nikomatsakis

Description

@nikomatsakis

This example should not compile:

#![feature(nll)]

struct A<'a> { x: &'a u32 }

impl<'a> A<'a> {
    fn new(x: &'a u32) -> Self {
        Self { x }
    }
}

fn foo<'a>() {
    let v = 22;
    let x = A::<'a>::new(&v);
}

fn main() {}

But it does =)

Metadata

Metadata

Assignees

Labels

A-NLLArea: Non-lexical lifetimes (NLL)NLL-soundWorking towards the "invalid code does not compile" 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