-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Invalid closure lifetime inference #41366
Labels
A-closures
Area: Closures (`|…| { … }`)
A-inference
Area: Type inference
A-lifetimes
Area: Lifetimes / regions
C-bug
Category: This is a bug.
E-needs-test
Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
phaylon
changed the title
Invalid closure lifetime elision
Invalid closure lifetime inference
Apr 18, 2017
After some experimentation, I tried a possible fix, which lead to an ICE. I changed
to
which gives me:
My
And here is the
|
Mark-Simulacrum
added
the
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
label
Apr 27, 2017
The ICE reduced: trait T<'x> {
type V;
}
impl<'g> T<'g> for u32 {
type V = u16;
}
fn main() {
(&|_|()) as &for<'x> Fn(<u32 as T<'x>>::V);
} |
Triage: still ICEs |
Still ICEs:
|
jonas-schievink
added
A-closures
Area: Closures (`|…| { … }`)
A-inference
Area: Type inference
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
A-lifetimes
Area: Lifetimes / regions
labels
Sep 11, 2019
The reduced example doesn't show the ICE, from 1.35.0 (tested on godbolt). Marked as E-needstest |
JohnTitor
added
the
E-needs-test
Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
label
Oct 15, 2019
And the original code is now accepted, so adding tests is enough to close this ticket. |
JohnTitor
added a commit
to JohnTitor/rust
that referenced
this issue
Oct 22, 2019
Add some tests for fixed ICEs Fixes rust-lang#41366 from 1.35.0 Fixes rust-lang#51431 from 1.31.0-nightly (77af314 2018-10-11) (on my local) Fixes rust-lang#52437 from nightly Fixes rust-lang#63496 from nightly r? @Centril
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-closures
Area: Closures (`|…| { … }`)
A-inference
Area: Type inference
A-lifetimes
Area: Lifetimes / regions
C-bug
Category: This is a bug.
E-needs-test
Call for participation: An issue has been fixed and does not reproduce, but no test has been added.
I-ICE
Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
I'm experimenting with a parser combinator and ran into an issue with closure lifetime inference.
This might be a duplicate of #39943, since it uses a similar (but simpler) mechanism to produce the same error message. However, in the code below the error is potentially a lot further away, and since I need to return values from the closure I'm having trouble finding any way to make it work by explicitly specifying a signature. Since it involves more moving parts, I'm also not sure how to confirm if the underlying issue is the same.
I removed all parts that aren't involved in triggering the error message (the original use case has trait methods with related return types).
It comes down to the following error message:
And here is the triggering code:
The text was updated successfully, but these errors were encountered: