-
Notifications
You must be signed in to change notification settings - Fork 12.9k
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
[NLL] Fix some things for bootstrap #52830
Conversation
Note that the first argument is `self as &mut dyn Delegate`, so this isn't allowed with two-phase borrows.
r? @varkor (rust_highfive has picked a reviewer for you, use r? to override) |
@@ -56,7 +56,7 @@ impl<K: Ord, V> SortedMap<K, V> { | |||
pub fn insert(&mut self, key: K, mut value: V) -> Option<V> { | |||
match self.lookup_index_for(&key) { | |||
Ok(index) => { | |||
let mut slot = unsafe { | |||
let slot = unsafe { | |||
self.data.get_unchecked_mut(index) | |||
}; | |||
mem::swap(&mut slot.1, &mut value); |
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.
I'm surprised this doesn't require mut
on the variable; generally &mut <var>
does require <var>
to be declared mut
I think?
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.
Yes, but this is equivalent to &mut (*slot).1
which is OK since slot is a mutable reference.
@bors delegate+ r=me pending travis |
✌️ @matthewjasper can now approve this pull request |
@bors r+ |
📌 Commit 18d5f82 has been approved by |
[NLL] Fix some things for bootstrap Some changes that are required when bootstrapping rustc with NLL enabled. * Remove a bunch of unused `mut`s that aren't needed, but the existing lint doesn't catch. * Rewrite a function call to satisfy NLL borrowck. Note that the borrow is two-phase, but gets activated immediately by an unsizing coercion. cc #51823
☀️ Test successful - status-appveyor, status-travis |
@@ -248,7 +248,8 @@ impl<'a, 'tcx> CheckCrateVisitor<'a, 'tcx> { | |||
let tcx = self.tcx; | |||
let param_env = self.param_env; | |||
let region_scope_tree = self.tcx.region_scope_tree(item_def_id); | |||
euv::ExprUseVisitor::new(self, tcx, param_env, ®ion_scope_tree, self.tables, None) | |||
let tables = self.tables; | |||
euv::ExprUseVisitor::new(self, tcx, param_env, ®ion_scope_tree, tables, None) |
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.
hmm we may want to actually file an issue for this one (the interaction of two-phase borrows and an Unsize coercion), tagged with NLL, in terms of tracking things that regress with respect to AST-borrowck.
Or we can just wait to someone to report it from the wild. :)
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.
There's already #51915
Some changes that are required when bootstrapping rustc with NLL enabled.
mut
s that aren't needed, but the existing lint doesn't catch.cc #51823