diff --git a/Cargo.lock b/Cargo.lock index c2c06a2adb1..84f5e3146c8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1330,9 +1330,9 @@ dependencies = [ [[package]] name = "git2" -version = "0.13.14" +version = "0.13.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "186dd99cc77576e58344ad614fa9bb27bad9d048f85de3ca850c1f4e8b048260" +checksum = "1d250f5f82326884bd39c2853577e70a121775db76818ffa452ed1e80de12986" dependencies = [ "bitflags", "libc", @@ -1759,9 +1759,9 @@ dependencies = [ [[package]] name = "libgit2-sys" -version = "0.12.16+1.1.0" +version = "0.12.18+1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f91b2f931ee975a98155195be8cd82d02e8e029d7d793d2bac1b8181ac97020" +checksum = "3da6a42da88fc37ee1ecda212ffa254c25713532980005d5f7c0b0fbe7e6e885" dependencies = [ "cc", "libc", @@ -5346,7 +5346,7 @@ dependencies = [ "chrono", "lazy_static", "matchers", - "parking_lot 0.11.0", + "parking_lot 0.9.0", "regex", "serde", "serde_json", diff --git a/compiler/rustc_mir/src/borrow_check/mod.rs b/compiler/rustc_mir/src/borrow_check/mod.rs index d115a5fa36d..d92db85284b 100644 --- a/compiler/rustc_mir/src/borrow_check/mod.rs +++ b/compiler/rustc_mir/src/borrow_check/mod.rs @@ -259,7 +259,7 @@ fn do_mir_borrowck<'a, 'tcx>( let regioncx = Rc::new(regioncx); - let flow_borrows = Borrows::new(tcx, &body, regioncx.clone(), Rc::clone(borrow_set)) + let flow_borrows = Borrows::new(tcx, &body, ®ioncx, &borrow_set) .into_engine(tcx, &body) .pass_name("borrowck") .iterate_to_fixpoint(); @@ -303,7 +303,7 @@ fn do_mir_borrowck<'a, 'tcx>( regioncx: regioncx.clone(), used_mut: Default::default(), used_mut_upvars: SmallVec::new(), - borrow_set: borrow_set.clone(), + borrow_set: Rc::clone(&borrow_set), dominators, upvars: Vec::new(), local_names: IndexVec::from_elem(None, &promoted_body.local_decls), @@ -333,10 +333,10 @@ fn do_mir_borrowck<'a, 'tcx>( move_error_reported: BTreeMap::new(), uninitialized_error_reported: Default::default(), errors_buffer, - regioncx, + regioncx: Rc::clone(®ioncx), used_mut: Default::default(), used_mut_upvars: SmallVec::new(), - borrow_set, + borrow_set: Rc::clone(&borrow_set), dominators, upvars, local_names, diff --git a/compiler/rustc_mir/src/dataflow/impls/borrows.rs b/compiler/rustc_mir/src/dataflow/impls/borrows.rs index 26b090d564e..b149ffa9667 100644 --- a/compiler/rustc_mir/src/dataflow/impls/borrows.rs +++ b/compiler/rustc_mir/src/dataflow/impls/borrows.rs @@ -11,7 +11,6 @@ use crate::borrow_check::{ use crate::dataflow::{self, fmt::DebugWithContext, GenKill}; use std::fmt; -use std::rc::Rc; rustc_index::newtype_index! { pub struct BorrowIndex { @@ -30,11 +29,8 @@ pub struct Borrows<'a, 'tcx> { tcx: TyCtxt<'tcx>, body: &'a Body<'tcx>, - borrow_set: Rc>, + borrow_set: &'a BorrowSet<'tcx>, borrows_out_of_scope_at_location: FxHashMap>, - - /// NLL region inference context with which NLL queries should be resolved - _nonlexical_regioncx: Rc>, } struct StackEntry { @@ -47,12 +43,12 @@ struct OutOfScopePrecomputer<'a, 'tcx> { visited: BitSet, visit_stack: Vec, body: &'a Body<'tcx>, - regioncx: Rc>, + regioncx: &'a RegionInferenceContext<'tcx>, borrows_out_of_scope_at_location: FxHashMap>, } impl<'a, 'tcx> OutOfScopePrecomputer<'a, 'tcx> { - fn new(body: &'a Body<'tcx>, regioncx: Rc>) -> Self { + fn new(body: &'a Body<'tcx>, regioncx: &'a RegionInferenceContext<'tcx>) -> Self { OutOfScopePrecomputer { visited: BitSet::new_empty(body.basic_blocks().len()), visit_stack: vec![], @@ -147,10 +143,10 @@ impl<'a, 'tcx> Borrows<'a, 'tcx> { crate fn new( tcx: TyCtxt<'tcx>, body: &'a Body<'tcx>, - nonlexical_regioncx: Rc>, - borrow_set: Rc>, + nonlexical_regioncx: &'a RegionInferenceContext<'tcx>, + borrow_set: &'a BorrowSet<'tcx>, ) -> Self { - let mut prec = OutOfScopePrecomputer::new(body, nonlexical_regioncx.clone()); + let mut prec = OutOfScopePrecomputer::new(body, nonlexical_regioncx); for (borrow_index, borrow_data) in borrow_set.iter_enumerated() { let borrow_region = borrow_data.region.to_region_vid(); let location = borrow_data.reserve_location; @@ -163,7 +159,6 @@ impl<'a, 'tcx> Borrows<'a, 'tcx> { body, borrow_set, borrows_out_of_scope_at_location: prec.borrows_out_of_scope_at_location, - _nonlexical_regioncx: nonlexical_regioncx, } }