Skip to content

Commit

Permalink
Allow Downcast projections in qualify_min_const_fn
Browse files Browse the repository at this point in the history
  • Loading branch information
ecstatic-morse committed Nov 22, 2019
1 parent 25122d0 commit b09bb15
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/librustc_mir/transform/qualify_min_const_fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,10 @@ fn check_place(
while let &[ref proj_base @ .., elem] = cursor {
cursor = proj_base;
match elem {
ProjectionElem::Downcast(..) => {
return Err((span, "`match` or `if let` in `const fn` is unstable".into()));
}
ProjectionElem::Downcast(..) if !tcx.features().const_if_match
=> return Err((span, "`match` or `if let` in `const fn` is unstable".into())),
ProjectionElem::Downcast(_symbol, _variant_index) => {}

ProjectionElem::Field(..) => {
let base_ty = Place::ty_from(&place.base, &proj_base, body, tcx).ty;
if let Some(def) = base_ty.ty_adt_def() {
Expand Down

0 comments on commit b09bb15

Please sign in to comment.