rust/tests
Matthias Krüger ba6982b8a0
Rollup merge of #114060 - davidtwco:issue-113279, r=wesleywiser
abi: unsized field in union - assert to delay bug

Fixes #113279.

> Unions cannot have unsized fields, and as such, layout computation for
unions asserts that each union field is sized (as this would normally
have halted compilation earlier).
>
> However, if a generator ends up with an unsized local - a circumstance
in which an error will always have been emitted earlier, for example, if
attempting to dereference a `&str` - then the generator transform will
produce a union with an unsized field.
>
> Since https://github.com/rust-lang/rust/pull/110107, later passes will be run, such as constant propagation,
and can attempt layout computation on the generator, which will result
in layout computation of `str` in the context of it being a field of a
union - and so the aforementioned assertion would cause an ICE.
>
> It didn't seem appropriate to try and detect this case in the MIR body
and skip this specific pass; tainting the MIR body or delaying a bug
from the generator transform (or elsewhere) wouldn't prevent this either
(as neither would prevent the later pass from running); and tainting when
the deref of `&str` is reported, if that's possible, would unnecessarily
prevent potential other errors from being reported later in compilation,
and is very tailored to this specific case of getting a unsized type in
a generator.
>
> Given that this circumstance can only happen when an error should have
already been reported, the correct fix appears to be just changing the
assert to a delayed bug. This will still assert if there is some
circumstance where this occurs and no error has been reported, but it
won't crash the compiler in this instance.

While debugging this, I noticed a translation ICE in a delayed bug, so I fixed that too:

> During borrowck, the `MultiSpan` from a buffered diagnostic is cloned and
used to emit a delayed bug indicating a diagnostic was buffered - when
the buffered diagnostic is translated, then the cloned `MultiSpan` may
contain labels which can only render with the diagnostic's arguments, but
the delayed bug being emitted won't have those arguments. Adds a function
which clones `MultiSpan` without also cloning the contained labels, and
use this function when creating the buffered diagnostic delayed bug.
2023-07-25 19:21:39 +02:00
..
assembly test-various: run codegen and assembly tests 2023-07-02 02:22:22 +02:00
auxiliary
codegen Auto merge of #111836 - calebzulawski:target-feature-closure, r=workingjubilee 2023-07-23 00:16:03 +00:00
codegen-units
debuginfo Update natvis to match full type names for Arc, Rc, Weak, etc 2023-07-17 15:51:46 -04:00
incremental Querify unused trait check. 2023-07-16 21:51:00 +00:00
mir-opt Auto merge of #114011 - RalfJung:place-projection, r=oli-obk 2023-07-25 14:18:08 +00:00
pretty
run-coverage refactor(rustc_middle): Substs -> GenericArg 2023-07-14 13:27:35 +01:00
run-coverage-rustdoc Re-bless the newly-migrated tests 2023-06-28 11:09:19 +10:00
run-make Support .comment section like GCC/Clang (!llvm.ident) 2023-07-21 22:01:50 +02:00
run-make-fulldeps On nightly, dump ICE backtraces to disk 2023-07-19 14:10:07 +00:00
run-pass-valgrind
rustdoc Auto merge of #113958 - lukas-code:doc-links, r=GuillaumeGomez,petrochenkov 2023-07-25 01:35:53 +00:00
rustdoc-gui Migrate GUI colors test to original CSS color format 2023-07-23 13:05:40 +02:00
rustdoc-js Auto merge of #112233 - notriddle:notriddle/search-unify, r=GuillaumeGomez 2023-06-15 03:04:46 +00:00
rustdoc-js-std Auto merge of #108537 - GuillaumeGomez:rustdoc-search-whitespace-as-separator, r=notriddle 2023-07-02 18:49:29 +00:00
rustdoc-json Auto merge of #113574 - GuillaumeGomez:rustdoc-json-strip-hidden-impl, r=aDotInTheVoid,notriddle 2023-07-18 02:47:03 +00:00
rustdoc-ui validate doc(masked) 2023-07-24 18:04:35 +02:00
ui Rollup merge of #114060 - davidtwco:issue-113279, r=wesleywiser 2023-07-25 19:21:39 +02:00
ui-fulldeps Rollup merge of #113373 - jyn514:download-rustc-fixes, r=albertlarsan68 2023-07-11 21:00:27 -07:00
COMPILER_TESTS.md