diff options
| author | Michael Goulet <michael@errs.io> | 2024-08-05 15:53:37 -0400 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2024-08-08 11:58:11 -0400 |
| commit | d9dd5509dcf56b22b6c1844ed3077f292e4a87bf (patch) | |
| tree | 18f92baeaa701a96bf4d56d47bde5e5570012e25 /compiler | |
| parent | 85b5e42d5e5d53b828a55bb01676bbdc495e5077 (diff) | |
Normalize when computing offset_of for slice tail
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs b/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs index 8c1aa66332f..841d25b54cc 100644 --- a/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs +++ b/compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs @@ -404,8 +404,17 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { code: traits::ObligationCauseCode<'tcx>, ) { if !ty.references_error() { - let tail = - self.tcx.struct_tail_with_normalize(ty, |ty| self.normalize(span, ty), || {}); + let tail = self.tcx.struct_tail_with_normalize( + ty, + |ty| { + if self.next_trait_solver() { + self.try_structurally_resolve_type(span, ty) + } else { + self.normalize(span, ty) + } + }, + || {}, + ); // Sized types have static alignment, and so do slices. if tail.is_trivially_sized(self.tcx) || matches!(tail.kind(), ty::Slice(..)) { // Nothing else is required here. |
