From f8f8bf704167982d40346f1bd36400c1c400b122 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?John=20K=C3=A5re=20Alsaker?= Date: Fri, 30 Nov 2018 20:15:09 +0100 Subject: [PATCH] Update borrowck --- src/librustc/arena.rs | 1 + src/librustc/query/mod.rs | 2 +- src/librustc_borrowck/borrowck/mod.rs | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/librustc/arena.rs b/src/librustc/arena.rs index e9751a23f1218..ad5f33e476c83 100644 --- a/src/librustc/arena.rs +++ b/src/librustc/arena.rs @@ -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); ) } diff --git a/src/librustc/query/mod.rs b/src/librustc/query/mod.rs index bc9aaf870ceed..dd34dadc20e43 100644 --- a/src/librustc/query/mod.rs +++ b/src/librustc/query/mod.rs @@ -368,7 +368,7 @@ rustc_queries! { } BorrowChecking { - query borrowck(_: DefId) -> Lrc {} + 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. diff --git a/src/librustc_borrowck/borrowck/mod.rs b/src/librustc_borrowck/borrowck/mod.rs index a2f6d9713f026..e292a9152c8b2 100644 --- a/src/librustc_borrowck/borrowck/mod.rs +++ b/src/librustc_borrowck/borrowck/mod.rs @@ -77,7 +77,7 @@ pub struct AnalysisData<'a, 'tcx: 'a> { } fn borrowck<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, owner_def_id: DefId) - -> Lrc + -> &'tcx BorrowCheckResult { assert!(tcx.use_ast_borrowck() || tcx.migrate_borrowck()); @@ -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, }) @@ -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(), })