Check SetDiscriminant place
This commit is contained in:
parent
91642e3ac0
commit
c66ad14057
2 changed files with 5 additions and 2 deletions
|
@ -566,9 +566,12 @@ impl Visitor<'tcx> for Validator<'_, 'mir, 'tcx> {
|
|||
StatementKind::FakeRead(FakeReadCause::ForMatchedPlace, _) => {
|
||||
self.check_op(ops::IfOrMatch);
|
||||
}
|
||||
StatementKind::SetDiscriminant { ref place, .. } => {
|
||||
let ctx = PlaceContext::MutatingUse(MutatingUseContext::Projection);
|
||||
self.visit_place(&place, ctx, location)
|
||||
}
|
||||
// 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