rustc_mir: don't rely on mir::LocalDecl visibility_scopes in the MIR borrowck.

This commit is contained in:
Eduard-Mihai Burtescu 2018-11-27 05:19:07 +02:00
parent 1525dc2146
commit d20da13018

View File

@ -273,11 +273,7 @@ pub(in crate::borrow_check) fn explain_why_borrow_contains_point(
if mir.local_decls[local].name.is_some() { if mir.local_decls[local].name.is_some() {
if let Some((WriteKind::StorageDeadOrDrop, place)) = kind_place { if let Some((WriteKind::StorageDeadOrDrop, place)) = kind_place {
if let Place::Base(PlaceBase::Local(borrowed_local)) = place { if let Place::Base(PlaceBase::Local(borrowed_local)) = place {
let dropped_local_scope = mir.local_decls[local].visibility_scope; if mir.local_decls[*borrowed_local].name.is_some()
let borrowed_local_scope =
mir.local_decls[*borrowed_local].visibility_scope;
if mir.is_sub_scope(borrowed_local_scope, dropped_local_scope)
&& local != *borrowed_local && local != *borrowed_local
{ {
should_note_order = true; should_note_order = true;