Skip to content

Commit 6cd2d1a

Browse files
committed
Update borrowck
1 parent 3d650bd commit 6cd2d1a

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/librustc/arena.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ macro_rules! arena_types {
2020
[] region_scope_tree: rustc::middle::region::ScopeTree,
2121
[] item_local_set: rustc::util::nodemap::ItemLocalSet,
2222
[decode] mir_const_qualif: rustc_data_structures::bit_set::BitSet<rustc::mir::Local>,
23+
[decode] borrowck: rustc::middle::borrowck::BorrowCheckResult,
2324
], $tcx);
2425
)
2526
}

src/librustc/query/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ rustc_queries! {
368368
}
369369

370370
BorrowChecking {
371-
query borrowck(_: DefId) -> Lrc<BorrowCheckResult> {}
371+
query borrowck(_: DefId) -> &'tcx BorrowCheckResult {}
372372

373373
/// Borrow checks the function body. If this is a closure, returns
374374
/// additional requirements that the closure's creator must verify.

src/librustc_borrowck/borrowck/mod.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ use std::borrow::Cow;
3232
use std::cell::{Cell, RefCell};
3333
use std::fmt;
3434
use std::rc::Rc;
35-
use rustc_data_structures::sync::Lrc;
3635
use std::hash::{Hash, Hasher};
3736
use syntax::source_map::CompilerDesugaringKind;
3837
use syntax_pos::{MultiSpan, Span};
@@ -77,7 +76,7 @@ pub struct AnalysisData<'a, 'tcx: 'a> {
7776
}
7877

7978
fn borrowck<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, owner_def_id: DefId)
80-
-> Lrc<BorrowCheckResult>
79+
-> &'tcx BorrowCheckResult
8180
{
8281
assert!(tcx.use_ast_borrowck() || tcx.migrate_borrowck());
8382

@@ -91,7 +90,7 @@ fn borrowck<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, owner_def_id: DefId)
9190
// those things (notably the synthesized constructors from
9291
// tuple structs/variants) do not have an associated body
9392
// and do not need borrowchecking.
94-
return Lrc::new(BorrowCheckResult {
93+
return tcx.arena.alloc(BorrowCheckResult {
9594
used_mut_nodes: Default::default(),
9695
signalled_any_error: SignalledError::NoErrorsSeen,
9796
})
@@ -142,7 +141,7 @@ fn borrowck<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, owner_def_id: DefId)
142141
unused::check(&mut bccx, body);
143142
}
144143

145-
Lrc::new(BorrowCheckResult {
144+
tcx.arena.alloc(BorrowCheckResult {
146145
used_mut_nodes: bccx.used_mut_nodes.into_inner(),
147146
signalled_any_error: bccx.signalled_any_error.into_inner(),
148147
})

0 commit comments

Comments
 (0)