Description
The following UB shouldn't compile:
type Static<'a> = &'static &'a ();
trait Extend<'a> {
fn extend(self, _: &'a str) -> &'static str;
}
impl<'a> Extend<'a> for Static<'a> {
fn extend(self, s: &'a str) -> &'static str {
s
}
}
fn boom<'a>(arg: Static<'_>) -> impl Extend<'a> {
arg
}
fn main() {
let y = boom(&&()).extend(&String::from("temporary"));
println!("{}", y);
}
This regressed in v1.61. I guess it is #94081.
Discovered when investigating #114572.
Metadata
Metadata
Assignees
Labels
Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Category: This is a bug.Issue: A soundness hole (worst kind of bug), see: https://en.wikipedia.org/wiki/SoundnessHigh priorityRelevant to the types team, which will review and decide on the PR/issue.Performance or correctness regression from one stable version to another.
Type
Projects
Status
Completed