Tidy up drop glue notification

This combines the memory layout and drop information on one line,
and makes the wording more succinct.

Closes #19410
This commit is contained in:
Conrad Irwin 2025-03-22 22:05:26 -06:00
parent 3bf18d4eba
commit 498633ed97
2 changed files with 107 additions and 421 deletions

View file

@ -718,18 +718,17 @@ pub(super) fn definition(
} }
_ => return None, _ => return None,
}; };
let rendered_drop_glue = match drop_info.drop_glue { let rendered_drop_glue = if drop_info.has_dtor == Some(true) {
DropGlue::None => "does not contain types with destructors (drop glue)", "impl Drop"
DropGlue::DependOnParams => { } else {
"may contain types with destructors (drop glue) depending on type parameters" match drop_info.drop_glue {
DropGlue::HasDropGlue => "needs Drop",
DropGlue::None => "no Drop",
DropGlue::DependOnParams => "type param may need Drop",
} }
DropGlue::HasDropGlue => "contain types with destructors (drop glue)",
}; };
Some(match drop_info.has_dtor {
Some(true) => format!("{}; has a destructor", rendered_drop_glue), Some(rendered_drop_glue.to_owned())
Some(false) => format!("{}; doesn't have a destructor", rendered_drop_glue),
None => rendered_drop_glue.to_owned(),
})
}; };
let dyn_compatibility_info = || match def { let dyn_compatibility_info = || match def {
@ -761,15 +760,18 @@ pub(super) fn definition(
if let Some(layout_info) = layout_info() { if let Some(layout_info) = layout_info() {
extra.push_str("\n___\n"); extra.push_str("\n___\n");
extra.push_str(&layout_info); extra.push_str(&layout_info);
if let Some(drop_info) = drop_info() {
extra.push_str(", ");
extra.push_str(&drop_info)
}
} else if let Some(drop_info) = drop_info() {
extra.push_str("\n___\n");
extra.push_str(&drop_info);
} }
if let Some(dyn_compatibility_info) = dyn_compatibility_info() { if let Some(dyn_compatibility_info) = dyn_compatibility_info() {
extra.push_str("\n___\n"); extra.push_str("\n___\n");
extra.push_str(&dyn_compatibility_info); extra.push_str(&dyn_compatibility_info);
} }
if let Some(drop_info) = drop_info() {
extra.push_str("\n___\n");
extra.push_str(&drop_info);
}
} }
let mut desc = String::new(); let mut desc = String::new();
desc.push_str(&label); desc.push_str(&label);

File diff suppressed because it is too large Load diff