Skip to content

Commit d56d2fb

Browse files
committed
Update rvalue_promotable_map
1 parent b8b4ad5 commit d56d2fb

File tree

5 files changed

+7
-9
lines changed

5 files changed

+7
-9
lines changed

src/librustc/arena.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ macro_rules! arena_types {
1717
[few] mir_keys: rustc::util::nodemap::DefIdSet,
1818
[decode] specialization_graph: rustc::traits::specialization_graph::Graph,
1919
[] region_scope_tree: rustc::middle::region::ScopeTree,
20+
[] item_local_set: rustc::util::nodemap::ItemLocalSet,
2021
], $tcx);
2122
)
2223
}

src/librustc/middle/expr_use_visitor.rs

Lines changed: 1 addition & 2 deletions
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

Lines changed: 2 additions & 3 deletions
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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ rustc_queries! {
504504
}
505505
cache { true }
506506
}
507-
query rvalue_promotable_map(key: DefId) -> Lrc<ItemLocalSet> {
507+
query rvalue_promotable_map(key: DefId) -> &'tcx ItemLocalSet {
508508
desc { |tcx|
509509
"checking which parts of `{}` are promotable to static",
510510
tcx.def_path_str(key)

src/librustc_passes/rvalue_promotion.rs

Lines changed: 2 additions & 3 deletions
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)