Skip to content

Commit b09bb15

Browse files
Allow Downcast projections in qualify_min_const_fn
1 parent 25122d0 commit b09bb15

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/librustc_mir/transform/qualify_min_const_fn.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,10 @@ fn check_place(
266266
while let &[ref proj_base @ .., elem] = cursor {
267267
cursor = proj_base;
268268
match elem {
269-
ProjectionElem::Downcast(..) => {
270-
return Err((span, "`match` or `if let` in `const fn` is unstable".into()));
271-
}
269+
ProjectionElem::Downcast(..) if !tcx.features().const_if_match
270+
=> return Err((span, "`match` or `if let` in `const fn` is unstable".into())),
271+
ProjectionElem::Downcast(_symbol, _variant_index) => {}
272+
272273
ProjectionElem::Field(..) => {
273274
let base_ty = Place::ty_from(&place.base, &proj_base, body, tcx).ty;
274275
if let Some(def) = base_ty.ty_adt_def() {

0 commit comments

Comments
 (0)