1
Fork 0

adds feature gating of no_coverage at either crate- or function-level

This commit is contained in:
Rich Kadel 2021-04-26 21:25:30 -07:00
parent 888d0b4c96
commit 3a5df48021
13 changed files with 142 additions and 63 deletions

View file

@ -16,10 +16,19 @@ pub fn expand_deriving_eq(
push: &mut dyn FnMut(Annotatable),
) {
let inline = cx.meta_word(span, sym::inline);
let no_coverage_ident =
rustc_ast::attr::mk_nested_word_item(Ident::new(sym::no_coverage, span));
let no_coverage_feature =
rustc_ast::attr::mk_list_item(Ident::new(sym::feature, span), vec![no_coverage_ident]);
let no_coverage = cx.meta_word(span, sym::no_coverage);
let hidden = rustc_ast::attr::mk_nested_word_item(Ident::new(sym::hidden, span));
let doc = rustc_ast::attr::mk_list_item(Ident::new(sym::doc, span), vec![hidden]);
let attrs = vec![cx.attribute(inline), cx.attribute(no_coverage), cx.attribute(doc)];
let attrs = vec![
cx.attribute(inline),
cx.attribute(no_coverage_feature),
cx.attribute(no_coverage),
cx.attribute(doc),
];
let trait_def = TraitDef {
span,
attributes: Vec::new(),