check_place(tcx, mir, location, span, PlaceMode::Read)?;
check_operand(tcx, mir, value, span)
},
- TerminatorKind::SwitchInt { .. } => Err((
+
+ TerminatorKind::FalseEdges { .. } | TerminatorKind::SwitchInt { .. } => Err((
span,
"`if`, `match`, `&&` and `||` are not stable in const fn".into(),
)),
cleanup: _,
} => check_operand(tcx, mir, cond, span),
- | TerminatorKind::FalseEdges { .. } | TerminatorKind::FalseUnwind { .. } => span_bug!(
+ | TerminatorKind::FalseUnwind { .. } => span_bug!(
terminator.source_info.span,
"min_const_fn encountered `{:#?}`",
terminator
--- /dev/null
+enum Foo {
+ Prob,
+}
+
+impl Foo {
+ pub const fn as_val(&self) -> u8 {
+ use self::Foo::*;
+
+ match *self {
+ Prob => 0x1, //~ ERROR `if`, `match`, `&&` and `||` are not stable in const fn
+ }
+ }
+}
+
+fn main() {}
--- /dev/null
+error: `if`, `match`, `&&` and `||` are not stable in const fn
+ --> $DIR/single_variant_match_ice.rs:10:13
+ |
+LL | Prob => 0x1, //~ ERROR `if`, `match`, `&&` and `||` are not stable in const fn
+ | ^^^^
+
+error: aborting due to previous error
+