-
Notifications
You must be signed in to change notification settings - Fork 13.3k
"internal compiler error" on Higher-Ranked Trait Bound for impl Trait in return position #67830
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
hmmm, maybe it is equivalent to (no!) fn test<'a>() -> impl MyFn<&'a A, Output=impl Iterator + 'a> but what about: fn test(f: impl for<'a> MyFn<&'a A, Output=impl Iterator + 'a>) {
let x = A;
f.call(&x);
} it couldn't check:
but this is OK: fn test(_: impl for<'a> MyFn<&'a A, Output=IntoIter<&'a A>>) {
let x = A;
f.call(&x);
} playground here |
triage: P-high. Removing nominaton, but cc @matthewjasper and @nikomatsakis for assistance. |
Minimized further trait Empty {
}
trait T<'l> {
type Assoc;
}
fn foo() -> impl for<'a> T<'a, Assoc = impl Empty + 'a> {
todo!()
} It seems like pretty much any trait will work in place of Empty, but I wanted one guaranteed to have no special treatment. |
This is the exact same stack trace and error message as #54895. Should one of these be duped to the other? |
This is a regression since |
As of the latest nightly this still ICEs, but the stack has changed thanks to #85499 :
|
I needed a
Fn
like trait, and return an impl trait with Higher-Ranked Trait Bound. But rustc panicked.I tried this code:
I expected it was checked, but I received this compiler bug:
Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: