diff --git a/src/librustc_lint/types.rs b/src/librustc_lint/types.rs index cce6a40c23a2b..cfafb86fbedb1 100644 --- a/src/librustc_lint/types.rs +++ b/src/librustc_lint/types.rs @@ -878,9 +878,15 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> { // `extern "C" fn` functions can have type parameters, which may or may not be FFI-safe, // so they are currently ignored for the purposes of this lint. - ty::Param(..) | ty::Projection(..) => FfiSafe, + ty::Param(..) | ty::Projection(..) + if matches!(self.mode, ImproperCTypesMode::Definitions) => + { + FfiSafe + } - ty::Infer(..) + ty::Param(..) + | ty::Projection(..) + | ty::Infer(..) | ty::Bound(..) | ty::Error(_) | ty::Closure(..)