Closed
Description
Another regresssion of #103491 with a different failure path:
fn opaque<'a: 'a>() -> impl Sized {}
fn assert_static<T: 'static>(_: T) {}
fn test() {
let closure = |_| {
assert_static(opaque());
//~^ ERROR the opaque type may not live long enough
};
closure(&opaque());
}
#![feature(type_alias_impl_trait)]
type Opaque<'a> = impl Sized;
fn define<'a>() -> Opaque<'a> {}
fn test(_: &Opaque<'_>) {
None::<&'static Opaque<'_>>;
//~^ ERROR the opaque type may not live long enough
}
It should be fixed by ignoring non-captured lifetimes in:
cc @cjgillot
@rustbot label regression-from-stable-to-stable C-bug T-compiler T-types 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.
Activity
[-]impl Trait lifetimes regression 1.67 part ii[/-][+]impl Trait lifetimes regression 1.67 part 2[/+]aliemjay commentedon Mar 1, 2023
Note that fixing this issue is necessary for #107516, but might not be sufficient. I'll investigate more...
apiraino commentedon Mar 1, 2023
WG-prioritization assigning priority (Zulip discussion).
@rustbot label -I-prioritize +P-high
……::{opaque#0}<'_> does not live long enough
error #107516Auto merge of rust-lang#110399 - cjgillot:infer-variance, r=aliemjay
Auto merge of #110399 - cjgillot:infer-variance, r=aliemjay