rust/tests/ui/feature-gates/feature-gate-coverage-attribute.rs
Jieyou Xu db11e74723
Don't include current rustc version string in feature removed help
The version string is difficult to properly normalize out, and removing
it isn't a huge deal (the user can query version info easily through
`rustc --version` or `cargo --version`).

The normalization options were all non-ideal:

- Per-test version string normalization is nasty to maintain, and we
  need to maintain `n` copies of it.
- Centralized compiletest normalization (with a directive opt-out) is
  also not ideal, because `cfg(version(..))` tests can't have those
  accidentally normalized out (and you'd have to remember to opt-out).
2025-06-24 23:32:09 +08:00

15 lines
405 B
Rust

#![crate_type = "lib"]
#![feature(no_coverage)] //~ ERROR feature has been removed [E0557]
#[derive(PartialEq, Eq)] // ensure deriving `Eq` does not enable `feature(coverage)`
struct Foo {
a: u8,
b: u32,
}
#[coverage(off)] //~ ERROR the `#[coverage]` attribute is an experimental feature
fn requires_feature_coverage() -> bool {
let bar = Foo { a: 0, b: 0 };
bar == Foo { a: 0, b: 0 }
}