X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=src%2Flibrustc_mir%2Ftransform%2Fqualify_min_const_fn.rs;h=f82e536ab254957b42968a7496c84f61f330605e;hb=2cfd6444a7fb4bd6acef2b97ba53059adc0500a6;hp=34f850fc4aad2a297e6e9913042e80666f9cd5a3;hpb=894141b57d5a0072eee07a4918db32bfc187e5bb;p=rust.git diff --git a/src/librustc_mir/transform/qualify_min_const_fn.rs b/src/librustc_mir/transform/qualify_min_const_fn.rs index 34f850fc4aa..f82e536ab25 100644 --- a/src/librustc_mir/transform/qualify_min_const_fn.rs +++ b/src/librustc_mir/transform/qualify_min_const_fn.rs @@ -152,6 +152,9 @@ fn check_rvalue( _ => check_operand(tcx, mir, operand, span), } } + Rvalue::Cast(CastKind::MutToConstPointer, operand, _) => { + check_operand(tcx, mir, operand, span) + } Rvalue::Cast(CastKind::UnsafeFnPointer, _, _) | Rvalue::Cast(CastKind::ClosureFnPointer, _, _) | Rvalue::Cast(CastKind::ReifyFnPointer, _, _) => Err(( @@ -252,10 +255,11 @@ fn check_place( span: Span, ) -> McfResult { match place { - Place::Local(_) => Ok(()), + Place::Base(PlaceBase::Local(_)) => Ok(()), // promoteds are always fine, they are essentially constants - Place::Promoted(_) => Ok(()), - Place::Static(_) => Err((span, "cannot access `static` items in const fn".into())), + Place::Base(PlaceBase::Promoted(_)) => Ok(()), + Place::Base(PlaceBase::Static(_)) => + Err((span, "cannot access `static` items in const fn".into())), Place::Projection(proj) => { match proj.elem { | ProjectionElem::ConstantIndex { .. } | ProjectionElem::Subslice { .. }