diff --git a/tests/rustdoc/auxiliary/issue-106421-force-unstable.rs b/tests/rustdoc/auxiliary/issue-106421-force-unstable.rs
new file mode 100644
index 0000000000000..589d44c1f774d
--- /dev/null
+++ b/tests/rustdoc/auxiliary/issue-106421-force-unstable.rs
@@ -0,0 +1,9 @@
+//@ compile-flags: -Zforce-unstable-if-unmarked
+#![crate_name="foo"]
+pub struct FatalError;
+
+impl FatalError {
+    pub fn raise(self) -> ! {
+        loop {}
+    }
+}
diff --git a/tests/rustdoc/issue-106421-not-internal.rs b/tests/rustdoc/issue-106421-not-internal.rs
new file mode 100644
index 0000000000000..1d744fba53f8a
--- /dev/null
+++ b/tests/rustdoc/issue-106421-not-internal.rs
@@ -0,0 +1,8 @@
+//@ aux-build:issue-106421-force-unstable.rs
+//@ ignore-cross-compile
+// This is the version where a non-compiler-internal crate inlines a compiler-internal one.
+// In this case, the item shouldn't be documented, because regular users can't get at it.
+extern crate foo;
+
+// @!has issue_106421_not_internal/struct.FatalError.html '//*[@id="method.raise"]' 'fn raise'
+pub use foo::FatalError;
diff --git a/tests/rustdoc/issue-106421.rs b/tests/rustdoc/issue-106421.rs
new file mode 100644
index 0000000000000..d4141a4ab0c70
--- /dev/null
+++ b/tests/rustdoc/issue-106421.rs
@@ -0,0 +1,8 @@
+//@ aux-build:issue-106421-force-unstable.rs
+//@ ignore-cross-compile
+//@ compile-flags: -Zforce-unstable-if-unmarked
+
+extern crate foo;
+
+// @has issue_106421/struct.FatalError.html '//*[@id="method.raise"]' 'fn raise'
+pub use foo::FatalError;