bors e2dc1a1c0f 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
2024-09-17 01:17:48 +00:00
..
2024-04-26 17:20:16 +02:00
2024-04-18 18:55:20 +02:00
2024-04-19 23:09:37 +02:00
2024-04-19 23:09:37 +02:00
2024-04-19 23:09:37 +02:00
2024-04-18 18:55:20 +02:00
2024-04-18 18:55:20 +02:00
2024-04-18 18:55:20 +02:00
2024-04-18 06:13:47 +02:00
2024-04-18 06:13:47 +02:00
2024-04-18 06:13:47 +02:00
2024-04-18 18:55:20 +02:00
2024-04-19 23:09:37 +02:00
2024-04-19 23:09:37 +02:00
2024-04-18 18:55:20 +02:00
2024-04-18 18:55:20 +02:00
2024-06-30 17:08:45 +00:00
2024-04-18 18:55:20 +02:00
2024-04-18 18:55:20 +02:00
2024-04-18 06:13:47 +02:00
2024-04-18 18:55:20 +02:00
2024-04-18 18:55:20 +02:00
2024-05-29 17:06:54 +01:00
2024-04-18 18:55:20 +02:00
2024-04-18 18:55:20 +02:00
2024-05-29 17:06:54 +01:00
2024-04-18 06:13:47 +02:00
2024-09-01 22:28:23 +02:00
2024-04-18 06:13:47 +02:00
2024-04-18 06:13:47 +02:00
2024-04-21 21:04:32 +02:00
2024-04-18 06:13:47 +02:00
2024-04-18 06:13:47 +02:00
2024-04-18 06:13:47 +02:00
2024-04-21 21:04:32 +02:00
2024-04-21 21:04:32 +02:00
2024-04-26 17:20:16 +02:00
2024-04-26 17:20:16 +02:00
2024-04-26 17:20:16 +02:00
2024-04-26 17:20:16 +02:00
2024-05-18 23:56:57 +02:00
2024-05-18 23:56:57 +02:00
2024-06-28 14:20:43 -04:00
2024-06-09 10:16:12 +02:00
2024-06-09 10:16:12 +02:00
2024-06-09 10:16:12 +02:00
2024-06-09 10:16:12 +02:00
2024-06-09 10:16:12 +02:00
2024-06-09 10:16:12 +02:00
2024-06-09 10:16:12 +02:00
2024-06-09 10:16:12 +02:00
2024-06-09 10:16:12 +02:00
2024-06-09 10:16:12 +02:00
2024-06-09 10:16:12 +02:00
2024-06-09 10:16:12 +02:00
2024-06-09 10:16:12 +02:00
2024-06-16 20:38:08 +02:00
2024-06-16 20:38:08 +02:00
2024-06-16 20:38:08 +02:00
2024-06-29 09:33:28 +02:00
2024-06-29 09:33:28 +02:00
2024-06-29 09:33:28 +02:00
2024-06-29 09:33:28 +02:00
2024-06-29 09:33:28 +02:00
2024-06-29 09:33:28 +02:00
2024-07-04 23:44:10 +02:00
2024-07-04 23:44:10 +02:00
2024-07-04 23:44:10 +02:00
2024-07-04 23:44:10 +02:00
2024-09-01 22:28:23 +02:00
2024-07-21 17:50:57 +02:00
2024-07-21 17:50:57 +02:00
2024-07-21 17:50:57 +02:00
2024-07-21 17:50:57 +02:00
2024-07-21 17:50:57 +02:00
2024-07-21 17:50:57 +02:00
2024-07-21 17:50:57 +02:00
2024-07-21 17:50:57 +02:00
2024-08-04 21:25:49 +02:00
2024-08-04 21:25:49 +02:00
2024-08-04 21:25:49 +02:00
2024-08-04 21:25:49 +02:00
2024-08-04 21:25:49 +02:00
2024-08-15 22:44:16 +02:00
2024-08-15 22:44:16 +02:00
2024-08-15 22:44:16 +02:00
2024-08-15 22:44:16 +02:00
2024-08-15 22:44:16 +02:00
2024-08-15 22:44:16 +02:00
2024-08-15 22:44:16 +02:00
2024-08-19 00:38:28 +02:00
2024-08-19 00:38:28 +02:00
2024-08-19 00:38:28 +02:00
2024-08-19 00:38:28 +02:00
2024-09-01 22:28:23 +02:00
2024-08-30 12:38:22 +02:00
2024-08-30 12:38:22 +02:00
2024-08-30 12:38:22 +02:00
2024-08-30 12:38:22 +02:00
2024-09-15 21:18:41 +02:00
2024-09-15 21:18:41 +02:00
2024-09-15 21:18:41 +02:00

This is serves as a collection of crashes so that accidental ICE fixes are tracked. This was formally done at https://github.com/rust-lang/glacier but doing it inside the rustc testsuite is more convenient.

It is imperative that a test in the suite causes an internal compiler error/panic or makes rustc crash in some other way. A test will "pass" if rustc exits with something other than 1 or 0.

When adding crashes from https://github.com/rust-lang/rust/issues, the issue number should be noted in the file name (12345.rs should suffice) and perhaps also inside the file via //@ known-bug #4321

If you happen to fix one of the crashes, please move it to a fitting subdirectory in tests/ui and give it a meaningful name. Also please add a doc comment at the top of the file explaining why this test exists. :) Adding Fixes #NNNNN Fixes #MMMMM to the description of your pull request will ensure the corresponding tickets will be closed automatically upon merge. The ticket ids can be found in the file name or the known-bug annotation inside the testfile.