Skip to content

nll should preserve user types in type ascription #54331

Closed
@nikomatsakis

Description

@nikomatsakis

Spawned off from #47184. The following test case compiles, but it should not (playground):

#![allow(warnings)]
#![feature(nll)]
#![feature(type_ascription)]

fn main() {
    let x = 22_u32;
    let y: &u32 = &x: &'static u32;
}

The problem is that the "type ascription" expression is not preserving the full type that the user gave (&'static u32).

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