mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-16 21:15:18 +03:00
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:
@@ -560,7 +560,7 @@ fn visit_statement(&mut self, statement: &Statement<'tcx>, location: Location) {
|
||||
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 @@ fn visit_statement(&mut self, statement: &Statement<'tcx>, location: 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()))
|
||||
|
||||
Reference in New Issue
Block a user