diff --git a/tests/rustdoc-gui/src/test_docs/lib.rs b/tests/rustdoc-gui/src/test_docs/lib.rs
index 7e34178e56f..360ad3edefa 100644
--- a/tests/rustdoc-gui/src/test_docs/lib.rs
+++ b/tests/rustdoc-gui/src/test_docs/lib.rs
@@ -20,10 +20,10 @@
Also, stop using `bar` as it's deprecated.
Also, stop using `bar` as it's deprecated.
-Finally, you can use `quz` only on Unix or x86-64
-.
-Finally, you can use `quz` only on Unix or x86-64
-.
+Finally, you can use `quz` only on Unix or x86-64
+
.
+Finally, you can use `quz` only on Unix or x86-64
+
.
*/
use std::convert::AsRef;
diff --git a/tests/rustdoc-gui/stab-in-doc.goml b/tests/rustdoc-gui/stab-in-doc.goml
new file mode 100644
index 00000000000..6a03a51fe9f
--- /dev/null
+++ b/tests/rustdoc-gui/stab-in-doc.goml
@@ -0,0 +1,9 @@
+// This test ensure that `stab` elements if used in doc blocks are not breaking the text layout.
+go-to: "file://" + |DOC_PATH| + "/test_docs/index.html"
+// We make the window wide enough for the two stabs who are looking into to be on the same line.
+set-window-size: (1100, 600)
+compare-elements-position: (
+ ".top-doc .docblock span[data-span='1']",
+ ".top-doc .docblock span[data-span='2']",
+ ["y"],
+)