-
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
Fix the ICE described in #83693 #86438
Conversation
(rust-highfive has picked a reviewer for you, use r? to override) |
I'm sufficiently sure that this patch treats symptoms rather than the root cause. The minimized self-contained reproduction for this case is #![feature(associated_type_defaults)]
#![feature(unboxed_closures)]
#[rustc_paren_sugar]
trait Tr<T> {
type Output = u8;
fn method() {}
}
impl<T> Tr<T> for u8 {}
fn main() {
<u8 as Tr(&u8)>::method; // Sugared, ICE
<u8 as Tr<(), Output = &u8>>::method; // Desugared, no ICE
} What is the difference between the sugared and desugared cases? |
It seems that you are right; the issue is more complex than I thought at first. Thanks for the example that you've provided; however, I think your desugaring is wrong and should look like this: <u8 as Tr(&u8)>::method; // ICE
<u8 as Tr(&u8) -> ()>::method; // equivalent, ICE
<u8 as Tr<(&u8,), Output = ()>>::method; // desugared, no ICE Neither of the following cause an ICE: <u8 as Tr<(), Output = &u8>>::method;
<u8 as Tr() -> &u8>::method; The ICE thus probably has to do with the special treatment of lifetime elision for parenthesized generic trait arguments: rust/compiler/rustc_resolve/src/late/lifetimes.rs Lines 2411 to 2417 in 9d93819
So probably visit_fn_like_elision() should create a binder somewhere but doesn't. However, I know too little about this function to figure out where or how to fix this; do you happen to have an idea?
|
No (perhaps @jackh726 may know something right away). |
I do know, not quite off of my head. On mobile so will followup next time I get on my computer. If I remember correctly, visit_fn_like_elision doesn't create the binders, but instead uses the closest binders in scope. |
r? @jackh726 |
So, we probably should be bailing out of We actually should probably be bailing on |
Ping from triage: |
Yes, it is. @rustbot label: +S-waiting-on-review -S-waiting-on-author |
Sorry it's taken a bit to get back to this. @bors r+ rollup |
📌 Commit 6f0fe9b has been approved by |
No problem, thanks for the review! |
☀️ Test successful - checks-actions |
This pull request fixes #83693 and fixes #84768.