about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-08-09 11:36:01 +0000
committerbors <bors@rust-lang.org>2024-08-09 11:36:01 +0000
commit7591ec4e88f449cf27701c125a1a183dec2225af (patch)
tree57814652afa1687434cc2aa465790783cd44d4e6
parent1ac76a2062b94b72c36650d21ac1af40b4aea0e3 (diff)
parent6ce7e6d99f8bc97375f70331204c78f6438e7495 (diff)
downloadrust-7591ec4e88f449cf27701c125a1a183dec2225af.tar.gz
rust-7591ec4e88f449cf27701c125a1a183dec2225af.zip
Auto merge of #128703 - compiler-errors:normalizing-tails, r=lcnr
Miscellaneous improvements to struct tail normalization

1. Make checks for foreign tails more accurate by normalizing the struct tail. I didn't write a test for this one.
2. Normalize when computing struct tail for `offset_of` for slice/str. This fixes the new solver only.
3. Normalizing when computing tails for disaligned reference check. This fixes both solvers.

r? lcnr
-rw-r--r--clippy_utils/src/qualify_min_const_fn.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/clippy_utils/src/qualify_min_const_fn.rs b/clippy_utils/src/qualify_min_const_fn.rs
index f206b2ceebc..553af913ef9 100644
--- a/clippy_utils/src/qualify_min_const_fn.rs
+++ b/clippy_utils/src/qualify_min_const_fn.rs
@@ -142,7 +142,7 @@ fn check_rvalue<'tcx>(
                 // We cannot allow this for now.
                 return Err((span, "unsizing casts are only allowed for references right now".into()));
             };
-            let unsized_ty = tcx.struct_tail_erasing_lifetimes(pointee_ty, tcx.param_env(def_id));
+            let unsized_ty = tcx.struct_tail_for_codegen(pointee_ty, tcx.param_env(def_id));
             if let ty::Slice(_) | ty::Str = unsized_ty.kind() {
                 check_operand(tcx, op, span, body, msrv)?;
                 // Casting/coercing things to slices is fine.