about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorclubby789 <jamie@hill-daniel.co.uk>2023-03-04 12:07:29 +0000
committerclubby789 <jamie@hill-daniel.co.uk>2023-03-04 12:07:29 +0000
commit7520155e4ebe133859e379624283aaafdcb6e72b (patch)
tree399c03fb4e6dc7a5754968ff61dee9bb5671be7a /src
parent13471d3b2046cce78181dde6cfc146c09f55e29e (diff)
downloadrust-7520155e4ebe133859e379624283aaafdcb6e72b.tar.gz
rust-7520155e4ebe133859e379624283aaafdcb6e72b.zip
rustdoc: Note in a type's layout/size if it is uninhabited
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/html/render/print_item.rs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs
index 2869a39613f..08796f10d92 100644
--- a/src/librustdoc/html/render/print_item.rs
+++ b/src/librustdoc/html/render/print_item.rs
@@ -1839,6 +1839,12 @@ fn document_type_layout(w: &mut Buffer, cx: &Context<'_>, ty_def_id: DefId) {
         } else {
             let size = layout.size.bytes() - tag_size;
             write!(w, "{size} byte{pl}", pl = if size == 1 { "" } else { "s" },);
+            if layout.abi.is_uninhabited() {
+                write!(
+                    w,
+                    " (<a href=\"https://doc.rust-lang.org/stable/reference/glossary.html#uninhabited\">uninhabited</a>)"
+                );
+            }
         }
     }