Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit d9975ce

Browse files
committed
Avoid Rc in BodyWithBorrowckFacts.
It can own these two fields.
1 parent 3d7fe9e commit d9975ce

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

compiler/rustc_borrowck/src/consumers.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
//! This file provides API for compiler consumers.
22
3-
use std::rc::Rc;
4-
53
use rustc_hir::def_id::LocalDefId;
64
use rustc_index::{IndexSlice, IndexVec};
75
use rustc_middle::mir::{Body, Promoted};
@@ -65,10 +63,10 @@ pub struct BodyWithBorrowckFacts<'tcx> {
6563
/// The mir bodies of promoteds.
6664
pub promoted: IndexVec<Promoted, Body<'tcx>>,
6765
/// The set of borrows occurring in `body` with data about them.
68-
pub borrow_set: Rc<BorrowSet<'tcx>>,
66+
pub borrow_set: BorrowSet<'tcx>,
6967
/// Context generated during borrowck, intended to be passed to
7068
/// [`calculate_borrows_out_of_scope_at_location`].
71-
pub region_inference_context: Rc<RegionInferenceContext<'tcx>>,
69+
pub region_inference_context: RegionInferenceContext<'tcx>,
7270
/// The table that maps Polonius points to locations in the table.
7371
/// Populated when using [`ConsumerOptions::PoloniusInputFacts`]
7472
/// or [`ConsumerOptions::PoloniusOutputFacts`].

compiler/rustc_borrowck/src/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ use std::cell::RefCell;
2020
use std::collections::BTreeMap;
2121
use std::marker::PhantomData;
2222
use std::ops::Deref;
23-
use std::rc::Rc;
2423

2524
use consumers::{BodyWithBorrowckFacts, ConsumerOptions};
2625
use rustc_data_structures::fx::{FxIndexMap, FxIndexSet};
@@ -420,8 +419,8 @@ fn do_mir_borrowck<'tcx>(
420419
Some(Box::new(BodyWithBorrowckFacts {
421420
body: body_owned,
422421
promoted,
423-
borrow_set: Rc::new(borrow_set),
424-
region_inference_context: Rc::new(regioncx),
422+
borrow_set,
423+
region_inference_context: regioncx,
425424
location_table: polonius_input.as_ref().map(|_| location_table),
426425
input_facts: polonius_input,
427426
output_facts,

0 commit comments

Comments
 (0)