Use of unimplemented!() causing ICE with NLL#52058
Conversation
| None, | ||
| "never found an activation for this borrow!", | ||
| ); | ||
|
|
There was a problem hiding this comment.
I am a bit concerned here because I don't know where two-phase borrows that wind up unactivated will be set to TwoPhaseActivation::NotActivated. I think they will erroneously be recorded as not two phase. This means we will get an error with e.g. this code:
fn main() {
let mut vec = vec![];
vec.push((vec.len(), panic!()));
}I expect this to error because the borrow of vec for calling push will incorrectly be considered "not two phase".
There was a problem hiding this comment.
To fix this, I think we can modify insert_as_pending_if_two_phase to set the activation_location field to NotActivated instead of NotTwoPhase. Then when we do find an activation we can assert that the field is "not activated".
There was a problem hiding this comment.
If I am correct about all this btw please add that above test. =)
There was a problem hiding this comment.
Pushed a commit that addresses this.
| TwoPhaseActivation::NotActivated | ||
| } | ||
| _ => { | ||
| // Double check: We should have found an activation for every pending |
There was a problem hiding this comment.
I think this commit is not quite correct -- that is, what we are checking here is that (a) this is indeed a 2-phase borrow and (b) we've not found some other activation (though we also check that above), right?
There was a problem hiding this comment.
Pushed improved comments.
| ); | ||
| }; | ||
|
|
||
| // Consider the borrow not activated. |
There was a problem hiding this comment.
I'd say "Consider the borrow not activated to start. When we find an activation, we'll update this field."
There was a problem hiding this comment.
Pushed improved comments.
|
@bors r+ |
|
📌 Commit f90eada has been approved by |
Use of unimplemented!() causing ICE with NLL Fixes rust-lang#51345. r? @nikomatsakis
Rollup of 9 pull requests Successful merges: - #51901 (Rc: remove unused allocation and fix segfault in Weak::new()) - #52058 (Use of unimplemented!() causing ICE with NLL) - #52067 (Visit the mir basic blocks in reverse-postfix order) - #52083 (Dont run ast borrowck on mir mode) - #52099 (fix typo in stable `--edition` error message) - #52103 (Stabilize rc_downcast) - #52104 (Remove unnecessary feature gate.) - #52117 (Dedupe filetime) - #52120 (ARM: expose the "mclass" target feature) Failed merges: r? @ghost
Fixes #51345.
r? @nikomatsakis