Rework no_coverage to coverage(off)
This commit is contained in:
parent
de4cba3a98
commit
8e03371fc3
27 changed files with 183 additions and 158 deletions
|
@ -1,4 +1,4 @@
|
|||
A `#[no_coverage]` attribute was applied to something which does not show up
|
||||
A `#[coverage]` attribute was applied to something which does not show up
|
||||
in code coverage, or is too granular to be excluded from the coverage report.
|
||||
|
||||
For now, this attribute can only be applied to function, method, and closure
|
||||
|
@ -9,18 +9,18 @@ will just emit an `unused_attributes` lint instead of this error.
|
|||
Example of erroneous code:
|
||||
|
||||
```compile_fail,E0788
|
||||
#[no_coverage]
|
||||
#[coverage(off)]
|
||||
struct Foo;
|
||||
|
||||
#[no_coverage]
|
||||
#[coverage(on)]
|
||||
const FOO: Foo = Foo;
|
||||
```
|
||||
|
||||
`#[no_coverage]` tells the compiler to not generate coverage instrumentation for
|
||||
a piece of code when the `-C instrument-coverage` flag is passed. Things like
|
||||
structs and consts are not coverable code, and thus cannot do anything with this
|
||||
attribute.
|
||||
`#[coverage(off)]` tells the compiler to not generate coverage instrumentation
|
||||
for a piece of code when the `-C instrument-coverage` flag is passed. Things
|
||||
like structs and consts are not coverable code, and thus cannot do anything
|
||||
with this attribute.
|
||||
|
||||
If you wish to apply this attribute to all methods in an impl or module,
|
||||
manually annotate each method; it is not possible to annotate the entire impl
|
||||
with a `#[no_coverage]` attribute.
|
||||
with a `#[coverage]` attribute.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue