diff --git a/clippy_utils/src/ty/mod.rs b/clippy_utils/src/ty/mod.rs index 260d1b801e3d..ef96c46aa4db 100644 --- a/clippy_utils/src/ty/mod.rs +++ b/clippy_utils/src/ty/mod.rs @@ -375,6 +375,7 @@ fn is_normalizable_helper<'tcx>( .iter() .all(|field| is_normalizable_helper(cx, param_env, field.ty(cx.tcx, args), cache)) }), + ty::RawPtr(..) => true, _ => ty.walk().all(|generic_arg| match generic_arg.unpack() { GenericArgKind::Type(inner_ty) if inner_ty != ty => { is_normalizable_helper(cx, param_env, inner_ty, cache) diff --git a/tests/ui/large_enum_variant.64bit.stderr b/tests/ui/large_enum_variant.64bit.stderr index a52967d962f7..a82374139887 100644 --- a/tests/ui/large_enum_variant.64bit.stderr +++ b/tests/ui/large_enum_variant.64bit.stderr @@ -283,14 +283,30 @@ LL | / enum WithRecursion { LL | | Large([u64; 64]), | | ---------------- the largest variant contains at least 512 bytes LL | | Recursive(Box), - | | ----------------------------- the second-largest variant contains at least 0 bytes + | | ----------------------------- the second-largest variant contains at least 8 bytes LL | | } - | |_^ the entire enum is at least 0 bytes + | |_^ the entire enum is at least 520 bytes | help: consider boxing the large fields to reduce the total size of the enum | LL | Large(Box<[u64; 64]>), | ~~~~~~~~~~~~~~ -error: aborting due to 17 previous errors +error: large size difference between variants + --> tests/ui/large_enum_variant.rs:168:1 + | +LL | / enum LargeEnumWithGenericsAndRecursive { +LL | | Ok(), + | | ---- the second-largest variant carries no data at all +LL | | Error(WithRecursionAndGenerics), + | | ------------------------------------ the largest variant contains at least 520 bytes +LL | | } + | |_^ the entire enum is at least 520 bytes + | +help: consider boxing the large fields to reduce the total size of the enum + | +LL | Error(Box>), + | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +error: aborting due to 18 previous errors