From e3b7035e350b57baf9579c4c5c51befbe37a6df3 Mon Sep 17 00:00:00 2001 From: Guillaume Gomez Date: Wed, 5 Jul 2023 18:45:42 +0200 Subject: [PATCH] Add regression test for #81141 --- ...ue-81141-private-reexport-in-public-api.rs | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 tests/rustdoc/issue-81141-private-reexport-in-public-api.rs diff --git a/tests/rustdoc/issue-81141-private-reexport-in-public-api.rs b/tests/rustdoc/issue-81141-private-reexport-in-public-api.rs new file mode 100644 index 0000000000000..d6ef843542957 --- /dev/null +++ b/tests/rustdoc/issue-81141-private-reexport-in-public-api.rs @@ -0,0 +1,34 @@ +// This test ensures that if a private re-export is present in a public API, it'll be +// replaced by the first public item in the re-export chain or by the private item. + +#![crate_name = "foo"] + +use crate::bar::Bar as Alias; + +pub use crate::bar::Bar as Whatever; +use crate::Whatever as Whatever2; +use crate::Whatever2 as Whatever3; +pub use crate::bar::Inner as Whatever4; + +mod bar { + pub struct Bar; + pub use self::Bar as Inner; +} + +// @has 'foo/fn.bar.html' +// @has - '//*[@class="rust item-decl"]/code' 'pub fn bar() -> Bar' +pub fn bar() -> Alias { + Alias +} + +// @has 'foo/fn.bar2.html' +// @has - '//*[@class="rust item-decl"]/code' 'pub fn bar2() -> Whatever' +pub fn bar2() -> Whatever3 { + Whatever +} + +// @has 'foo/fn.bar3.html' +// @has - '//*[@class="rust item-decl"]/code' 'pub fn bar3() -> Whatever4' +pub fn bar3() -> Whatever4 { + Whatever +}