Use doc(hidden) instead of allow(missing_docs) in the test harness

So that it doesn't fail with `forbid(missing_docs)`

Fixes #130218
This commit is contained in:
Olivier Goffart 2024-09-11 12:08:14 +02:00
parent 5d456dfaa1
commit cc34d64c51
4 changed files with 7 additions and 6 deletions

View File

@ -326,8 +326,8 @@ fn mk_main(cx: &mut TestCtxt<'_>) -> P<ast::Item> {
let main_attr = ecx.attr_word(sym::rustc_main, sp); let main_attr = ecx.attr_word(sym::rustc_main, sp);
// #[coverage(off)] // #[coverage(off)]
let coverage_attr = ecx.attr_nested_word(sym::coverage, sym::off, sp); let coverage_attr = ecx.attr_nested_word(sym::coverage, sym::off, sp);
// #[allow(missing_docs)] // #[doc(hidden)]
let missing_docs_attr = ecx.attr_nested_word(sym::allow, sym::missing_docs, sp); let doc_hidden_attr = ecx.attr_nested_word(sym::doc, sym::hidden, sp);
// pub fn main() { ... } // pub fn main() { ... }
let main_ret_ty = ecx.ty(sp, ast::TyKind::Tup(ThinVec::new())); 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 { let main = P(ast::Item {
ident: main_id, 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, id: ast::DUMMY_NODE_ID,
kind: main, kind: main,
vis: ast::Visibility { span: sp, kind: ast::VisibilityKind::Public, tokens: None }, vis: ast::Visibility { span: sp, kind: ast::VisibilityKind::Public, tokens: None },

View File

@ -1236,7 +1236,6 @@
mir_unwind_unreachable, mir_unwind_unreachable,
mir_variant, mir_variant,
miri, miri,
missing_docs,
mmx_reg, mmx_reg,
modifiers, modifiers,
module, module,

View File

@ -86,7 +86,7 @@ pub const a_test: test::TestDescAndFn =
fn a_test() {} fn a_test() {}
#[rustc_main] #[rustc_main]
#[coverage(off)] #[coverage(off)]
#[allow(missing_docs)] #[doc(hidden)]
pub fn main() -> () { pub fn main() -> () {
extern crate test; extern crate test;
test::test_main_static(&[&a_test, &m_test, &z_test]) test::test_main_static(&[&a_test, &m_test, &z_test])

View File

@ -2,7 +2,9 @@
//! on the generated test harness. //! on the generated test harness.
//@ check-pass //@ check-pass
//@ compile-flags: --test -Dmissing_docs //@ compile-flags: --test
#![forbid(missing_docs)]
#[test] #[test]
fn test() {} fn test() {}