Skip to content

Commit 1321a2d

Browse files
committed
Also accept Refs for is_primitive_or_pointer
1 parent 7708abb commit 1321a2d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/librustc_lint/builtin.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2184,8 +2184,9 @@ impl ClashingExternDeclarations {
21842184
};
21852185

21862186
#[allow(rustc::usage_of_ty_tykind)]
2187-
let is_primitive_or_pointer =
2188-
|kind: &ty::TyKind<'_>| kind.is_primitive() || matches!(kind, RawPtr(..));
2187+
let is_primitive_or_pointer = |kind: &ty::TyKind<'_>| {
2188+
kind.is_primitive() || matches!(kind, RawPtr(..) | Ref(..))
2189+
};
21892190

21902191
match (a_kind, b_kind) {
21912192
(Adt(a_def, a_substs), Adt(b_def, b_substs)) => {
@@ -2274,8 +2275,8 @@ impl ClashingExternDeclarations {
22742275
// These definitely should have been caught above.
22752276
(Bool, Bool) | (Char, Char) | (Never, Never) | (Str, Str) => unreachable!(),
22762277

2277-
// An Adt and a primitive type. This can be FFI-safe is the ADT is an enum with a
2278-
// non-null field.
2278+
// An Adt and a primitive or pointer type. This can be FFI-safe if non-null
2279+
// enum layout optimisation is being applied.
22792280
(Adt(..), other_kind) | (other_kind, Adt(..))
22802281
if is_primitive_or_pointer(other_kind) =>
22812282
{

0 commit comments

Comments
 (0)