Skip to content

Commit

Permalink
Use doc(hidden) instead of allow(missing_docs) in the test harness
Browse files Browse the repository at this point in the history
So that it doesn't fail with `forbid(missing_docs)`

Fixes rust-lang#130218
  • Loading branch information
ogoffart committed Sep 11, 2024
1 parent 5d456df commit cc34d64
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions compiler/rustc_builtin_macros/src/test_harness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()));
Expand Down Expand Up @@ -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 },
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_span/src/symbol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1236,7 +1236,6 @@ symbols! {
mir_unwind_unreachable,
mir_variant,
miri,
missing_docs,
mmx_reg,
modifiers,
module,
Expand Down
2 changes: 1 addition & 1 deletion tests/pretty/tests-are-sorted.pp
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
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])
Expand Down
4 changes: 3 additions & 1 deletion tests/ui/lint/lint-missing-doc-test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {}

0 comments on commit cc34d64

Please sign in to comment.