Allow missing_docs
lint on the generated test harness
This commit is contained in:
parent
843708a32e
commit
a1a8627dd7
@ -326,6 +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);
|
||||
|
||||
// pub fn main() { ... }
|
||||
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> {
|
||||
|
||||
let main = P(ast::Item {
|
||||
ident: main_id,
|
||||
attrs: thin_vec![main_attr, coverage_attr],
|
||||
attrs: thin_vec![main_attr, coverage_attr, missing_docs_attr],
|
||||
id: ast::DUMMY_NODE_ID,
|
||||
kind: main,
|
||||
vis: ast::Visibility { span: sp, kind: ast::VisibilityKind::Public, tokens: None },
|
||||
|
@ -1235,6 +1235,7 @@
|
||||
mir_unwind_unreachable,
|
||||
mir_variant,
|
||||
miri,
|
||||
missing_docs,
|
||||
mmx_reg,
|
||||
modifiers,
|
||||
module,
|
||||
|
@ -83,6 +83,7 @@ pub const a_test: test::TestDescAndFn =
|
||||
fn a_test() {}
|
||||
#[rustc_main]
|
||||
#[coverage(off)]
|
||||
#[allow(missing_docs)]
|
||||
pub fn main() -> () {
|
||||
extern crate test;
|
||||
test::test_main_static(&[&a_test, &m_test, &z_test])
|
||||
|
5
tests/ui/lint/lint-missing-doc-test.rs
Normal file
5
tests/ui/lint/lint-missing-doc-test.rs
Normal file
@ -0,0 +1,5 @@
|
||||
//! This test checks that denying the missing_docs lint does not trigger
|
||||
//! on the generated test harness.
|
||||
|
||||
//@ check-pass
|
||||
//@ compile-flags: --test -Dmissing_docs
|
Loading…
Reference in New Issue
Block a user