diff options
| author | Camelid <camelidcamel@gmail.com> | 2021-04-08 16:04:21 -0700 |
|---|---|---|
| committer | Camelid <camelidcamel@gmail.com> | 2021-05-11 09:55:31 -0700 |
| commit | 20b30acfa856309857e8914fb2bb5f831e991d0b (patch) | |
| tree | 322d0810d397193fcba90d21a90655c2808f258b | |
| parent | 5859c5d333465fe91be46196e2b47bff9fc48ece (diff) | |
| download | rust-20b30acfa856309857e8914fb2bb5f831e991d0b.tar.gz rust-20b30acfa856309857e8914fb2bb5f831e991d0b.zip | |
Include a warning in the layout docs that layout is unstable
| -rw-r--r-- | src/librustdoc/html/render/print_item.rs | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/librustdoc/html/render/print_item.rs b/src/librustdoc/html/render/print_item.rs index 1f7b317a45b..41565019c6b 100644 --- a/src/librustdoc/html/render/print_item.rs +++ b/src/librustdoc/html/render/print_item.rs @@ -1537,10 +1537,19 @@ fn document_ty_layout(w: &mut Buffer, cx: &Context<'_>, ty_def_id: DefId) { let ty = cx.tcx().type_of(ty_def_id); match cx.tcx().layout_of(param_env.and(ty)) { Ok(ty_layout) => { - writeln!(w, r#"<h2 class="small-section-header">Layout</h2>"#); - writeln!(w, "<div>"); + writeln!(w, "<h2 class=\"small-section-header\">Layout</h2>"); + writeln!(w, "<div class=\"docblock\">"); + writeln!( + w, + "<div class=\"warning\"><p><strong>Note:</strong> Most layout information is \ + completely unstable and may be different between compiler versions. \ + The only exception is types with certain <code>repr(...)</code> attributes. \ + Please see the Rust Reference’s \ + <a href=\"https://doc.rust-lang.org/reference/type-layout.html\">“Type Layout”</a> \ + chapter for details on type layout guarantees.</p></div>" + ); if ty_layout.layout.abi.is_unsized() { - writeln!(w, "<strong>Sized:</strong> (unsized)"); + writeln!(w, "<p><strong>Size:</strong> (unsized)</p>"); } else { writeln!( w, |
