diff --git a/src/librustdoc/html/static/noscript.css b/src/librustdoc/html/static/noscript.css
index ffa1a7639abbb..c9fed989ec04a 100644
--- a/src/librustdoc/html/static/noscript.css
+++ b/src/librustdoc/html/static/noscript.css
@@ -23,3 +23,13 @@ rules.
#main .impl-items .hidden {
display: block !important;
}
+
+#main .impl-items h4.hidden {
+ /* Without this rule, the version and the "[src]" span aren't on the same line as the header. */
+ display: flex !important;
+}
+
+#main .attributes {
+ /* Since there is no toggle (the "[-]") when JS is disabled, no need for this margin either. */
+ margin-left: 0 !important;
+}
diff --git a/src/librustdoc/html/static/rustdoc.css b/src/librustdoc/html/static/rustdoc.css
index 94c231cb33a8b..996e0f95d0885 100644
--- a/src/librustdoc/html/static/rustdoc.css
+++ b/src/librustdoc/html/static/rustdoc.css
@@ -1343,7 +1343,7 @@ h4 > .notable-traits {
@media (min-width: 701px) {
/* In case there is no documentation before a code block, we need to add some margin at the top
to prevent an overlay between the "collapse toggle" and the information tooltip.
- However, it's needed needed with smaller screen width because the doc/code block is always put
+ However, it's not needed with smaller screen width because the doc/code block is always put
"one line" below. */
.information:first-child > .tooltip {
margin-top: 16px;
diff --git a/src/test/rustdoc-gui/lib.rs b/src/test/rustdoc-gui/lib.rs
index 3c996f5b65c92..15d8dcc6e8444 100644
--- a/src/test/rustdoc-gui/lib.rs
+++ b/src/test/rustdoc-gui/lib.rs
@@ -27,6 +27,11 @@ pub fn foo() {}
/// Just a normal struct.
pub struct Foo;
+impl Foo {
+ #[must_use]
+ pub fn must_use(&self) -> bool { true }
+}
+
/// Just a normal enum.
pub enum WhoLetTheDogOut {
/// Woof!
diff --git a/src/test/rustdoc-gui/nojs-attr-pos.goml b/src/test/rustdoc-gui/nojs-attr-pos.goml
new file mode 100644
index 0000000000000..35daa4cb9e322
--- /dev/null
+++ b/src/test/rustdoc-gui/nojs-attr-pos.goml
@@ -0,0 +1,5 @@
+// Check that the attributes are well positioned when javascript is disabled (since
+// there is no toggle to display)
+javascript: false
+goto: file://|DOC_PATH|/struct.Foo.html
+assert: (".attributes", {"margin-left": "0px"})