about summary refs log tree commit diff
path: root/compiler/rustc_mir_transform/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-09-17 01:17:48 +0000
committerbors <bors@rust-lang.org>2024-09-17 01:17:48 +0000
commite2dc1a1c0f97a90319181a721ab317210307617a (patch)
treedc5683c3bbaed22bba415bb91c24621365aa1f3a /compiler/rustc_mir_transform/src
parentbde6bf2b07b61f7da92c211d2b4a897ea4620e1b (diff)
parent20d241492590a83eb0946ce4414255e25d2112b8 (diff)
downloadrust-e2dc1a1c0f97a90319181a721ab317210307617a.tar.gz
rust-e2dc1a1c0f97a90319181a721ab317210307617a.zip
Auto merge of #129970 - lukas-code:LayoutCalculator, r=compiler-errors
layout computation: gracefully handle unsized types in unexpected locations

This PR reworks the layout computation to eagerly return an error when encountering an unsized field where a sized field was expected, rather than delaying a bug and attempting to recover a layout. This is required, because with trivially false where clauses like `[T]: Sized`, any field can possible be an unsized type, without causing a compile error.

Since this PR removes the `delayed_bug` method from the `LayoutCalculator` trait, it essentially becomes the same as the `HasDataLayout` trait, so I've also refactored the `LayoutCalculator` to be a simple wrapper struct around a type that implements `HasDataLayout`.

The majority of the diff is whitespace changes, so viewing with whitespace ignored is advised.

implements https://github.com/rust-lang/rust/pull/123169#issuecomment-2025788480

r? `@compiler-errors` or compiler

fixes https://github.com/rust-lang/rust/issues/123134
fixes https://github.com/rust-lang/rust/issues/124182
fixes https://github.com/rust-lang/rust/issues/126939
fixes https://github.com/rust-lang/rust/issues/127737
Diffstat (limited to 'compiler/rustc_mir_transform/src')
0 files changed, 0 insertions, 0 deletions