mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-21 22:34:05 +00:00
e2dc1a1c0f
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 |
||
---|---|---|
.. | ||
src | ||
Cargo.toml | ||
messages.ftl | ||
README.md |
For more information about how rustc works, see the rustc dev guide.