diff --git a/src/librustc_mir/transform/check_consts/validation.rs b/src/librustc_mir/transform/check_consts/validation.rs index bee37f69a5ec5..829d9ee6fafd7 100644 --- a/src/librustc_mir/transform/check_consts/validation.rs +++ b/src/librustc_mir/transform/check_consts/validation.rs @@ -560,7 +560,7 @@ impl Visitor<'tcx> for Validator<'_, 'mir, 'tcx> { trace!("visit_statement: statement={:?} location={:?}", statement, location); match statement.kind { - StatementKind::Assign(..) => { + StatementKind::Assign(..) | StatementKind::SetDiscriminant { .. } => { self.super_statement(statement, location); } StatementKind::FakeRead(FakeReadCause::ForMatchedPlace, _) => { @@ -568,7 +568,6 @@ impl Visitor<'tcx> for Validator<'_, 'mir, 'tcx> { } // FIXME(eddyb) should these really do nothing? StatementKind::FakeRead(..) | - StatementKind::SetDiscriminant { .. } | StatementKind::StorageLive(_) | StatementKind::StorageDead(_) | StatementKind::InlineAsm {..} | diff --git a/src/librustc_mir/transform/qualify_min_const_fn.rs b/src/librustc_mir/transform/qualify_min_const_fn.rs index 81f4c277f4d76..e40d6a5952edb 100644 --- a/src/librustc_mir/transform/qualify_min_const_fn.rs +++ b/src/librustc_mir/transform/qualify_min_const_fn.rs @@ -225,7 +225,7 @@ fn check_statement( StatementKind::FakeRead(_, place) => check_place(tcx, place, span, def_id, body), // just an assignment - StatementKind::SetDiscriminant { .. } => Ok(()), + StatementKind::SetDiscriminant { place, .. } => check_place(tcx, place, span, def_id, body), | StatementKind::InlineAsm { .. } => { Err((span, "cannot use inline assembly in const fn".into()))