Auto merge of #130766 - clarfonthey:stable-coverage-attribute, r=wesleywiser
Stabilize #[coverage] attribute Closes #84605, which passed FCP. Stabilisation report here: https://github.com/rust-lang/rust/issues/84605#issuecomment-2166514660 Also added to reference here: rust-lang/reference#1628 --- try-job: aarch64-apple try-job: x86_64-gnu try-job: x86_64-msvc
This commit is contained in:
commit
1d35638dc3
129 changed files with 378 additions and 521 deletions
|
|
@ -1,30 +0,0 @@
|
|||
# `coverage_attribute`
|
||||
|
||||
The tracking issue for this feature is: [#84605]
|
||||
|
||||
[#84605]: https://github.com/rust-lang/rust/issues/84605
|
||||
|
||||
---
|
||||
|
||||
The `coverage` attribute can be used to selectively disable coverage
|
||||
instrumentation in an annotated function. This might be useful to:
|
||||
|
||||
- Avoid instrumentation overhead in a performance critical function
|
||||
- Avoid generating coverage for a function that is not meant to be executed,
|
||||
but still target 100% coverage for the rest of the program.
|
||||
|
||||
## Example
|
||||
|
||||
```rust
|
||||
#![feature(coverage_attribute)]
|
||||
|
||||
// `foo()` will get coverage instrumentation (by default)
|
||||
fn foo() {
|
||||
// ...
|
||||
}
|
||||
|
||||
#[coverage(off)]
|
||||
fn bar() {
|
||||
// ...
|
||||
}
|
||||
```
|
||||
|
|
@ -237,7 +237,7 @@ pub const INERT_ATTRIBUTES: &[BuiltinAttribute] = &[
|
|||
template!(List: "address, kcfi, memory, thread"), DuplicatesOk,
|
||||
experimental!(no_sanitize)
|
||||
),
|
||||
gated!(coverage, Normal, template!(Word, List: "on|off"), WarnFollowing, coverage_attribute, experimental!(coverage)),
|
||||
ungated!(coverage, Normal, template!(Word, List: "on|off"), WarnFollowing),
|
||||
|
||||
ungated!(
|
||||
doc, Normal, template!(List: "hidden|inline|...", NameValueStr: "string"), DuplicatesOk
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue