Skip to content

Commit cc34d64

Browse files
committed
Use doc(hidden) instead of allow(missing_docs) in the test harness
So that it doesn't fail with `forbid(missing_docs)` Fixes rust-lang#130218
1 parent 5d456df commit cc34d64

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

compiler/rustc_builtin_macros/src/test_harness.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,8 @@ fn mk_main(cx: &mut TestCtxt<'_>) -> P<ast::Item> {
326326
let main_attr = ecx.attr_word(sym::rustc_main, sp);
327327
// #[coverage(off)]
328328
let coverage_attr = ecx.attr_nested_word(sym::coverage, sym::off, sp);
329-
// #[allow(missing_docs)]
330-
let missing_docs_attr = ecx.attr_nested_word(sym::allow, sym::missing_docs, sp);
329+
// #[doc(hidden)]
330+
let doc_hidden_attr = ecx.attr_nested_word(sym::doc, sym::hidden, sp);
331331

332332
// pub fn main() { ... }
333333
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> {
357357

358358
let main = P(ast::Item {
359359
ident: main_id,
360-
attrs: thin_vec![main_attr, coverage_attr, missing_docs_attr],
360+
attrs: thin_vec![main_attr, coverage_attr, doc_hidden_attr],
361361
id: ast::DUMMY_NODE_ID,
362362
kind: main,
363363
vis: ast::Visibility { span: sp, kind: ast::VisibilityKind::Public, tokens: None },

compiler/rustc_span/src/symbol.rs

-1
Original file line numberDiff line numberDiff line change
@@ -1236,7 +1236,6 @@ symbols! {
12361236
mir_unwind_unreachable,
12371237
mir_variant,
12381238
miri,
1239-
missing_docs,
12401239
mmx_reg,
12411240
modifiers,
12421241
module,

tests/pretty/tests-are-sorted.pp

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
fn a_test() {}
8787
#[rustc_main]
8888
#[coverage(off)]
89-
#[allow(missing_docs)]
89+
#[doc(hidden)]
9090
pub fn main() -> () {
9191
extern crate test;
9292
test::test_main_static(&[&a_test, &m_test, &z_test])

tests/ui/lint/lint-missing-doc-test.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
//! on the generated test harness.
33
44
//@ check-pass
5-
//@ compile-flags: --test -Dmissing_docs
5+
//@ compile-flags: --test
6+
7+
#![forbid(missing_docs)]
68

79
#[test]
810
fn test() {}

0 commit comments

Comments
 (0)