Rollup merge of #133681 - RalfJung:niches, r=wesleywiser
improve TagEncoding::Niche docs, sanity check, and UB checks Turns out the `niche_variants` range can actually contain the `untagged_variant`. We should report this as UB in Miri, so this PR implements that. Also rename `partially_check_layout` to `layout_sanity_check` for better consistency with how similar functions are called in other parts of the compiler. Turns out my adjustments to the transmutation logic also fix https://github.com/rust-lang/rust/issues/126267.
This commit is contained in:
commit
6e87eb58ed
13 changed files with 177 additions and 92 deletions
|
@ -1081,6 +1081,8 @@ rustc_queries! {
|
|||
}
|
||||
|
||||
/// Computes the tag (if any) for a given type and variant.
|
||||
/// `None` means that the variant doesn't need a tag (because it is niched).
|
||||
/// Will panic for uninhabited variants.
|
||||
query tag_for_variant(
|
||||
key: (Ty<'tcx>, abi::VariantIdx)
|
||||
) -> Option<ty::ScalarInt> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue