Skip to content

Commit

Permalink
Update borrowck
Browse files Browse the repository at this point in the history
  • Loading branch information
Zoxc committed Apr 21, 2019
1 parent 33fe113 commit f8f8bf7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/librustc/arena.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ macro_rules! arena_types {
)>,
[few] mir_keys: rustc::util::nodemap::DefIdSet,
[decode] specialization_graph: rustc::traits::specialization_graph::Graph,
[decode] borrowck: rustc::middle::borrowck::BorrowCheckResult,
], $tcx);
)
}
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/query/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ rustc_queries! {
}

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

/// Borrow checks the function body. If this is a closure, returns
/// additional requirements that the closure's creator must verify.
Expand Down
6 changes: 3 additions & 3 deletions src/librustc_borrowck/borrowck/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ pub struct AnalysisData<'a, 'tcx: 'a> {
}

fn borrowck<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, owner_def_id: DefId)
-> Lrc<BorrowCheckResult>
-> &'tcx BorrowCheckResult
{
assert!(tcx.use_ast_borrowck() || tcx.migrate_borrowck());

Expand All @@ -91,7 +91,7 @@ fn borrowck<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, owner_def_id: DefId)
// those things (notably the synthesized constructors from
// tuple structs/variants) do not have an associated body
// and do not need borrowchecking.
return Lrc::new(BorrowCheckResult {
return tcx.arena.alloc(BorrowCheckResult {
used_mut_nodes: Default::default(),
signalled_any_error: SignalledError::NoErrorsSeen,
})
Expand Down Expand Up @@ -142,7 +142,7 @@ fn borrowck<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, owner_def_id: DefId)
unused::check(&mut bccx, body);
}

Lrc::new(BorrowCheckResult {
tcx.arena.alloc(BorrowCheckResult {
used_mut_nodes: bccx.used_mut_nodes.into_inner(),
signalled_any_error: bccx.signalled_any_error.into_inner(),
})
Expand Down

0 comments on commit f8f8bf7

Please sign in to comment.