forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add regression test for rust-lang#81141
- Loading branch information
1 parent
96e2583
commit f3121ba
Showing
1 changed file
with
34 additions
and
0 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
tests/rustdoc/issue-81141-private-reexport-in-public-api.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
} |