Closed
Description
Some regressions of #103491 that I previously reported in #105826 (comment), but they were missed:
struct MyTy<'a>(Vec<u8>, &'a ());
impl MyTy<'_> {
fn one(&mut self) -> &mut impl Sized {
&mut self.0
}
fn two(&mut self) -> &mut (impl Sized + 'static) {
self.one()
//~^ ERROR lifetime may not live long enough
}
}
#![feature(type_alias_impl_trait)]
type Opaque<'a> = impl Sized;
fn define<'a>() -> Opaque<'a> {}
fn test<'a>() {
None::<&'static Opaque<'a>>;
//~^ ERROR lifetime may not live long enough
}
fn one<'a, 'b: 'b>() -> &'a impl Sized {
&()
}
fn two<'a, 'b>() {
one::<'a, 'b>();
//~^ ERROR lifetime may not live long enough
}
I guess the way to fix this is to ignore non-captured lifetimes of opaque types here
cc @cjgillot
@rustbot label C-bug regression-from-stable-to-stable T-types T-compiler A-impl-trait
Metadata
Metadata
Assignees
Labels
Area: `impl Trait`. Universally / existentially quantified anonymous types with static dispatch.Category: This is a bug.High priorityRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the types team, which will review and decide on the PR/issue.Performance or correctness regression from one stable version to another.