about summary refs log tree commit diff
path: root/compiler/rustc_error_codes/src/error_codes/E0788.md
blob: 1afa961f9b7c5a36b06019e42f7d5534cc071ca1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#### Note: this error code is no longer emitted by the compiler.

A `#[coverage(off|on)]` attribute was found in a position where it is not
allowed.

Coverage attributes can be applied to:
- Function and method declarations that have a body, including trait methods
  that have a default implementation.
- Closure expressions, in situations where attributes can be applied to
  expressions.
- `impl` blocks (inherent or trait), and modules.

Example of erroneous code:

```ignore (no longer emitted)
unsafe extern "C" {
    #[coverage(off)]
    fn foreign_fn();
}
```

When using the `-C instrument-coverage` flag, coverage attributes act as a
hint to the compiler that it should instrument or not instrument the
corresponding function or enclosed functions. The precise effect of applying
a coverage attribute is not guaranteed and may change in future compiler
versions.