improper_ctypes: only allow params in defns mode
This commit adjusts the behaviour introduced in a previous commit so that generic parameters and projections are only allowed in the definitions mode - and are otherwise a bug. Generic parameters in declarations are prohibited earlier in the compiler, so if that branch were reached, it would be a bug. Signed-off-by: David Wood <david@davidtw.co>
This commit is contained in:
parent
5c8634805c
commit
4504648090
@ -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(..)
|
||||
|
Loading…
x
Reference in New Issue
Block a user