Tidy up drop glue notification
This combines the memory layout and drop information on one line,
and makes the wording more succinct.
Closes #19410
diff --git a/crates/ide/src/hover/render.rs b/crates/ide/src/hover/render.rs
index a4cb869a..7bb8800 100644
--- a/crates/ide/src/hover/render.rs
+++ b/crates/ide/src/hover/render.rs
@@ -718,18 +718,17 @@
}
_ => return None,
};
- let rendered_drop_glue = match drop_info.drop_glue {
- DropGlue::None => "does not contain types with destructors (drop glue)",
- DropGlue::DependOnParams => {
- "may contain types with destructors (drop glue) depending on type parameters"
+ let rendered_drop_glue = if drop_info.has_dtor == Some(true) {
+ "impl Drop"
+ } else {
+ 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(false) => format!("{}; doesn't have a destructor", rendered_drop_glue),
- None => rendered_drop_glue.to_owned(),
- })
+
+ Some(rendered_drop_glue.to_owned())
};
let dyn_compatibility_info = || match def {
@@ -761,15 +760,18 @@
if let Some(layout_info) = layout_info() {
extra.push_str("\n___\n");
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() {
extra.push_str("\n___\n");
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();
desc.push_str(&label);
diff --git a/crates/ide/src/hover/tests.rs b/crates/ide/src/hover/tests.rs
index c5f8791..a325862 100644
--- a/crates/ide/src/hover/tests.rs
+++ b/crates/ide/src/hover/tests.rs
@@ -567,11 +567,7 @@
---
- size = 8, align = 4
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 8, align = 4, no Drop
"#]],
);
}
@@ -816,11 +812,7 @@
---
- size = 1, align = 1, offset = 6
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 1, align = 1, offset = 6, no Drop
"#]],
);
}
@@ -871,11 +863,7 @@
---
- size = 4, align = 4, offset = 0
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 4, align = 4, offset = 0, no Drop
"#]],
);
}
@@ -945,11 +933,7 @@
---
- size = 4, align = 4
-
- ---
-
- does not contain types with destructors (drop glue); doesn't have a destructor
+ size = 4, align = 4, no Drop
"#]],
);
}
@@ -975,11 +959,7 @@
---
- size = 4, align = 4
-
- ---
-
- does not contain types with destructors (drop glue); doesn't have a destructor
+ size = 4, align = 4, no Drop
"#]],
);
check(
@@ -1004,11 +984,7 @@
---
- size = 4, align = 4
-
- ---
-
- does not contain types with destructors (drop glue); doesn't have a destructor
+ size = 4, align = 4, no Drop
"#]],
);
}
@@ -1037,11 +1013,7 @@
---
- size = 12 (0xC), align = 4
-
- ---
-
- does not contain types with destructors (drop glue); doesn't have a destructor
+ size = 12 (0xC), align = 4, no Drop
"#]],
);
check_hover_fields_limit(
@@ -1064,11 +1036,7 @@
---
- size = 4, align = 4
-
- ---
-
- does not contain types with destructors (drop glue); doesn't have a destructor
+ size = 4, align = 4, no Drop
"#]],
);
check_hover_fields_limit(
@@ -1094,11 +1062,7 @@
---
- size = 16 (0x10), align = 4
-
- ---
-
- does not contain types with destructors (drop glue); doesn't have a destructor
+ size = 16 (0x10), align = 4, no Drop
"#]],
);
check_hover_fields_limit(
@@ -1119,11 +1083,7 @@
---
- size = 12 (0xC), align = 4
-
- ---
-
- does not contain types with destructors (drop glue); doesn't have a destructor
+ size = 12 (0xC), align = 4, no Drop
"#]],
);
check_hover_fields_limit(
@@ -1144,11 +1104,7 @@
---
- size = 12 (0xC), align = 4
-
- ---
-
- does not contain types with destructors (drop glue); doesn't have a destructor
+ size = 12 (0xC), align = 4, no Drop
"#]],
);
@@ -1171,11 +1127,7 @@
---
- size = 0, align = 1
-
- ---
-
- does not contain types with destructors (drop glue); doesn't have a destructor
+ size = 0, align = 1, no Drop
"#]],
);
}
@@ -1200,11 +1152,7 @@
---
- size = 12 (0xC), align = 4
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 12 (0xC), align = 4, no Drop
"#]],
);
check_hover_fields_limit(
@@ -1225,11 +1173,7 @@
---
- size = 4, align = 4
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 4, align = 4, no Drop
"#]],
);
check_hover_fields_limit(
@@ -1250,11 +1194,7 @@
---
- size = 16 (0x10), align = 4
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 16 (0x10), align = 4, no Drop
"#]],
);
check_hover_fields_limit(
@@ -1275,11 +1215,7 @@
---
- size = 12 (0xC), align = 4
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 12 (0xC), align = 4, no Drop
"#]],
);
check_hover_fields_limit(
@@ -1300,11 +1236,7 @@
---
- size = 12 (0xC), align = 4
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 12 (0xC), align = 4, no Drop
"#]],
);
}
@@ -1330,11 +1262,7 @@
---
- size = 1, align = 1, niches = 254
-
- ---
-
- does not contain types with destructors (drop glue); doesn't have a destructor
+ size = 1, align = 1, niches = 254, no Drop
"#]],
);
check_hover_enum_variants_limit(
@@ -1356,11 +1284,7 @@
---
- size = 1, align = 1, niches = 254
-
- ---
-
- does not contain types with destructors (drop glue); doesn't have a destructor
+ size = 1, align = 1, niches = 254, no Drop
"#]],
);
check_hover_enum_variants_limit(
@@ -1379,11 +1303,7 @@
---
- size = 1, align = 1, niches = 254
-
- ---
-
- does not contain types with destructors (drop glue); doesn't have a destructor
+ size = 1, align = 1, niches = 254, no Drop
"#]],
);
check_hover_enum_variants_limit(
@@ -1402,11 +1322,7 @@
---
- size = 1, align = 1, niches = 254
-
- ---
-
- does not contain types with destructors (drop glue); doesn't have a destructor
+ size = 1, align = 1, niches = 254, no Drop
"#]],
);
check_hover_enum_variants_limit(
@@ -1443,11 +1359,7 @@
---
- size = 12 (0xC), align = 4, niches = a lot
-
- ---
-
- does not contain types with destructors (drop glue); doesn't have a destructor
+ size = 12 (0xC), align = 4, niches = a lot, no Drop
"#]],
);
}
@@ -1473,11 +1385,7 @@
---
- size = 4, align = 4
-
- ---
-
- does not contain types with destructors (drop glue); doesn't have a destructor
+ size = 4, align = 4, no Drop
"#]],
);
check_hover_fields_limit(
@@ -1499,11 +1407,7 @@
---
- size = 4, align = 4
-
- ---
-
- does not contain types with destructors (drop glue); doesn't have a destructor
+ size = 4, align = 4, no Drop
"#]],
);
check_hover_fields_limit(
@@ -1522,11 +1426,7 @@
---
- size = 4, align = 4
-
- ---
-
- does not contain types with destructors (drop glue); doesn't have a destructor
+ size = 4, align = 4, no Drop
"#]],
);
check_hover_fields_limit(
@@ -1545,11 +1445,7 @@
---
- size = 4, align = 4
-
- ---
-
- does not contain types with destructors (drop glue); doesn't have a destructor
+ size = 4, align = 4, no Drop
"#]],
);
}
@@ -1575,11 +1471,7 @@
---
- size = 0, align = 1
-
- ---
-
- does not contain types with destructors (drop glue); doesn't have a destructor
+ size = 0, align = 1, no Drop
"#]],
);
}
@@ -1605,7 +1497,7 @@
---
- does not contain types with destructors (drop glue)
+ no Drop
"#]],
);
}
@@ -1754,11 +1646,7 @@
---
- size = 8, align = 4
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 8, align = 4, no Drop
"#]],
);
check_hover_range(
@@ -1813,11 +1701,7 @@
---
- size = 4, align = 4
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 4, align = 4, no Drop
"#]],
);
}
@@ -1845,7 +1729,7 @@
---
- does not contain types with destructors (drop glue)
+ no Drop
---
@@ -1908,11 +1792,7 @@
---
- size = 4, align = 4
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 4, align = 4, no Drop
"#]],
)
}
@@ -1944,11 +1824,7 @@
---
- size = 4, align = 4
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 4, align = 4, no Drop
"#]],
)
}
@@ -1974,7 +1850,7 @@
---
- may contain types with destructors (drop glue) depending on type parameters
+ type param may need Drop
"#]],
)
}
@@ -2000,11 +1876,7 @@
---
- size = 4, align = 4
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 4, align = 4, no Drop
"#]],
)
}
@@ -2257,11 +2129,7 @@
---
- size = 0, align = 1
-
- ---
-
- does not contain types with destructors (drop glue); doesn't have a destructor
+ size = 0, align = 1, no Drop
"#]],
);
}
@@ -2807,11 +2675,7 @@
---
- size = 8, align = 8, niches = 1
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 8, align = 8, niches = 1, no Drop
"#]],
);
}
@@ -2833,11 +2697,7 @@
---
- size = 8, align = 8, niches = 1
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 8, align = 8, niches = 1, no Drop
"#]],
);
}
@@ -3080,11 +2940,7 @@
---
- size = 0, align = 1
-
- ---
-
- does not contain types with destructors (drop glue); doesn't have a destructor
+ size = 0, align = 1, no Drop
---
@@ -3115,11 +2971,7 @@
---
- size = 0, align = 1
-
- ---
-
- does not contain types with destructors (drop glue); doesn't have a destructor
+ size = 0, align = 1, no Drop
---
@@ -3212,11 +3064,7 @@
---
- size = 4, align = 2
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 4, align = 2, no Drop
"#]],
);
}
@@ -3241,7 +3089,7 @@
---
- does not contain types with destructors (drop glue)
+ no Drop
"#]],
);
}
@@ -3266,11 +3114,7 @@
---
- size = 0, align = 1
-
- ---
-
- does not contain types with destructors (drop glue); doesn't have a destructor
+ size = 0, align = 1, no Drop
"#]],
);
}
@@ -3298,11 +3142,7 @@
---
- size = 16 (0x10), align = 8, niches = 254
-
- ---
-
- does not contain types with destructors (drop glue); doesn't have a destructor
+ size = 16 (0x10), align = 8, niches = 254, no Drop
"#]],
);
}
@@ -3324,7 +3164,7 @@
---
- does not contain types with destructors (drop glue)
+ no Drop
"#]],
);
@@ -4632,11 +4472,7 @@
---
- size = 8, align = 8, niches = 1
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 8, align = 8, niches = 1, no Drop
---
@@ -4650,11 +4486,7 @@
---
- size = 4, align = 4, offset = 0
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 4, align = 4, offset = 0, no Drop
"#]],
);
}
@@ -4679,11 +4511,7 @@
---
- size = 0, align = 1
-
- ---
-
- may contain types with destructors (drop glue) depending on type parameters; doesn't have a destructor
+ size = 0, align = 1, type param may need Drop
"#]],
);
}
@@ -4708,11 +4536,7 @@
---
- size = 0, align = 1
-
- ---
-
- may contain types with destructors (drop glue) depending on type parameters; doesn't have a destructor
+ size = 0, align = 1, type param may need Drop
"#]],
);
}
@@ -4738,11 +4562,7 @@
---
- size = 0, align = 1
-
- ---
-
- may contain types with destructors (drop glue) depending on type parameters; doesn't have a destructor
+ size = 0, align = 1, type param may need Drop
"#]],
);
}
@@ -4766,11 +4586,7 @@
---
- size = 0, align = 1
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 0, align = 1, no Drop
"#]],
);
}
@@ -4794,11 +4610,7 @@
---
- size = 0, align = 1
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 0, align = 1, no Drop
"#]],
);
}
@@ -4822,11 +4634,7 @@
---
- size = 0, align = 1
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 0, align = 1, no Drop
"#]],
);
}
@@ -4850,11 +4658,7 @@
---
- size = 0, align = 1
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 0, align = 1, no Drop
"#]],
);
}
@@ -4878,11 +4682,7 @@
---
- size = 0, align = 1
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 0, align = 1, no Drop
"#]],
);
}
@@ -4905,11 +4705,7 @@
---
- size = 8, align = 8, niches = 1
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 8, align = 8, niches = 1, no Drop
"#]],
);
}
@@ -4933,11 +4729,7 @@
---
- size = 0, align = 1
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 0, align = 1, no Drop
"#]],
);
}
@@ -5427,11 +5219,7 @@
---
- size = 0, align = 1
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 0, align = 1, no Drop
"#]],
);
}
@@ -5481,11 +5269,7 @@
---
- size = 1, align = 1
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 1, align = 1, no Drop
---
@@ -5514,11 +5298,7 @@
---
- size = 1, align = 1
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 1, align = 1, no Drop
---
@@ -5548,11 +5328,7 @@
---
- size = 1, align = 1
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 1, align = 1, no Drop
---
@@ -5582,11 +5358,7 @@
---
- size = 1, align = 1
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 1, align = 1, no Drop
---
@@ -6517,11 +6289,7 @@
---
- size = 32 (0x20), align = 4
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 32 (0x20), align = 4, no Drop
"#]],
);
}
@@ -7820,11 +7588,7 @@
---
- size = 4, align = 4
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 4, align = 4, no Drop
"#]],
);
}
@@ -7850,11 +7614,7 @@
---
- size = 4, align = 4
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 4, align = 4, no Drop
"#]],
);
}
@@ -8524,11 +8284,7 @@
---
- size = 0, align = 1
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 0, align = 1, no Drop
"#]],
);
}
@@ -9177,11 +8933,7 @@
---
- size = 4, align = 4
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 4, align = 4, no Drop
"#]],
);
}
@@ -9273,11 +9025,7 @@
---
- size = 0, align = 1
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 0, align = 1, no Drop
"#]],
);
}
@@ -9423,11 +9171,7 @@
---
- size = 16 (0x10), align = 8, niches = 1
-
- ---
-
- does not contain types with destructors (drop glue); doesn't have a destructor
+ size = 16 (0x10), align = 8, niches = 1, no Drop
"#]],
)
}
@@ -9448,7 +9192,7 @@
---
- may contain types with destructors (drop glue) depending on type parameters
+ type param may need Drop
"#]],
);
}
@@ -9469,11 +9213,7 @@
---
- size = 0, align = 1
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 0, align = 1, no Drop
"#]],
);
}
@@ -9526,11 +9266,7 @@
---
- size = 0, align = 1
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 0, align = 1, no Drop
"#]],
);
}
@@ -9864,11 +9600,7 @@
---
- size = 0, align = 1
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 0, align = 1, no Drop
---
@@ -9901,11 +9633,7 @@
---
- size = 0, align = 1
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 0, align = 1, no Drop
---
@@ -9939,11 +9667,7 @@
---
- size = 0, align = 1
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 0, align = 1, no Drop
---
@@ -9975,11 +9699,7 @@
---
- size = 0, align = 1
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 0, align = 1, no Drop
"#]],
);
@@ -10103,11 +9823,7 @@
---
- size = 0, align = 1
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 0, align = 1, no Drop
"#]],
);
@@ -10135,11 +9851,7 @@
---
- size = 0, align = 1
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 0, align = 1, no Drop
"#]],
);
@@ -10174,11 +9886,7 @@
---
- size = 0, align = 1
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 0, align = 1, no Drop
"#]],
);
}
@@ -10497,11 +10205,7 @@
---
- size = 4, align = 4
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 4, align = 4, no Drop
---
@@ -10515,7 +10219,7 @@
---
- may contain types with destructors (drop glue) depending on type parameters
+ type param may need Drop
---
@@ -10748,11 +10452,7 @@
---
- size = 0, align = 1
-
- ---
-
- does not contain types with destructors (drop glue); doesn't have a destructor
+ size = 0, align = 1, no Drop
"#]],
);
check(
@@ -10776,11 +10476,7 @@
---
- size = 0, align = 1
-
- ---
-
- does not contain types with destructors (drop glue); has a destructor
+ size = 0, align = 1, impl Drop
"#]],
);
check(
@@ -10805,11 +10501,7 @@
---
- size = 0, align = 1
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 0, align = 1, no Drop
"#]],
);
check(
@@ -10840,11 +10532,7 @@
---
- size = 4, align = 4
-
- ---
-
- contain types with destructors (drop glue); doesn't have a destructor
+ size = 4, align = 4, needs Drop
"#]],
);
check(
@@ -10865,7 +10553,7 @@
---
- contain types with destructors (drop glue)
+ needs Drop
"#]],
);
check(
@@ -10893,11 +10581,7 @@
---
- size = 16 (0x10), align = 8, niches = 1
-
- ---
-
- does not contain types with destructors (drop glue)
+ size = 16 (0x10), align = 8, niches = 1, no Drop
"#]],
);
check(
@@ -10917,7 +10601,7 @@
---
- may contain types with destructors (drop glue) depending on type parameters; doesn't have a destructor
+ type param may need Drop
"#]],
);
check(
@@ -10940,7 +10624,7 @@
---
- does not contain types with destructors (drop glue); doesn't have a destructor
+ no Drop
"#]],
);
check(
@@ -10966,7 +10650,7 @@
---
- does not contain types with destructors (drop glue); doesn't have a destructor
+ no Drop
"#]],
);
check(
@@ -10997,7 +10681,7 @@
---
- does not contain types with destructors (drop glue); doesn't have a destructor
+ no Drop
"#]],
);
}