diff options
| author | Olivier Goffart <olivier.goffart@slint.dev> | 2024-09-11 12:08:14 +0200 |
|---|---|---|
| committer | Olivier Goffart <olivier.goffart@slint.dev> | 2024-09-11 12:14:35 +0200 |
| commit | cc34d64c511feaf576854797fc291e03f5f275a7 (patch) | |
| tree | 54565531fb4a99c93fa78ea69714dc88dab87d0c | |
| parent | 5d456dfaa1a712f1b1619c3b5a6f725776d5f101 (diff) | |
| download | rust-cc34d64c511feaf576854797fc291e03f5f275a7.tar.gz rust-cc34d64c511feaf576854797fc291e03f5f275a7.zip | |
Use `doc(hidden)` instead of `allow(missing_docs)` in the test harness
So that it doesn't fail with `forbid(missing_docs)` Fixes #130218
| -rw-r--r-- | compiler/rustc_builtin_macros/src/test_harness.rs | 6 | ||||
| -rw-r--r-- | compiler/rustc_span/src/symbol.rs | 1 | ||||
| -rw-r--r-- | tests/pretty/tests-are-sorted.pp | 2 | ||||
| -rw-r--r-- | tests/ui/lint/lint-missing-doc-test.rs | 4 |
4 files changed, 7 insertions, 6 deletions
diff --git a/compiler/rustc_builtin_macros/src/test_harness.rs b/compiler/rustc_builtin_macros/src/test_harness.rs index a694d3b8c28..400557ca260 100644 --- a/compiler/rustc_builtin_macros/src/test_harness.rs +++ b/compiler/rustc_builtin_macros/src/test_harness.rs @@ -326,8 +326,8 @@ fn mk_main(cx: &mut TestCtxt<'_>) -> P<ast::Item> { let main_attr = ecx.attr_word(sym::rustc_main, sp); // #[coverage(off)] let coverage_attr = ecx.attr_nested_word(sym::coverage, sym::off, sp); - // #[allow(missing_docs)] - let missing_docs_attr = ecx.attr_nested_word(sym::allow, sym::missing_docs, sp); + // #[doc(hidden)] + let doc_hidden_attr = ecx.attr_nested_word(sym::doc, sym::hidden, sp); // pub fn main() { ... } let main_ret_ty = ecx.ty(sp, ast::TyKind::Tup(ThinVec::new())); @@ -357,7 +357,7 @@ fn mk_main(cx: &mut TestCtxt<'_>) -> P<ast::Item> { let main = P(ast::Item { ident: main_id, - attrs: thin_vec![main_attr, coverage_attr, missing_docs_attr], + attrs: thin_vec![main_attr, coverage_attr, doc_hidden_attr], id: ast::DUMMY_NODE_ID, kind: main, vis: ast::Visibility { span: sp, kind: ast::VisibilityKind::Public, tokens: None }, diff --git a/compiler/rustc_span/src/symbol.rs b/compiler/rustc_span/src/symbol.rs index d5240a05310..28d18f2dfcc 100644 --- a/compiler/rustc_span/src/symbol.rs +++ b/compiler/rustc_span/src/symbol.rs @@ -1236,7 +1236,6 @@ symbols! { mir_unwind_unreachable, mir_variant, miri, - missing_docs, mmx_reg, modifiers, module, diff --git a/tests/pretty/tests-are-sorted.pp b/tests/pretty/tests-are-sorted.pp index d10368a89cb..31449b51dc3 100644 --- a/tests/pretty/tests-are-sorted.pp +++ b/tests/pretty/tests-are-sorted.pp @@ -86,7 +86,7 @@ pub const a_test: test::TestDescAndFn = fn a_test() {} #[rustc_main] #[coverage(off)] -#[allow(missing_docs)] +#[doc(hidden)] pub fn main() -> () { extern crate test; test::test_main_static(&[&a_test, &m_test, &z_test]) diff --git a/tests/ui/lint/lint-missing-doc-test.rs b/tests/ui/lint/lint-missing-doc-test.rs index 466b79c0fb9..d86ec3525df 100644 --- a/tests/ui/lint/lint-missing-doc-test.rs +++ b/tests/ui/lint/lint-missing-doc-test.rs @@ -2,7 +2,9 @@ //! on the generated test harness. //@ check-pass -//@ compile-flags: --test -Dmissing_docs +//@ compile-flags: --test + +#![forbid(missing_docs)] #[test] fn test() {} |
