Skip to content

nll should respect lifetime annotations from patterns #54573

Closed
@nikomatsakis

Description

@nikomatsakis

The following test passes NLL, but ought not to:

#![feature(nll)]

struct Foo<'a>(&'a u32);

fn main() {
    let y = 22;
    let foo = Foo(&y);
    let Foo::<'static>(z) = foo;
}

As does this one:

#![feature(nll)]

struct Foo<'a> { field: &'a u32 }

fn main() {
    let y = 22;
    let foo = Foo { field: &y };
    let Foo::<'static> { field: z } = foo;
}

Broken out from #47184

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