Skip to content

Commit 5271c62

Browse files
committed
Remove RCs from Borrows
1 parent 46f3045 commit 5271c62

File tree

3 files changed

+15
-20
lines changed

3 files changed

+15
-20
lines changed

Cargo.lock

+5-5
Original file line numberDiff line numberDiff line change
@@ -1330,9 +1330,9 @@ dependencies = [
13301330

13311331
[[package]]
13321332
name = "git2"
1333-
version = "0.13.14"
1333+
version = "0.13.17"
13341334
source = "registry+https://github.com/rust-lang/crates.io-index"
1335-
checksum = "186dd99cc77576e58344ad614fa9bb27bad9d048f85de3ca850c1f4e8b048260"
1335+
checksum = "1d250f5f82326884bd39c2853577e70a121775db76818ffa452ed1e80de12986"
13361336
dependencies = [
13371337
"bitflags",
13381338
"libc",
@@ -1759,9 +1759,9 @@ dependencies = [
17591759

17601760
[[package]]
17611761
name = "libgit2-sys"
1762-
version = "0.12.16+1.1.0"
1762+
version = "0.12.18+1.1.0"
17631763
source = "registry+https://github.com/rust-lang/crates.io-index"
1764-
checksum = "9f91b2f931ee975a98155195be8cd82d02e8e029d7d793d2bac1b8181ac97020"
1764+
checksum = "3da6a42da88fc37ee1ecda212ffa254c25713532980005d5f7c0b0fbe7e6e885"
17651765
dependencies = [
17661766
"cc",
17671767
"libc",
@@ -5346,7 +5346,7 @@ dependencies = [
53465346
"chrono",
53475347
"lazy_static",
53485348
"matchers",
5349-
"parking_lot 0.11.0",
5349+
"parking_lot 0.9.0",
53505350
"regex",
53515351
"serde",
53525352
"serde_json",

compiler/rustc_mir/src/borrow_check/mod.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ fn do_mir_borrowck<'a, 'tcx>(
259259

260260
let regioncx = Rc::new(regioncx);
261261

262-
let flow_borrows = Borrows::new(tcx, &body, regioncx.clone(), Rc::clone(borrow_set))
262+
let flow_borrows = Borrows::new(tcx, &body, &regioncx, &borrow_set)
263263
.into_engine(tcx, &body)
264264
.pass_name("borrowck")
265265
.iterate_to_fixpoint();
@@ -303,7 +303,7 @@ fn do_mir_borrowck<'a, 'tcx>(
303303
regioncx: regioncx.clone(),
304304
used_mut: Default::default(),
305305
used_mut_upvars: SmallVec::new(),
306-
borrow_set: borrow_set.clone(),
306+
borrow_set: Rc::clone(&borrow_set),
307307
dominators,
308308
upvars: Vec::new(),
309309
local_names: IndexVec::from_elem(None, &promoted_body.local_decls),
@@ -333,10 +333,10 @@ fn do_mir_borrowck<'a, 'tcx>(
333333
move_error_reported: BTreeMap::new(),
334334
uninitialized_error_reported: Default::default(),
335335
errors_buffer,
336-
regioncx,
336+
regioncx: Rc::clone(&regioncx),
337337
used_mut: Default::default(),
338338
used_mut_upvars: SmallVec::new(),
339-
borrow_set,
339+
borrow_set: Rc::clone(&borrow_set),
340340
dominators,
341341
upvars,
342342
local_names,

compiler/rustc_mir/src/dataflow/impls/borrows.rs

+6-11
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ use crate::borrow_check::{
1111
use crate::dataflow::{self, fmt::DebugWithContext, GenKill};
1212

1313
use std::fmt;
14-
use std::rc::Rc;
1514

1615
rustc_index::newtype_index! {
1716
pub struct BorrowIndex {
@@ -30,11 +29,8 @@ pub struct Borrows<'a, 'tcx> {
3029
tcx: TyCtxt<'tcx>,
3130
body: &'a Body<'tcx>,
3231

33-
borrow_set: Rc<BorrowSet<'tcx>>,
32+
borrow_set: &'a BorrowSet<'tcx>,
3433
borrows_out_of_scope_at_location: FxHashMap<Location, Vec<BorrowIndex>>,
35-
36-
/// NLL region inference context with which NLL queries should be resolved
37-
_nonlexical_regioncx: Rc<RegionInferenceContext<'tcx>>,
3834
}
3935

4036
struct StackEntry {
@@ -47,12 +43,12 @@ struct OutOfScopePrecomputer<'a, 'tcx> {
4743
visited: BitSet<mir::BasicBlock>,
4844
visit_stack: Vec<StackEntry>,
4945
body: &'a Body<'tcx>,
50-
regioncx: Rc<RegionInferenceContext<'tcx>>,
46+
regioncx: &'a RegionInferenceContext<'tcx>,
5147
borrows_out_of_scope_at_location: FxHashMap<Location, Vec<BorrowIndex>>,
5248
}
5349

5450
impl<'a, 'tcx> OutOfScopePrecomputer<'a, 'tcx> {
55-
fn new(body: &'a Body<'tcx>, regioncx: Rc<RegionInferenceContext<'tcx>>) -> Self {
51+
fn new(body: &'a Body<'tcx>, regioncx: &'a RegionInferenceContext<'tcx>) -> Self {
5652
OutOfScopePrecomputer {
5753
visited: BitSet::new_empty(body.basic_blocks().len()),
5854
visit_stack: vec![],
@@ -147,10 +143,10 @@ impl<'a, 'tcx> Borrows<'a, 'tcx> {
147143
crate fn new(
148144
tcx: TyCtxt<'tcx>,
149145
body: &'a Body<'tcx>,
150-
nonlexical_regioncx: Rc<RegionInferenceContext<'tcx>>,
151-
borrow_set: Rc<BorrowSet<'tcx>>,
146+
nonlexical_regioncx: &'a RegionInferenceContext<'tcx>,
147+
borrow_set: &'a BorrowSet<'tcx>,
152148
) -> Self {
153-
let mut prec = OutOfScopePrecomputer::new(body, nonlexical_regioncx.clone());
149+
let mut prec = OutOfScopePrecomputer::new(body, nonlexical_regioncx);
154150
for (borrow_index, borrow_data) in borrow_set.iter_enumerated() {
155151
let borrow_region = borrow_data.region.to_region_vid();
156152
let location = borrow_data.reserve_location;
@@ -163,7 +159,6 @@ impl<'a, 'tcx> Borrows<'a, 'tcx> {
163159
body,
164160
borrow_set,
165161
borrows_out_of_scope_at_location: prec.borrows_out_of_scope_at_location,
166-
_nonlexical_regioncx: nonlexical_regioncx,
167162
}
168163
}
169164

0 commit comments

Comments
 (0)