Rollup merge of #66790 - christianpoveda:check-set-discriminant, r=oli-obk
Do `min_const_fn` checks for `SetDiscriminant`s target Fixes https://github.com/rust-lang/rust/issues/66556 r? @oli-obk @ecstatic-morse
This commit is contained in:
commit
75fd413e7b
2 changed files with 2 additions and 3 deletions
|
@ -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 {..} |
|
||||
|
|
|
@ -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()))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue