};
}
-fn const_is_rvalue_promotable_to_static<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
- def_id: DefId)
- -> bool
-{
+fn const_is_rvalue_promotable_to_static<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> bool {
assert!(def_id.is_local());
let hir_id = tcx.hir().as_local_hir_id(def_id)
tcx.rvalue_promotable_map(def_id).contains(&body_id.hir_id.local_id)
}
-fn rvalue_promotable_map<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
- def_id: DefId)
- -> &'tcx ItemLocalSet
-{
+fn rvalue_promotable_map<'tcx>(tcx: TyCtxt<'tcx, 'tcx>, def_id: DefId) -> &'tcx ItemLocalSet {
let outer_def_id = tcx.closure_base_def_id(def_id);
if outer_def_id != def_id {
return tcx.rvalue_promotable_map(outer_def_id);
}
struct CheckCrateVisitor<'a, 'tcx: 'a> {
- tcx: TyCtxt<'a, 'tcx, 'tcx>,
+ tcx: TyCtxt<'tcx, 'tcx>,
in_fn: bool,
in_static: bool,
mut_rvalue_borrows: HirIdSet,
let param_env = self.param_env;
let region_scope_tree = self.tcx.region_scope_tree(item_def_id);
let tables = self.tables;
- euv::ExprUseVisitor::new(self, tcx, param_env, ®ion_scope_tree, tables, None)
- .consume_body(body);
+ euv::ExprUseVisitor::new(
+ self,
+ tcx,
+ item_def_id,
+ param_env,
+ ®ion_scope_tree,
+ tables,
+ None,
+ ).consume_body(body);
let body_promotable = self.check_expr(&body.value);
self.in_fn = outer_in_fn;
}
Res::Def(DefKind::Const, did) |
- Res::Def(DefKind::AssociatedConst, did) => {
+ Res::Def(DefKind::AssocConst, did) => {
let promotable = if v.tcx.trait_of_item(did).is_some() {
// Don't peek inside trait associated constants.
NotPromotable