mirror of
https://github.com/rust-lang/rust.git
synced 2026-04-28 03:07:24 +03:00
Add instructions on what to do in case casts other than to integers is ever working for function pointers
This commit is contained in:
@@ -39,6 +39,9 @@ fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx hir::Expr<'tcx>) {
|
||||
let hir::ExprKind::Cast(cast_from_expr, cast_to_expr) = expr.kind else { return };
|
||||
let cast_to_ty = cx.typeck_results().expr_ty(expr);
|
||||
// Casting to a function (pointer?), so all good.
|
||||
//
|
||||
// Normally, only casts to integers is possible, but if it ever changed, this condition
|
||||
// will likely need to be updated.
|
||||
if matches!(cast_to_ty.kind(), ty::FnDef(..) | ty::FnPtr(..) | ty::RawPtr(..)) {
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user