Skip to content

Commit dd59978

Browse files
committed
Update rvalue_promotable_map
1 parent 4de8c6a commit dd59978

File tree

5 files changed

+7
-9
lines changed

5 files changed

+7
-9
lines changed

src/librustc/arena.rs

+1
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ macro_rules! arena_types {
1212
// FIXME: We only allocate one of these. Optimize for that case?
1313
[] crate_inherent_impls: rustc::ty::CrateInherentImpls,
1414
[] region_scope_tree: rustc::middle::region::ScopeTree,
15+
[] item_local_set: rustc::util::nodemap::ItemLocalSet,
1516
], $tcx);
1617
)
1718
}

src/librustc/middle/expr_use_visitor.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ use crate::middle::region;
1717
use crate::ty::{self, DefIdTree, TyCtxt, adjustment};
1818

1919
use crate::hir::{self, PatKind};
20-
use rustc_data_structures::sync::Lrc;
2120
use std::rc::Rc;
2221
use syntax::ptr::P;
2322
use syntax_pos::Span;
@@ -272,7 +271,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx, 'tcx> {
272271
param_env: ty::ParamEnv<'tcx>,
273272
region_scope_tree: &'a region::ScopeTree,
274273
tables: &'a ty::TypeckTables<'tcx>,
275-
rvalue_promotable_map: Option<Lrc<ItemLocalSet>>)
274+
rvalue_promotable_map: Option<&'tcx ItemLocalSet>)
276275
-> Self
277276
{
278277
ExprUseVisitor {

src/librustc/middle/mem_categorization.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,6 @@ use syntax_pos::Span;
7777
use std::borrow::Cow;
7878
use std::fmt;
7979
use std::hash::{Hash, Hasher};
80-
use rustc_data_structures::sync::Lrc;
8180
use rustc_data_structures::indexed_vec::Idx;
8281
use std::rc::Rc;
8382
use crate::util::nodemap::ItemLocalSet;
@@ -290,7 +289,7 @@ pub struct MemCategorizationContext<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
290289
pub tcx: TyCtxt<'a, 'gcx, 'tcx>,
291290
pub region_scope_tree: &'a region::ScopeTree,
292291
pub tables: &'a ty::TypeckTables<'tcx>,
293-
rvalue_promotable_map: Option<Lrc<ItemLocalSet>>,
292+
rvalue_promotable_map: Option<&'tcx ItemLocalSet>,
294293
infcx: Option<&'a InferCtxt<'a, 'gcx, 'tcx>>,
295294
}
296295

@@ -400,7 +399,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx, 'tcx> {
400399
pub fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>,
401400
region_scope_tree: &'a region::ScopeTree,
402401
tables: &'a ty::TypeckTables<'tcx>,
403-
rvalue_promotable_map: Option<Lrc<ItemLocalSet>>)
402+
rvalue_promotable_map: Option<&'tcx ItemLocalSet>)
404403
-> MemCategorizationContext<'a, 'tcx, 'tcx> {
405404
MemCategorizationContext {
406405
tcx,

src/librustc/query/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -565,7 +565,7 @@ rustc_queries! {
565565
}
566566
cache { true }
567567
}
568-
query rvalue_promotable_map(key: DefId) -> Lrc<ItemLocalSet> {
568+
query rvalue_promotable_map(key: DefId) -> &'tcx ItemLocalSet {
569569
desc { |tcx|
570570
"checking which parts of `{}` are promotable to static",
571571
tcx.def_path_str(key)

src/librustc_passes/rvalue_promotion.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ use rustc::ty::query::Providers;
2525
use rustc::ty::subst::{InternalSubsts, SubstsRef};
2626
use rustc::util::nodemap::{ItemLocalSet, HirIdSet};
2727
use rustc::hir;
28-
use rustc_data_structures::sync::Lrc;
2928
use syntax_pos::{Span, DUMMY_SP};
3029
use log::debug;
3130
use Promotability::*;
@@ -53,7 +52,7 @@ fn const_is_rvalue_promotable_to_static<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
5352

5453
fn rvalue_promotable_map<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
5554
def_id: DefId)
56-
-> Lrc<ItemLocalSet>
55+
-> &'tcx ItemLocalSet
5756
{
5857
let outer_def_id = tcx.closure_base_def_id(def_id);
5958
if outer_def_id != def_id {
@@ -77,7 +76,7 @@ fn rvalue_promotable_map<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
7776
let body_id = tcx.hir().body_owned_by(hir_id);
7877
let _ = visitor.check_nested_body(body_id);
7978

80-
Lrc::new(visitor.result)
79+
tcx.arena.alloc(visitor.result)
8180
}
8281

8382
struct CheckCrateVisitor<'a, 'tcx: 'a> {

0 commit comments

Comments
 (0)