rust/compiler/rustc_codegen_ssa/src
Michael Goulet 9ce2a070b3
Rollup merge of #126682 - Zalathar:coverage-attr, r=lcnr
coverage: Overhaul validation of the `#[coverage(..)]` attribute

This PR makes sweeping changes to how the (currently-unstable) coverage attribute is validated:
- Multiple coverage attributes on the same item/expression are now treated as an error.
- The attribute must always be `#[coverage(off)]` or `#[coverage(on)]`, and the error messages for this are more consistent.
  -  A trailing comma is still allowed after off/on, since that's part of the normal attribute syntax.
- Some places that silently ignored a coverage attribute now produce an error instead.
  - These cases were all clearly bugs.
- Some places that ignored a coverage attribute (with a warning) now produce an error instead.
  - These were originally added as lints, but I don't think it makes much sense to knowingly allow new attributes to be used in meaningless places.
  - Some of these errors might soon disappear, if it's easy to extend recursive coverage attributes to things like modules and impl blocks.

---

One of the goals of this PR is to lay a more solid foundation for making the coverage attribute recursive, so that it applies to all nested functions/closures instead of just the one it is directly attached to.

Fixes #126658.

This PR incorporates #126659, which adds more tests for validation of the coverage attribute.

`@rustbot` label +A-code-coverage
2024-06-24 15:51:03 -04:00
..
back Rollup merge of #124712 - Enselic:deprecate-inline-threshold, r=pnkfelix 2024-06-24 15:51:00 -04:00
debuginfo Add Ty to ConstKind::Value 2024-06-05 22:25:41 +01:00
mir More GVN for PtrMetadata 2024-06-20 22:16:59 -07:00
traits Use a dedicated type instead of a reference for the diagnostic context 2024-06-18 15:42:11 +00:00
assert_module_sources.rs Remove #[macro_use] extern crate tracing from rustc_codegen_ssa. 2024-05-23 18:02:40 +10:00
base.rs Only compute vtable information during codegen 2024-06-14 20:35:45 -04:00
codegen_attrs.rs coverage: Tighten validation of #[coverage(off)] and #[coverage(on)] 2024-06-24 20:15:01 +10:00
common.rs ScalarInt: size mismatches are a bug, do not delay the panic 2024-06-10 13:43:16 +02:00
errors.rs coverage: Tighten validation of #[coverage(off)] and #[coverage(on)] 2024-06-24 20:15:01 +10:00
lib.rs Use tidy to sort crate attributes for all compiler crates. 2024-06-12 15:49:10 +10:00
meth.rs Omit non-needs_drop drop_in_place in vtables 2024-05-27 16:26:56 -04:00
mono_item.rs Remove #[macro_use] extern crate tracing from rustc_codegen_ssa. 2024-05-23 18:02:40 +10:00
size_of_val.rs Remove #[macro_use] extern crate tracing from rustc_codegen_ssa. 2024-05-23 18:02:40 +10:00
target_features.rs Remove extern crate rustc_middle from numerous crates. 2024-04-29 14:50:45 +10:00