Add #[no_coverage]
to the test harness's fn main
This commit is contained in:
parent
9ecda8de85
commit
77af67ab64
4 changed files with 26 additions and 2 deletions
|
@ -232,7 +232,7 @@ fn generate_test_harness(
|
|||
let expn_id = ext_cx.resolver.expansion_for_ast_pass(
|
||||
DUMMY_SP,
|
||||
AstPass::TestHarness,
|
||||
&[sym::test, sym::rustc_attrs],
|
||||
&[sym::test, sym::rustc_attrs, sym::no_coverage],
|
||||
None,
|
||||
);
|
||||
let def_site = DUMMY_SP.with_def_site_ctxt(expn_id.to_expn_id());
|
||||
|
@ -313,6 +313,8 @@ fn mk_main(cx: &mut TestCtxt<'_>) -> P<ast::Item> {
|
|||
|
||||
// #[rustc_main]
|
||||
let main_attr = ecx.attr_word(sym::rustc_main, sp);
|
||||
// #[no_coverage]
|
||||
let no_coverage_attr = ecx.attr_word(sym::no_coverage, sp);
|
||||
|
||||
// pub fn main() { ... }
|
||||
let main_ret_ty = ecx.ty(sp, ast::TyKind::Tup(ThinVec::new()));
|
||||
|
@ -342,7 +344,7 @@ fn mk_main(cx: &mut TestCtxt<'_>) -> P<ast::Item> {
|
|||
|
||||
let main = P(ast::Item {
|
||||
ident: main_id,
|
||||
attrs: thin_vec![main_attr],
|
||||
attrs: thin_vec![main_attr, no_coverage_attr],
|
||||
id: ast::DUMMY_NODE_ID,
|
||||
kind: main,
|
||||
vis: ast::Visibility { span: sp, kind: ast::VisibilityKind::Public, tokens: None },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue