Skip to content

Commit b5a4141

Browse files
Update tests
1 parent 1f7bce0 commit b5a4141

9 files changed

+99
-6
lines changed

src/test/rustdoc-ui/deny-missing-docs-macro.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: missing documentation for macro
1+
error: missing documentation for a macro
22
--> $DIR/deny-missing-docs-macro.rs:6:1
33
|
44
LL | macro_rules! foo {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// FIXME: If two macros in the same module have the same name
2+
// (yes, that's a thing), rustdoc lists both of them on the index page,
3+
// but only documents the first one on the page for the macro.
4+
// Fortunately, this can only happen in document private items mode,
5+
// but it still isn't ideal beahvior.
6+
//
7+
// See https://github.com/rust-lang/rust/pull/88019#discussion_r693920453
8+
//
9+
// compile-flags: --document-private-items
10+
11+
// @has macro_document_private_duplicate/index.html 'Doc 1.'
12+
// @has macro_document_private_duplicate/macro.a_macro.html 'Doc 1.'
13+
/// Doc 1.
14+
macro_rules! a_macro {
15+
() => ()
16+
}
17+
18+
// @has macro_document_private_duplicate/index.html 'Doc 2.'
19+
// @!has macro_document_private_duplicate/macro.a_macro.html 'Doc 2.'
20+
/// Doc 2.
21+
macro_rules! a_macro {
22+
() => ()
23+
}
+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// Checks that private macros are documented when `--document-private-items`
2+
// is present.
3+
//
4+
// This is a regression test for issue #73754.
5+
//
6+
// compile-flags: --document-private-items
7+
8+
#![feature(decl_macro)]
9+
10+
11+
// @has macro_document_private/macro.some_macro.html
12+
macro some_macro {
13+
(a: tt) => {}
14+
}
15+
16+
// @has macro_document_private/macro.another_macro.html
17+
macro_rules! another_macro {
18+
(a: tt) => {}
19+
}
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Checks that it is possible to make a macro public through a `pub use` of its
2+
// parent module.
3+
//
4+
// This is a regression test for issue #87257.
5+
6+
#![feature(decl_macro)]
7+
8+
mod outer {
9+
pub mod inner {
10+
pub macro some_macro() {}
11+
}
12+
}
13+
14+
// @has macro_indirect_use/inner/index.html
15+
// @has macro_indirect_use/inner/macro.some_macro.html
16+
pub use outer::inner;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// This checks that exported macros lint as part of their module of origin, not
2+
// the root module.
3+
//
4+
// check-pass
5+
6+
//! Top level documentation
7+
#![deny(missing_docs)]
8+
9+
#[allow(missing_docs)]
10+
mod module {
11+
#[macro_export]
12+
macro_rules! hello {
13+
() => ()
14+
}
15+
}
16+
17+
fn main() {}
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Checks that you can set a lint level specficially for a macro definition.
2+
//
3+
// This is a regression test for issue #59306.
4+
//
5+
// check-pass
6+
7+
8+
#[deny(missing_docs)]
9+
mod module {
10+
#[allow(missing_docs)]
11+
#[macro_export]
12+
macro_rules! hello {
13+
() => ()
14+
}
15+
}
16+
17+
fn main() {}

src/test/ui/lint/missing-doc-private-macro.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ mod submodule {
2929

3030
#[macro_export]
3131
macro_rules! exported_to_top_level {
32-
//~^ ERROR missing documentation for macro
32+
//~^ ERROR missing documentation for a macro
3333
() => ()
3434
}
3535
}
3636

3737
pub macro top_level_pub_macro {
38-
//~^ ERROR missing documentation for macro
38+
//~^ ERROR missing documentation for a macro
3939
() => ()
4040
}
4141

src/test/ui/lint/missing-doc-private-macro.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: missing documentation for macro
1+
error: missing documentation for a macro
22
--> $DIR/missing-doc-private-macro.rs:31:5
33
|
44
LL | macro_rules! exported_to_top_level {
@@ -10,7 +10,7 @@ note: the lint level is defined here
1010
LL | #![deny(missing_docs)]
1111
| ^^^^^^^^^^^^
1212

13-
error: missing documentation for macro
13+
error: missing documentation for a macro
1414
--> $DIR/missing-doc-private-macro.rs:37:1
1515
|
1616
LL | pub macro top_level_pub_macro {

src/test/ui/macros/macro-stability-rpass.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
// run-pass
22
// aux-build:unstable-macros.rs
33

4-
#![feature(unstable_macros, local_unstable)]
4+
#![unstable(feature = "one_two_three_testing", issue = "none")]
5+
#![feature(staged_api, unstable_macros, local_unstable)]
56

67
#[macro_use] extern crate unstable_macros;
78

0 commit comments

Comments
 (0)