Add E0788 for improper #[no_coverage] usage
This commit is contained in:
parent
ebbcbfc236
commit
5fabdb8f7f
5 changed files with 202 additions and 0 deletions
21
compiler/rustc_error_codes/src/error_codes/E0788.md
Normal file
21
compiler/rustc_error_codes/src/error_codes/E0788.md
Normal file
|
@ -0,0 +1,21 @@
|
|||
A `#[no_coverage]` attribute was incorrectly placed on something that couldn't
|
||||
be covered.
|
||||
|
||||
Example of erroneous code:
|
||||
|
||||
```compile_fail,E0788
|
||||
#[no_coverage]
|
||||
struct Foo;
|
||||
|
||||
#[no_coverage]
|
||||
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.
|
||||
|
||||
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.
|
Loading…
Add table
Add a link
Reference in a new issue