about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorJohn Kåre Alsaker <john.kare.alsaker@gmail.com>2018-11-30 17:45:33 +0100
committerJohn Kåre Alsaker <john.kare.alsaker@gmail.com>2019-04-25 18:23:33 +0200
commitd56d2fbaeac03d5f9cdebf65071ec199b8b80c4e (patch)
tree75a45947bcc386060baf8eab8d8baee6c8dbff8d /src
parentb8b4ad597a2eac24452e2e78f7b043805f2bb846 (diff)
downloadrust-d56d2fbaeac03d5f9cdebf65071ec199b8b80c4e.tar.gz
rust-d56d2fbaeac03d5f9cdebf65071ec199b8b80c4e.zip
Update rvalue_promotable_map
Diffstat (limited to 'src')
-rw-r--r--src/librustc/arena.rs1
-rw-r--r--src/librustc/middle/expr_use_visitor.rs3
-rw-r--r--src/librustc/middle/mem_categorization.rs5
-rw-r--r--src/librustc/query/mod.rs2
-rw-r--r--src/librustc_passes/rvalue_promotion.rs5
5 files changed, 7 insertions, 9 deletions
diff --git a/src/librustc/arena.rs b/src/librustc/arena.rs
index 2c975f17dca..b8677280b10 100644
--- a/src/librustc/arena.rs
+++ b/src/librustc/arena.rs
@@ -17,6 +17,7 @@ macro_rules! arena_types {
             [few] mir_keys: rustc::util::nodemap::DefIdSet,
             [decode] specialization_graph: rustc::traits::specialization_graph::Graph,
             [] region_scope_tree: rustc::middle::region::ScopeTree,
+            [] item_local_set: rustc::util::nodemap::ItemLocalSet,
         ], $tcx);
     )
 }
diff --git a/src/librustc/middle/expr_use_visitor.rs b/src/librustc/middle/expr_use_visitor.rs
index 217af7eea96..f00cd5584eb 100644
--- a/src/librustc/middle/expr_use_visitor.rs
+++ b/src/librustc/middle/expr_use_visitor.rs
@@ -17,7 +17,6 @@ use crate::middle::region;
 use crate::ty::{self, DefIdTree, TyCtxt, adjustment};
 
 use crate::hir::{self, PatKind};
-use rustc_data_structures::sync::Lrc;
 use std::rc::Rc;
 use syntax::ptr::P;
 use syntax_pos::Span;
@@ -272,7 +271,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx, 'tcx> {
                param_env: ty::ParamEnv<'tcx>,
                region_scope_tree: &'a region::ScopeTree,
                tables: &'a ty::TypeckTables<'tcx>,
-               rvalue_promotable_map: Option<Lrc<ItemLocalSet>>)
+               rvalue_promotable_map: Option<&'tcx ItemLocalSet>)
                -> Self
     {
         ExprUseVisitor {
diff --git a/src/librustc/middle/mem_categorization.rs b/src/librustc/middle/mem_categorization.rs
index a4a54ba1837..a5578ead9dd 100644
--- a/src/librustc/middle/mem_categorization.rs
+++ b/src/librustc/middle/mem_categorization.rs
@@ -77,7 +77,6 @@ use syntax_pos::Span;
 use std::borrow::Cow;
 use std::fmt;
 use std::hash::{Hash, Hasher};
-use rustc_data_structures::sync::Lrc;
 use rustc_data_structures::indexed_vec::Idx;
 use std::rc::Rc;
 use crate::util::nodemap::ItemLocalSet;
@@ -290,7 +289,7 @@ pub struct MemCategorizationContext<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
     pub tcx: TyCtxt<'a, 'gcx, 'tcx>,
     pub region_scope_tree: &'a region::ScopeTree,
     pub tables: &'a ty::TypeckTables<'tcx>,
-    rvalue_promotable_map: Option<Lrc<ItemLocalSet>>,
+    rvalue_promotable_map: Option<&'tcx ItemLocalSet>,
     infcx: Option<&'a InferCtxt<'a, 'gcx, 'tcx>>,
 }
 
@@ -400,7 +399,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx, 'tcx> {
     pub fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                region_scope_tree: &'a region::ScopeTree,
                tables: &'a ty::TypeckTables<'tcx>,
-               rvalue_promotable_map: Option<Lrc<ItemLocalSet>>)
+               rvalue_promotable_map: Option<&'tcx ItemLocalSet>)
                -> MemCategorizationContext<'a, 'tcx, 'tcx> {
         MemCategorizationContext {
             tcx,
diff --git a/src/librustc/query/mod.rs b/src/librustc/query/mod.rs
index 4311cfbe2b1..18c977c43a7 100644
--- a/src/librustc/query/mod.rs
+++ b/src/librustc/query/mod.rs
@@ -504,7 +504,7 @@ rustc_queries! {
             }
             cache { true }
         }
-        query rvalue_promotable_map(key: DefId) -> Lrc<ItemLocalSet> {
+        query rvalue_promotable_map(key: DefId) -> &'tcx ItemLocalSet {
             desc { |tcx|
                 "checking which parts of `{}` are promotable to static",
                 tcx.def_path_str(key)
diff --git a/src/librustc_passes/rvalue_promotion.rs b/src/librustc_passes/rvalue_promotion.rs
index e2c5c4ee374..5553f131154 100644
--- a/src/librustc_passes/rvalue_promotion.rs
+++ b/src/librustc_passes/rvalue_promotion.rs
@@ -25,7 +25,6 @@ use rustc::ty::query::Providers;
 use rustc::ty::subst::{InternalSubsts, SubstsRef};
 use rustc::util::nodemap::{ItemLocalSet, HirIdSet};
 use rustc::hir;
-use rustc_data_structures::sync::Lrc;
 use syntax_pos::{Span, DUMMY_SP};
 use log::debug;
 use Promotability::*;
@@ -53,7 +52,7 @@ fn const_is_rvalue_promotable_to_static<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
 
 fn rvalue_promotable_map<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
                                    def_id: DefId)
-                                   -> Lrc<ItemLocalSet>
+                                   -> &'tcx ItemLocalSet
 {
     let outer_def_id = tcx.closure_base_def_id(def_id);
     if outer_def_id != def_id {
@@ -77,7 +76,7 @@ fn rvalue_promotable_map<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
     let body_id = tcx.hir().body_owned_by(hir_id);
     let _ = visitor.check_nested_body(body_id);
 
-    Lrc::new(visitor.result)
+    tcx.arena.alloc(visitor.result)
 }
 
 struct CheckCrateVisitor<'a, 'tcx: 'a> {