Skip to content

Commit 4f98e94

Browse files
committed
ignore const/static items
1 parent 0a91619 commit 4f98e94

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

compiler/rustc_mir_transform/src/promote_consts_local_arrays.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,15 @@ impl<'tcx> MirPass<'tcx> for PromoteArraysOpt<'tcx> {
7272
return;
7373
}
7474

75+
// Ignore static/const items. Already processed by PromoteTemps
76+
if let Some(ctx) = tcx.hir().body_const_context(body.source.def_id()) {
77+
use hir::ConstContext::*;
78+
match ctx {
79+
Static(_) | Const {inline: _ } => return,
80+
_ => {}
81+
}
82+
}
83+
7584
let ccx = ConstCx::new(tcx, body);
7685
let (mut temps, all_candidates, already_promoted) = collect_temps_and_candidates(&ccx);
7786

0 commit comments

Comments
 (0)