Skip to content

Commit a1a8627

Browse files
committed
Allow missing_docs lint on the generated test harness
1 parent 843708a commit a1a8627

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

Diff for: compiler/rustc_builtin_macros/src/test_harness.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -326,6 +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);
329331

330332
// pub fn main() { ... }
331333
let main_ret_ty = ecx.ty(sp, ast::TyKind::Tup(ThinVec::new()));
@@ -355,7 +357,7 @@ fn mk_main(cx: &mut TestCtxt<'_>) -> P<ast::Item> {
355357

356358
let main = P(ast::Item {
357359
ident: main_id,
358-
attrs: thin_vec![main_attr, coverage_attr],
360+
attrs: thin_vec![main_attr, coverage_attr, missing_docs_attr],
359361
id: ast::DUMMY_NODE_ID,
360362
kind: main,
361363
vis: ast::Visibility { span: sp, kind: ast::VisibilityKind::Public, tokens: None },

Diff for: compiler/rustc_span/src/symbol.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1235,6 +1235,7 @@ symbols! {
12351235
mir_unwind_unreachable,
12361236
mir_variant,
12371237
miri,
1238+
missing_docs,
12381239
mmx_reg,
12391240
modifiers,
12401241
module,

Diff for: tests/pretty/tests-are-sorted.pp

+1
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@
8383
fn a_test() {}
8484
#[rustc_main]
8585
#[coverage(off)]
86+
#[allow(missing_docs)]
8687
pub fn main() -> () {
8788
extern crate test;
8889
test::test_main_static(&[&a_test, &m_test, &z_test])

Diff for: tests/ui/lint/lint-missing-doc-test.rs

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
//! This test checks that denying the missing_docs lint does not trigger
2+
//! on the generated test harness.
3+
4+
//@ check-pass
5+
//@ compile-flags: --test -Dmissing_docs

0 commit comments

Comments
 (0)