diff options
| author | ltdk <usr@ltdk.xyz> | 2022-05-28 17:20:43 -0400 |
|---|---|---|
| committer | ltdk <usr@ltdk.xyz> | 2022-05-28 17:20:43 -0400 |
| commit | 5fabdb8f7fd0c2c48d47ce08126d27ade5beefd9 (patch) | |
| tree | 199a872e51d4105c51ab4ee1dbec2a0de02af34d /compiler/rustc_error_codes/src | |
| parent | ebbcbfc236ced21d5e6a92269edb704692ff26b8 (diff) | |
| download | rust-5fabdb8f7fd0c2c48d47ce08126d27ade5beefd9.tar.gz rust-5fabdb8f7fd0c2c48d47ce08126d27ade5beefd9.zip | |
Add E0788 for improper #[no_coverage] usage
Diffstat (limited to 'compiler/rustc_error_codes/src')
| -rw-r--r-- | compiler/rustc_error_codes/src/error_codes.rs | 1 | ||||
| -rw-r--r-- | compiler/rustc_error_codes/src/error_codes/E0788.md | 21 |
2 files changed, 22 insertions, 0 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes.rs b/compiler/rustc_error_codes/src/error_codes.rs index 61a177f291b..0114461e388 100644 --- a/compiler/rustc_error_codes/src/error_codes.rs +++ b/compiler/rustc_error_codes/src/error_codes.rs @@ -491,6 +491,7 @@ E0784: include_str!("./error_codes/E0784.md"), E0785: include_str!("./error_codes/E0785.md"), E0786: include_str!("./error_codes/E0786.md"), E0787: include_str!("./error_codes/E0787.md"), +E0788: include_str!("./error_codes/E0788.md"), ; // E0006, // merged with E0005 // E0008, // cannot bind by-move into a pattern guard diff --git a/compiler/rustc_error_codes/src/error_codes/E0788.md b/compiler/rustc_error_codes/src/error_codes/E0788.md new file mode 100644 index 00000000000..68bd53cea6f --- /dev/null +++ b/compiler/rustc_error_codes/src/error_codes/E0788.md @@ -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. |
