about summary refs log tree commit diff
path: root/src/librustc_mir
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-04-27 05:24:11 +0000
committerbors <bors@rust-lang.org>2019-04-27 05:24:11 +0000
commitcfeb9171b11b0791059dbe3eeddbcfe017a4708a (patch)
tree380e98215d2856d0e0d8c61be18aa89d3d3fe661 /src/librustc_mir
parentab9c016395e7a7ce5b2aaf09e1b10c8dd2744eee (diff)
parent53269c7f6e6ecb30f4f11b36cf97cf82bc75fcbc (diff)
Auto merge of #59540 - Zoxc:the-arena-2, r=michaelwoerister
Use arenas to avoid Lrc in queries #1

Based on https://github.com/rust-lang/rust/pull/59536.
Diffstat (limited to 'src/librustc_mir')
-rw-r--r--src/librustc_mir/borrow_check/error_reporting.rs5
-rw-r--r--src/librustc_mir/hair/cx/mod.rs3
-rw-r--r--src/librustc_mir/transform/qualify_consts.rs11
3 files changed, 7 insertions, 12 deletions
diff --git a/src/librustc_mir/borrow_check/error_reporting.rs b/src/librustc_mir/borrow_check/error_reporting.rs
index 12dcea7bd59..54fecb4ad60 100644
--- a/src/librustc_mir/borrow_check/error_reporting.rs
+++ b/src/librustc_mir/borrow_check/error_reporting.rs
@@ -17,7 +17,6 @@ use rustc::ty::layout::VariantIdx;
 use rustc::ty::print::Print;
 use rustc_data_structures::fx::FxHashSet;
 use rustc_data_structures::indexed_vec::Idx;
-use rustc_data_structures::sync::Lrc;
 use rustc_errors::{Applicability, DiagnosticBuilder};
 use syntax_pos::Span;
 use syntax::source_map::CompilerDesugaringKind;
@@ -811,7 +810,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
         &mut self,
         context: Context,
         name: &str,
-        scope_tree: &Lrc<ScopeTree>,
+        scope_tree: &'tcx ScopeTree,
         borrow: &BorrowData<'tcx>,
         drop_span: Span,
         borrow_spans: UseSpans,
@@ -1000,7 +999,7 @@ impl<'cx, 'gcx, 'tcx> MirBorrowckCtxt<'cx, 'gcx, 'tcx> {
     fn report_temporary_value_does_not_live_long_enough(
         &mut self,
         context: Context,
-        scope_tree: &Lrc<ScopeTree>,
+        scope_tree: &'tcx ScopeTree,
         borrow: &BorrowData<'tcx>,
         drop_span: Span,
         borrow_spans: UseSpans,
diff --git a/src/librustc_mir/hair/cx/mod.rs b/src/librustc_mir/hair/cx/mod.rs
index 71c6489d63f..7aed0bace8c 100644
--- a/src/librustc_mir/hair/cx/mod.rs
+++ b/src/librustc_mir/hair/cx/mod.rs
@@ -18,7 +18,6 @@ use syntax::ast;
 use syntax::attr;
 use syntax::symbol::Symbol;
 use rustc::hir;
-use rustc_data_structures::sync::Lrc;
 use crate::hair::constant::{lit_to_const, LitToConstError};
 
 #[derive(Clone)]
@@ -32,7 +31,7 @@ pub struct Cx<'a, 'gcx: 'a + 'tcx, 'tcx: 'a> {
     /// Identity `InternalSubsts` for use with const-evaluation.
     pub identity_substs: &'gcx InternalSubsts<'gcx>,
 
-    pub region_scope_tree: Lrc<region::ScopeTree>,
+    pub region_scope_tree: &'gcx region::ScopeTree,
     pub tables: &'a ty::TypeckTables<'gcx>,
 
     /// This is `Constness::Const` if we are compiling a `static`,
diff --git a/src/librustc_mir/transform/qualify_consts.rs b/src/librustc_mir/transform/qualify_consts.rs
index bbcdd2c1812..18ad89be3c3 100644
--- a/src/librustc_mir/transform/qualify_consts.rs
+++ b/src/librustc_mir/transform/qualify_consts.rs
@@ -7,7 +7,6 @@
 use rustc_data_structures::bit_set::BitSet;
 use rustc_data_structures::indexed_vec::IndexVec;
 use rustc_data_structures::fx::FxHashSet;
-use rustc_data_structures::sync::Lrc;
 use rustc_target::spec::abi::Abi;
 use rustc::hir;
 use rustc::hir::def_id::DefId;
@@ -833,7 +832,7 @@ impl<'a, 'tcx> Checker<'a, 'tcx> {
     }
 
     /// Check a whole const, static initializer or const fn.
-    fn check_const(&mut self) -> (u8, Lrc<BitSet<Local>>) {
+    fn check_const(&mut self) -> (u8, &'tcx BitSet<Local>) {
         debug!("const-checking {} {:?}", self.mode, self.def_id);
 
         let mir = self.mir;
@@ -907,8 +906,6 @@ impl<'a, 'tcx> Checker<'a, 'tcx> {
             }
         }
 
-        let promoted_temps = Lrc::new(promoted_temps);
-
         let mut qualifs = self.qualifs_in_local(RETURN_PLACE);
 
         // Account for errors in consts by using the
@@ -917,7 +914,7 @@ impl<'a, 'tcx> Checker<'a, 'tcx> {
             qualifs = self.qualifs_in_any_value_of_ty(mir.return_ty());
         }
 
-        (qualifs.encode_to_bits(), promoted_temps)
+        (qualifs.encode_to_bits(), self.tcx.arena.alloc(promoted_temps))
     }
 }
 
@@ -1433,7 +1430,7 @@ pub fn provide(providers: &mut Providers<'_>) {
 
 fn mir_const_qualif<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                               def_id: DefId)
-                              -> (u8, Lrc<BitSet<Local>>) {
+                              -> (u8, &'tcx BitSet<Local>) {
     // N.B., this `borrow()` is guaranteed to be valid (i.e., the value
     // cannot yet be stolen), because `mir_validated()`, which steals
     // from `mir_const(), forces this query to execute before
@@ -1442,7 +1439,7 @@ fn mir_const_qualif<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
 
     if mir.return_ty().references_error() {
         tcx.sess.delay_span_bug(mir.span, "mir_const_qualif: Mir had errors");
-        return (1 << IsNotPromotable::IDX, Lrc::new(BitSet::new_empty(0)));
+        return (1 << IsNotPromotable::IDX, tcx.arena.alloc(BitSet::new_empty(0)));
     }
 
     Checker::new(tcx, def_id, mir, Mode::Const).check_const()