From b9f0094afa3d99316de6f2fdbe7961c877fab272 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Sun, 18 Feb 2024 18:58:17 -0700 Subject: [PATCH] Add test cases for inlining compiler-private items Closes #106421 This was already fixed by f5d43a052b9eb464e54af819143467954d814a24, but now the test cases are added. --- tests/rustdoc/auxiliary/issue-106421-force-unstable.rs | 9 +++++++++ tests/rustdoc/issue-106421-not-internal.rs | 8 ++++++++ tests/rustdoc/issue-106421.rs | 8 ++++++++ 3 files changed, 25 insertions(+) create mode 100644 tests/rustdoc/auxiliary/issue-106421-force-unstable.rs create mode 100644 tests/rustdoc/issue-106421-not-internal.rs create mode 100644 tests/rustdoc/issue-106421.rs 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..d8b9abfa2c2a7 --- /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..1477b7b5d2a06 --- /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..7059f57ff5031 --- /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;