about summary refs log tree commit diff
path: root/compiler/rustc_mir/src/dataflow/impls
diff options
context:
space:
mode:
authorDániel Buga <bugadani@gmail.com>2021-02-07 22:32:50 +0100
committerDániel Buga <bugadani@gmail.com>2021-02-08 20:37:16 +0100
commit5271c628be9eda5f0a4e3a5700d057ce95cf9da8 (patch)
tree873d4f4e68d203c6c21edaf408a822065415e383 /compiler/rustc_mir/src/dataflow/impls
parent46f30455f42e6c908c21650b181a2aa5ffd7b981 (diff)
downloadrust-5271c628be9eda5f0a4e3a5700d057ce95cf9da8.tar.gz
rust-5271c628be9eda5f0a4e3a5700d057ce95cf9da8.zip
Remove RCs from Borrows
Diffstat (limited to 'compiler/rustc_mir/src/dataflow/impls')
-rw-r--r--compiler/rustc_mir/src/dataflow/impls/borrows.rs17
1 files changed, 6 insertions, 11 deletions
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<BorrowSet<'tcx>>,
+    borrow_set: &'a BorrowSet<'tcx>,
     borrows_out_of_scope_at_location: FxHashMap<Location, Vec<BorrowIndex>>,
-
-    /// NLL region inference context with which NLL queries should be resolved
-    _nonlexical_regioncx: Rc<RegionInferenceContext<'tcx>>,
 }
 
 struct StackEntry {
@@ -47,12 +43,12 @@ struct OutOfScopePrecomputer<'a, 'tcx> {
     visited: BitSet<mir::BasicBlock>,
     visit_stack: Vec<StackEntry>,
     body: &'a Body<'tcx>,
-    regioncx: Rc<RegionInferenceContext<'tcx>>,
+    regioncx: &'a RegionInferenceContext<'tcx>,
     borrows_out_of_scope_at_location: FxHashMap<Location, Vec<BorrowIndex>>,
 }
 
 impl<'a, 'tcx> OutOfScopePrecomputer<'a, 'tcx> {
-    fn new(body: &'a Body<'tcx>, regioncx: Rc<RegionInferenceContext<'tcx>>) -> 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<RegionInferenceContext<'tcx>>,
-        borrow_set: Rc<BorrowSet<'tcx>>,
+        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,
         }
     }