Skip to content

Commit 66b4e93

Browse files
Add instructions on what to do in case casts other than to integers is ever working for function pointers
1 parent d05f297 commit 66b4e93

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

compiler/rustc_lint/src/function_cast_as_integer.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ impl<'tcx> LateLintPass<'tcx> for FunctionCastsAsInteger {
3939
let hir::ExprKind::Cast(cast_from_expr, cast_to_expr) = expr.kind else { return };
4040
let cast_to_ty = cx.typeck_results().expr_ty(expr);
4141
// Casting to a function (pointer?), so all good.
42+
//
43+
// Normally, only casts to integers is possible, but if it ever changed, this condition
44+
// will likely need to be updated.
4245
if matches!(cast_to_ty.kind(), ty::FnDef(..) | ty::FnPtr(..) | ty::RawPtr(..)) {
4346
return;
4447
}

0 commit comments

Comments
 (0)