-
Notifications
You must be signed in to change notification settings - Fork 12.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #86841 - GuillaumeGomez:reexported-macro-2-render, r=St…
…upremee Fix rendering of reexported macros 2.0 and fix visibility of reexported items So, this PR grew a bit out of focus, it does the following things: * Fixes #86276. * Fixes visibility display for reexported items: it now takes the visibility of the "use" statement rather than the visibility of the reexported item itself). * Fixes the display of reexported items if "--document-private-items" option is used. Before, they were simply skipped. * Fixes inconsistency on typedef items: they didn't display their visibility contrary to other items. I added tests to check everything listed above. cc `@camelid` `@ollie27` (in case one of you want to review?) r? `@jyn514`
- Loading branch information
Showing
7 changed files
with
232 additions
and
56 deletions.
There are no files selected for viewing
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
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
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
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
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,42 @@ | ||
#![feature(decl_macro)] | ||
|
||
pub macro addr_of($place:expr) { | ||
&raw const $place | ||
} | ||
|
||
pub macro addr_of_self($place:expr) { | ||
&raw const $place | ||
} | ||
|
||
pub macro addr_of_crate($place:expr) { | ||
&raw const $place | ||
} | ||
|
||
pub struct Foo; | ||
pub struct FooSelf; | ||
pub struct FooCrate; | ||
|
||
pub enum Bar { Foo, } | ||
pub enum BarSelf { Foo, } | ||
pub enum BarCrate { Foo, } | ||
|
||
pub fn foo() {} | ||
pub fn foo_self() {} | ||
pub fn foo_crate() {} | ||
|
||
pub type Type = i32; | ||
pub type TypeSelf = i32; | ||
pub type TypeCrate = i32; | ||
|
||
pub union Union { | ||
a: i8, | ||
b: i8, | ||
} | ||
pub union UnionSelf { | ||
a: i8, | ||
b: i8, | ||
} | ||
pub union UnionCrate { | ||
a: i8, | ||
b: i8, | ||
} |
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,53 @@ | ||
// aux-build: reexports.rs | ||
// compile-flags: --document-private-items | ||
|
||
#![crate_name = "foo"] | ||
|
||
extern crate reexports; | ||
|
||
// @has 'foo/macro.addr_of.html' '//*[@class="docblock type-decl"]' 'pub macro addr_of($place : expr) {' | ||
pub use reexports::addr_of; | ||
// @has 'foo/macro.addr_of_crate.html' '//*[@class="docblock type-decl"]' 'pub(crate) macro addr_of_crate($place : expr) {' | ||
pub(crate) use reexports::addr_of_crate; | ||
// @has 'foo/macro.addr_of_self.html' '//*[@class="docblock type-decl"]' 'pub(crate) macro addr_of_self($place : expr) {' | ||
pub(self) use reexports::addr_of_self; | ||
|
||
// @has 'foo/struct.Foo.html' '//*[@class="docblock type-decl"]' 'pub struct Foo;' | ||
pub use reexports::Foo; | ||
// @has 'foo/struct.FooCrate.html' '//*[@class="docblock type-decl"]' 'pub(crate) struct FooCrate;' | ||
pub(crate) use reexports::FooCrate; | ||
// @has 'foo/struct.FooSelf.html' '//*[@class="docblock type-decl"]' 'pub(crate) struct FooSelf;' | ||
pub(self) use reexports::FooSelf; | ||
|
||
// @has 'foo/enum.Bar.html' '//*[@class="docblock type-decl"]' 'pub enum Bar {' | ||
pub use reexports::Bar; | ||
// @has 'foo/enum.BarCrate.html' '//*[@class="docblock type-decl"]' 'pub(crate) enum BarCrate {' | ||
pub(crate) use reexports::BarCrate; | ||
// @has 'foo/enum.BarSelf.html' '//*[@class="docblock type-decl"]' 'pub(crate) enum BarSelf {' | ||
pub(self) use reexports::BarSelf; | ||
|
||
// @has 'foo/fn.foo.html' '//*[@class="rust fn"]' 'pub fn foo()' | ||
pub use reexports::foo; | ||
// @has 'foo/fn.foo_crate.html' '//*[@class="rust fn"]' 'pub(crate) fn foo_crate()' | ||
pub(crate) use reexports::foo_crate; | ||
// @has 'foo/fn.foo_self.html' '//*[@class="rust fn"]' 'pub(crate) fn foo_self()' | ||
pub(self) use reexports::foo_self; | ||
|
||
// @has 'foo/type.Type.html' '//*[@class="rust typedef"]' 'pub type Type =' | ||
pub use reexports::Type; | ||
// @has 'foo/type.TypeCrate.html' '//*[@class="rust typedef"]' 'pub(crate) type TypeCrate =' | ||
pub(crate) use reexports::TypeCrate; | ||
// @has 'foo/type.TypeSelf.html' '//*[@class="rust typedef"]' 'pub(crate) type TypeSelf =' | ||
pub(self) use reexports::TypeSelf; | ||
|
||
// @has 'foo/union.Union.html' '//*[@class="docblock type-decl"]' 'pub union Union {' | ||
pub use reexports::Union; | ||
// @has 'foo/union.UnionCrate.html' '//*[@class="docblock type-decl"]' 'pub(crate) union UnionCrate {' | ||
pub(crate) use reexports::UnionCrate; | ||
// @has 'foo/union.UnionSelf.html' '//*[@class="docblock type-decl"]' 'pub(crate) union UnionSelf {' | ||
pub(self) use reexports::UnionSelf; | ||
|
||
pub mod foo { | ||
// @!has 'foo/foo/union.Union.html' | ||
use crate::reexports::Union; | ||
} |
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,47 @@ | ||
// aux-build: reexports.rs | ||
|
||
#![crate_name = "foo"] | ||
|
||
extern crate reexports; | ||
|
||
// @has 'foo/macro.addr_of.html' '//*[@class="docblock type-decl"]' 'pub macro addr_of($place : expr) {' | ||
pub use reexports::addr_of; | ||
// @!has 'foo/macro.addr_of_crate.html' | ||
pub(crate) use reexports::addr_of_crate; | ||
// @!has 'foo/macro.addr_of_self.html' | ||
pub(self) use reexports::addr_of_self; | ||
|
||
// @has 'foo/struct.Foo.html' '//*[@class="docblock type-decl"]' 'pub struct Foo;' | ||
pub use reexports::Foo; | ||
// @!has 'foo/struct.FooCrate.html' | ||
pub(crate) use reexports::FooCrate; | ||
// @!has 'foo/struct.FooSelf.html' | ||
pub(self) use reexports::FooSelf; | ||
|
||
// @has 'foo/enum.Bar.html' '//*[@class="docblock type-decl"]' 'pub enum Bar {' | ||
pub use reexports::Bar; | ||
// @!has 'foo/enum.BarCrate.html' | ||
pub(crate) use reexports::BarCrate; | ||
// @!has 'foo/enum.BarSelf.html' | ||
pub(self) use reexports::BarSelf; | ||
|
||
// @has 'foo/fn.foo.html' '//*[@class="rust fn"]' 'pub fn foo()' | ||
pub use reexports::foo; | ||
// @!has 'foo/fn.foo_crate.html' | ||
pub(crate) use reexports::foo_crate; | ||
// @!has 'foo/fn.foo_self.html' | ||
pub(self) use reexports::foo_self; | ||
|
||
// @has 'foo/type.Type.html' '//*[@class="rust typedef"]' 'pub type Type =' | ||
pub use reexports::Type; | ||
// @!has 'foo/type.TypeCrate.html' | ||
pub(crate) use reexports::TypeCrate; | ||
// @!has 'foo/type.TypeSelf.html' | ||
pub(self) use reexports::TypeSelf; | ||
|
||
// @has 'foo/union.Union.html' '//*[@class="docblock type-decl"]' 'pub union Union {' | ||
pub use reexports::Union; | ||
// @!has 'foo/union.UnionCrate.html' | ||
pub(crate) use reexports::UnionCrate; | ||
// @!has 'foo/union.UnionSelf.html' | ||
pub(self) use reexports::UnionSelf; |