Skip to content

Commit 2d4d423

Browse files
committed
Update rvalue_promotable_map
1 parent 9ff7b73 commit 2d4d423

File tree

4 files changed

+6
-9
lines changed

4 files changed

+6
-9
lines changed

src/librustc/middle/expr_use_visitor.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ use middle::region;
2727
use ty::{self, TyCtxt, adjustment};
2828

2929
use hir::{self, PatKind};
30-
use rustc_data_structures::sync::Lrc;
3130
use std::rc::Rc;
3231
use syntax::ast;
3332
use syntax::ptr::P;
@@ -280,7 +279,7 @@ impl<'a, 'tcx> ExprUseVisitor<'a, 'tcx, 'tcx> {
280279
param_env: ty::ParamEnv<'tcx>,
281280
region_scope_tree: &'a region::ScopeTree,
282281
tables: &'a ty::TypeckTables<'tcx>,
283-
rvalue_promotable_map: Option<Lrc<ItemLocalSet>>)
282+
rvalue_promotable_map: Option<&'tcx ItemLocalSet>)
284283
-> Self
285284
{
286285
ExprUseVisitor {

src/librustc/middle/mem_categorization.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ use syntax_pos::Span;
8787
use std::borrow::Cow;
8888
use std::fmt;
8989
use std::hash::{Hash, Hasher};
90-
use rustc_data_structures::sync::Lrc;
9190
use rustc_data_structures::indexed_vec::Idx;
9291
use std::rc::Rc;
9392
use util::nodemap::ItemLocalSet;
@@ -300,7 +299,7 @@ pub struct MemCategorizationContext<'a, 'gcx: 'a+'tcx, 'tcx: 'a> {
300299
pub tcx: TyCtxt<'a, 'gcx, 'tcx>,
301300
pub region_scope_tree: &'a region::ScopeTree,
302301
pub tables: &'a ty::TypeckTables<'tcx>,
303-
rvalue_promotable_map: Option<Lrc<ItemLocalSet>>,
302+
rvalue_promotable_map: Option<&'tcx ItemLocalSet>,
304303
infcx: Option<&'a InferCtxt<'a, 'gcx, 'tcx>>,
305304
}
306305

@@ -410,7 +409,7 @@ impl<'a, 'tcx> MemCategorizationContext<'a, 'tcx, 'tcx> {
410409
pub fn new(tcx: TyCtxt<'a, 'tcx, 'tcx>,
411410
region_scope_tree: &'a region::ScopeTree,
412411
tables: &'a ty::TypeckTables<'tcx>,
413-
rvalue_promotable_map: Option<Lrc<ItemLocalSet>>)
412+
rvalue_promotable_map: Option<&'tcx ItemLocalSet>)
414413
-> MemCategorizationContext<'a, 'tcx, 'tcx> {
415414
MemCategorizationContext {
416415
tcx,

src/librustc/ty/query/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ define_queries! { <'tcx>
359359
TypeChecking {
360360
[] fn trait_of_item: TraitOfItem(DefId) -> Option<DefId>,
361361
[] fn const_is_rvalue_promotable_to_static: ConstIsRvaluePromotableToStatic(DefId) -> bool,
362-
[] fn rvalue_promotable_map: RvaluePromotableMap(DefId) -> Lrc<ItemLocalSet>,
362+
[] fn rvalue_promotable_map: RvaluePromotableMap(DefId) -> &'tcx ItemLocalSet,
363363
},
364364

365365
Codegen {

src/librustc_passes/rvalue_promotion.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ use rustc::ty::query::Providers;
3535
use rustc::ty::subst::Substs;
3636
use rustc::util::nodemap::{ItemLocalSet, NodeSet};
3737
use rustc::hir;
38-
use rustc_data_structures::sync::Lrc;
3938
use syntax::ast;
4039
use syntax_pos::{Span, DUMMY_SP};
4140
use self::Promotability::*;
@@ -72,7 +71,7 @@ fn const_is_rvalue_promotable_to_static<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
7271

7372
fn rvalue_promotable_map<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
7473
def_id: DefId)
75-
-> Lrc<ItemLocalSet>
74+
-> &'tcx ItemLocalSet
7675
{
7776
let outer_def_id = tcx.closure_base_def_id(def_id);
7877
if outer_def_id != def_id {
@@ -96,7 +95,7 @@ fn rvalue_promotable_map<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
9695
let body_id = tcx.hir.body_owned_by(node_id);
9796
let _ = visitor.check_nested_body(body_id);
9897

99-
Lrc::new(visitor.result)
98+
tcx.promote(visitor.result)
10099
}
101100

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

0 commit comments

Comments
 (0)