rustdoc: clean up and test macro visibility print

This fixes the overly-complex invariant mentioned in
<https://github.com/rust-lang/rust/pull/83237#issuecomment-815346570>,
where the macro source can't have any links in it only because the
cache hasn't been populated yet.
This commit is contained in:
Michael Howell 2021-04-10 14:22:06 -07:00
parent 72c63de2cc
commit 2dfd0bfe10
3 changed files with 57 additions and 12 deletions

View file

@ -1,3 +1,5 @@
// compile-flags: --document-private-items
#![feature(decl_macro)]
// @has decl_macro/macro.my_macro.html //pre 'pub macro my_macro() {'
@ -37,3 +39,18 @@ pub macro my_macro_multi {
pub macro by_example_single {
($foo:expr) => {}
}
mod a {
mod b {
// @has decl_macro/a/b/macro.by_example_vis.html //pre 'pub(super) macro by_example_vis($foo:expr) {'
pub(in super) macro by_example_vis {
($foo:expr) => {}
}
mod c {
// @has decl_macro/a/b/c/macro.by_example_vis_named.html //pre 'pub(in a) macro by_example_vis_named($foo:expr) {'
pub(in a) macro by_example_vis_named {
($foo:expr) => {}
}
}
}
}