-
-
Notifications
You must be signed in to change notification settings - Fork 14.4k
Miscellaneous cleanups to borrowck related code #150550
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
base: main
Are you sure you want to change the base?
Conversation
| /// Returns whether borrows represented by this kind are allowed to be split into separate | ||
| /// Reservation and Activation phases. | ||
| pub fn allows_two_phase_borrow(&self) -> bool { | ||
| pub fn is_two_phase_borrow(&self) -> bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in some sense its always a two phase borrow, just sometimes its activated at the same point its created I think?
The previous name confused me because it made it sound like a reference may or may not be a two phase borrow and then we went on to unconditionally treat it as two phase without ever checking if it "actually is".
| // and we know that `&'a T::Out` is WF, then we want to imply `U: 'a`. | ||
| let normalized_ty = ocx | ||
| .deeply_normalize(&ObligationCause::dummy_with_span(span), param_env, ty) | ||
| .map_err(|_| NoSolution)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
did you test removing the normalized_ty here and does that break anything?
| let old_value = self.pending_activations.insert(temp, idx); | ||
| if let Some(old_index) = old_value { | ||
| span_bug!( | ||
| self.body.source_info(location).span, | ||
| "found already pending activation for temp: {:?} \ | ||
| at idx: {:?} with associated data {:?}", | ||
| temp, | ||
| old_index, | ||
| self.location_map[old_index.as_usize()] | ||
| ); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| let old_value = self.pending_activations.insert(temp, idx); | |
| if let Some(old_index) = old_value { | |
| span_bug!( | |
| self.body.source_info(location).span, | |
| "found already pending activation for temp: {:?} \ | |
| at idx: {:?} with associated data {:?}", | |
| temp, | |
| old_index, | |
| self.location_map[old_index.as_usize()] | |
| ); | |
| } | |
| let prev = self.pending_activations.insert(temp, idx); | |
| assert_eq!(prev, None); |
I feel like this if let is too much code for an assert and it was actually slightly confusing to me
|
nits, then r=me |
r? lcnr