mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
Refactor msvc_enum_fallbck()
a bit
This commit is contained in:
parent
f6d2843d68
commit
9c3148235e
@ -367,6 +367,10 @@ pub fn push_debuginfo_type_name<'tcx>(
|
||||
) {
|
||||
let layout = tcx.layout_of(tcx.param_env(def.did).and(ty)).expect("layout error");
|
||||
|
||||
output.push_str("enum$<");
|
||||
push_item_name(tcx, def.did, true, output);
|
||||
push_generic_params_internal(tcx, substs, output, visited);
|
||||
|
||||
if let Variants::Multiple {
|
||||
tag_encoding: TagEncoding::Niche { dataful_variant, .. },
|
||||
tag,
|
||||
@ -386,30 +390,19 @@ pub fn push_debuginfo_type_name<'tcx>(
|
||||
let max = dataful_discriminant_range.end();
|
||||
let max = tag.value.size(&tcx).truncate(*max);
|
||||
|
||||
output.push_str("enum$<");
|
||||
push_item_name(tcx, def.did, true, output);
|
||||
push_generic_params_internal(tcx, substs, output, visited);
|
||||
|
||||
let dataful_variant_name = def.variants[*dataful_variant].ident.as_str();
|
||||
|
||||
output.push_str(&format!(", {}, {}, {}>", min, max, dataful_variant_name));
|
||||
} else {
|
||||
output.push_str("enum$<");
|
||||
push_item_name(tcx, def.did, true, output);
|
||||
push_generic_params_internal(tcx, substs, output, visited);
|
||||
output.push_str(&format!(", {}, {}, {}", min, max, dataful_variant_name));
|
||||
} else if let Variants::Single { index: variant_idx } = &layout.variants {
|
||||
// Uninhabited enums can't be constructed and should never need to be visualized so
|
||||
// skip this step for them.
|
||||
if def.variants.len() != 0 {
|
||||
let variant = def.variants[*variant_idx].ident.as_str();
|
||||
|
||||
if let Variants::Single { index: variant_idx } = &layout.variants {
|
||||
// Uninhabited enums can't be constructed and should never need to be visualized so
|
||||
// skip this step for them.
|
||||
if def.variants.len() != 0 {
|
||||
let variant = def.variants[*variant_idx].ident.as_str();
|
||||
|
||||
output.push_str(&format!(", {}", variant));
|
||||
}
|
||||
output.push_str(&format!(", {}", variant));
|
||||
}
|
||||
|
||||
push_close_angle_bracket(tcx, output);
|
||||
}
|
||||
push_close_angle_bracket(tcx, output);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user