about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNicholas Nethercote <n.nethercote@gmail.com>2024-10-04 14:08:04 +1000
committerNicholas Nethercote <n.nethercote@gmail.com>2024-10-04 16:48:16 +1000
commitd9975ce2b4e1c191b6b5a113cb548344c32f3a2b (patch)
tree63c5fe21b85609934281def6b7ccc264f372f884
parent3d7fe9e7dd07fcf1f5d9d7aac6f3ed4963bd4e58 (diff)
downloadrust-d9975ce2b4e1c191b6b5a113cb548344c32f3a2b.tar.gz
rust-d9975ce2b4e1c191b6b5a113cb548344c32f3a2b.zip
Avoid `Rc` in `BodyWithBorrowckFacts`.
It can own these two fields.
-rw-r--r--compiler/rustc_borrowck/src/consumers.rs6
-rw-r--r--compiler/rustc_borrowck/src/lib.rs5
2 files changed, 4 insertions, 7 deletions
diff --git a/compiler/rustc_borrowck/src/consumers.rs b/compiler/rustc_borrowck/src/consumers.rs
index 9f3f2320ba4..7ace38c3e85 100644
--- a/compiler/rustc_borrowck/src/consumers.rs
+++ b/compiler/rustc_borrowck/src/consumers.rs
@@ -1,7 +1,5 @@
 //! This file provides API for compiler consumers.
 
-use std::rc::Rc;
-
 use rustc_hir::def_id::LocalDefId;
 use rustc_index::{IndexSlice, IndexVec};
 use rustc_middle::mir::{Body, Promoted};
@@ -65,10 +63,10 @@ pub struct BodyWithBorrowckFacts<'tcx> {
     /// The mir bodies of promoteds.
     pub promoted: IndexVec<Promoted, Body<'tcx>>,
     /// The set of borrows occurring in `body` with data about them.
-    pub borrow_set: Rc<BorrowSet<'tcx>>,
+    pub borrow_set: BorrowSet<'tcx>,
     /// Context generated during borrowck, intended to be passed to
     /// [`calculate_borrows_out_of_scope_at_location`].
-    pub region_inference_context: Rc<RegionInferenceContext<'tcx>>,
+    pub region_inference_context: RegionInferenceContext<'tcx>,
     /// The table that maps Polonius points to locations in the table.
     /// Populated when using [`ConsumerOptions::PoloniusInputFacts`]
     /// or [`ConsumerOptions::PoloniusOutputFacts`].
diff --git a/compiler/rustc_borrowck/src/lib.rs b/compiler/rustc_borrowck/src/lib.rs
index b8cc8fe1fd1..42b1e0036ad 100644
--- a/compiler/rustc_borrowck/src/lib.rs
+++ b/compiler/rustc_borrowck/src/lib.rs
@@ -20,7 +20,6 @@ use std::cell::RefCell;
 use std::collections::BTreeMap;
 use std::marker::PhantomData;
 use std::ops::Deref;
-use std::rc::Rc;
 
 use consumers::{BodyWithBorrowckFacts, ConsumerOptions};
 use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
@@ -420,8 +419,8 @@ fn do_mir_borrowck<'tcx>(
         Some(Box::new(BodyWithBorrowckFacts {
             body: body_owned,
             promoted,
-            borrow_set: Rc::new(borrow_set),
-            region_inference_context: Rc::new(regioncx),
+            borrow_set,
+            region_inference_context: regioncx,
             location_table: polonius_input.as_ref().map(|_| location_table),
             input_facts: polonius_input,
             output_facts,