Closed
Description
STR
#![cfg_attr(not(works), feature(nll))]
struct A<'a>(&'a ());
trait Y {
const X: i32;
}
impl Y for A<'static> {
const X: i32 = 10;
}
fn foo<'a>(x: i32) {
match x {
// this uses <A<'a> as Y>::X, but `A<'a>` does not implement `Y`
A::<'a>::X..=A::<'static>::X => (),
_ => (),
}
}
fn bar<'a>(x: i32) {
match x {
// this uses <A<'a> as Y>::X, but `A<'a>` does not implement `Y`
A::<'static>::X..=A::<'a>::X => (),
_ => (),
}
}
Tested on nightly 1.34, but should be present on other versions
Expected Result
Code behaves as with AST, causing an error because A::<'a>
does not implement Y
(only A<'static>
does).
Actual Result
Code compiles.
Metadata
Metadata
Assignees
Labels
Area: Non-lexical lifetimes (NLL)Area: Associated items (types, constants & functions)Area: Lifetimes / regionsIssue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessWorking towards the "invalid code does not compile" goalRelevant to the compiler team, which will review and decide on the PR/issue.