Skip to content

Commit 87df978

Browse files
Add TyKind::TyAlias support in rustc_lint
1 parent 5ea1e63 commit 87df978

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

compiler/rustc_lint/src/types.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,6 +1134,19 @@ impl<'a, 'tcx> ImproperCTypesVisitor<'a, 'tcx> {
11341134
FfiSafe
11351135
}
11361136

1137+
ty::TyAlias(def_id, substs) => {
1138+
for ty in substs.types() {
1139+
let ty = self.cx.tcx.normalize_erasing_regions(self.cx.param_env, ty);
1140+
match self.check_type_for_ffi(cache, ty) {
1141+
FfiSafe => {}
1142+
r => return r,
1143+
};
1144+
}
1145+
let ty = tcx.type_of(def_id);
1146+
let ty = self.cx.tcx.normalize_erasing_regions(self.cx.param_env, ty);
1147+
self.check_type_for_ffi(cache, ty)
1148+
}
1149+
11371150
ty::Foreign(..) => FfiSafe,
11381151

11391152
// While opaque types are checked for earlier, if a projection in a struct field

0 commit comments

Comments
 (0)