Update rvalue_promotable_map

This commit is contained in:
John Kåre Alsaker 2018-11-30 17:45:33 +01:00
parent b8b4ad597a
commit d56d2fbaea
5 changed files with 7 additions and 9 deletions

View file

@ -17,6 +17,7 @@ macro_rules! arena_types {
[few] mir_keys: rustc::util::nodemap::DefIdSet, [few] mir_keys: rustc::util::nodemap::DefIdSet,
[decode] specialization_graph: rustc::traits::specialization_graph::Graph, [decode] specialization_graph: rustc::traits::specialization_graph::Graph,
[] region_scope_tree: rustc::middle::region::ScopeTree, [] region_scope_tree: rustc::middle::region::ScopeTree,
[] item_local_set: rustc::util::nodemap::ItemLocalSet,
], $tcx); ], $tcx);
) )
} }

View file

@ -17,7 +17,6 @@ use crate::middle::region;
use crate::ty::{self, DefIdTree, TyCtxt, adjustment}; use crate::ty::{self, DefIdTree, TyCtxt, adjustment};
use crate::hir::{self, PatKind}; use crate::hir::{self, PatKind};
use rustc_data_structures::sync::Lrc;
use std::rc::Rc; use std::rc::Rc;
use syntax::ptr::P; use syntax::ptr::P;
use syntax_pos::Span; use syntax_pos::Span;
@ -272,7 +271,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx, 'tcx> {
param_env: ty::ParamEnv<'tcx>, param_env: ty::ParamEnv<'tcx>,
region_scope_tree: &'a region::ScopeTree, region_scope_tree: &'a region::ScopeTree,
tables: &'a ty::TypeckTables<'tcx>, tables: &'a ty::TypeckTables<'tcx>,
rvalue_promotable_map: Option<Lrc<ItemLocalSet>>) rvalue_promotable_map: Option<&'tcx ItemLocalSet>)
-> Self -> Self
{ {
ExprUseVisitor { ExprUseVisitor {

View file

@ -77,7 +77,6 @@ use syntax_pos::Span;
use std::borrow::Cow; use std::borrow::Cow;
use std::fmt; use std::fmt;
use std::hash::{Hash, Hasher}; use std::hash::{Hash, Hasher};
use rustc_data_structures::sync::Lrc;
use rustc_data_structures::indexed_vec::Idx; use rustc_data_structures::indexed_vec::Idx;
use std::rc::Rc; use std::rc::Rc;
use crate::util::nodemap::ItemLocalSet; 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 tcx: TyCtxt<'a, 'gcx, 'tcx>,
pub region_scope_tree: &'a region::ScopeTree, pub region_scope_tree: &'a region::ScopeTree,
pub tables: &'a ty::TypeckTables<'tcx>, 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>>, 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>, pub fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>,
region_scope_tree: &'a region::ScopeTree, region_scope_tree: &'a region::ScopeTree,
tables: &'a ty::TypeckTables<'tcx>, tables: &'a ty::TypeckTables<'tcx>,
rvalue_promotable_map: Option<Lrc<ItemLocalSet>>) rvalue_promotable_map: Option<&'tcx ItemLocalSet>)
-> MemCategorizationContext<'a, 'tcx, 'tcx> { -> MemCategorizationContext<'a, 'tcx, 'tcx> {
MemCategorizationContext { MemCategorizationContext {
tcx, tcx,

View file

@ -504,7 +504,7 @@ rustc_queries! {
} }
cache { true } cache { true }
} }
query rvalue_promotable_map(key: DefId) -> Lrc<ItemLocalSet> { query rvalue_promotable_map(key: DefId) -> &'tcx ItemLocalSet {
desc { |tcx| desc { |tcx|
"checking which parts of `{}` are promotable to static", "checking which parts of `{}` are promotable to static",
tcx.def_path_str(key) tcx.def_path_str(key)

View file

@ -25,7 +25,6 @@ use rustc::ty::query::Providers;
use rustc::ty::subst::{InternalSubsts, SubstsRef}; use rustc::ty::subst::{InternalSubsts, SubstsRef};
use rustc::util::nodemap::{ItemLocalSet, HirIdSet}; use rustc::util::nodemap::{ItemLocalSet, HirIdSet};
use rustc::hir; use rustc::hir;
use rustc_data_structures::sync::Lrc;
use syntax_pos::{Span, DUMMY_SP}; use syntax_pos::{Span, DUMMY_SP};
use log::debug; use log::debug;
use Promotability::*; 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>, fn rvalue_promotable_map<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
def_id: DefId) def_id: DefId)
-> Lrc<ItemLocalSet> -> &'tcx ItemLocalSet
{ {
let outer_def_id = tcx.closure_base_def_id(def_id); let outer_def_id = tcx.closure_base_def_id(def_id);
if outer_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 body_id = tcx.hir().body_owned_by(hir_id);
let _ = visitor.check_nested_body(body_id); let _ = visitor.check_nested_body(body_id);
Lrc::new(visitor.result) tcx.arena.alloc(visitor.result)
} }
struct CheckCrateVisitor<'a, 'tcx: 'a> { struct CheckCrateVisitor<'a, 'tcx: 'a> {