Skip to content

Commit 07e2dd7

Browse files
committed
Don't accidentally promote union access in MIR
1 parent c0aedc0 commit 07e2dd7

File tree

2 files changed

+1
-12
lines changed

2 files changed

+1
-12
lines changed

src/librustc_mir/transform/qualify_consts.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -515,7 +515,7 @@ impl<'a, 'tcx> Visitor<'tcx> for Qualifier<'a, 'tcx, 'tcx> {
515515
if let Some(def) = base_ty.ty_adt_def() {
516516
if def.is_union() {
517517
match this.mode {
518-
Mode::Fn => {},
518+
Mode::Fn => this.not_const(),
519519
Mode::ConstFn => {
520520
if !this.tcx.sess.features_untracked().const_fn_union {
521521
emit_feature_err(

src/test/ui/const-eval/union_promotion.nll.stderr

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)