Skip to content

Commit

Permalink
be even more precise about "cast" vs "coercion"
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukas Markeffsky committed Sep 24, 2024
1 parent d802a7a commit 08a8e68
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions clippy_utils/src/qualify_min_const_fn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,20 +123,20 @@ fn check_rvalue<'tcx>(
| CastKind::FloatToFloat
| CastKind::FnPtrToPtr
| CastKind::PtrToPtr
| CastKind::PointerCoercion(PointerCoercion::MutToConstPointer | PointerCoercion::ArrayToPointer),
| CastKind::PointerCoercion(PointerCoercion::MutToConstPointer | PointerCoercion::ArrayToPointer, _),
operand,
_,
) => check_operand(tcx, operand, span, body, msrv),
Rvalue::Cast(
CastKind::PointerCoercion(
PointerCoercion::UnsafeFnPointer
| PointerCoercion::ClosureFnPointer(_)
| PointerCoercion::ReifyFnPointer,
| PointerCoercion::ReifyFnPointer, _
),
_,
_,
) => Err((span, "function pointer casts are not allowed in const fn".into())),
Rvalue::Cast(CastKind::PointerCoercion(PointerCoercion::Unsize), op, cast_ty) => {
Rvalue::Cast(CastKind::PointerCoercion(PointerCoercion::Unsize, _), op, cast_ty) => {
let Some(pointee_ty) = cast_ty.builtin_deref(true) else {
// We cannot allow this for now.
return Err((span, "unsizing casts are only allowed for references right now".into()));
Expand All @@ -154,7 +154,7 @@ fn check_rvalue<'tcx>(
Rvalue::Cast(CastKind::PointerExposeProvenance, _, _) => {
Err((span, "casting pointers to ints is unstable in const fn".into()))
},
Rvalue::Cast(CastKind::PointerCoercion(PointerCoercion::DynStar), _, _) => {
Rvalue::Cast(CastKind::PointerCoercion(PointerCoercion::DynStar, _), _, _) => {
// FIXME(dyn-star)
unimplemented!()
},
Expand Down

0 comments on commit 08a8e68

Please sign in to comment.