Commit Graph

27 Commits

Author SHA1 Message Date
Jana Dönszelmann 70e26c1b7b take attr style into account in attr diagnostics 2025-08-16 10:51:09 +02:00
Jonathan Brouwer 4bb7bf64e0 Update uitests
Signed-off-by: Jonathan Brouwer <jonathantbrouwer@gmail.com>
2025-08-14 18:18:42 +02:00
Sasha Pourcelot 4e054fc4c4 Port #[coverage] to the new attribute system 2025-07-16 15:51:18 +02:00
Vadim Petrochenkov 20faf8532b compiletest: Make diagnostic kind mandatory on line annotations 2025-04-30 10:44:24 +03:00
Nicholas Nethercote ccb2194f96 Factor some code out of AstValidator::visit_items.
Currently it uses `walk_item` on some item kinds. For other item kinds
it visits the fields individually. For the latter group, this commit
adds `visit_attrs_vis` and `visit_attrs_vis_ident` which bundle up
visits to the fields that don't need special handling. This makes it
clearer that they haven't been forgotten about.

Also, it's better to do the attribute visits at the start because
attributes precede the items in the source code. Because of this, a
couple of tests have their output improved: errors appear in an order
that matches the source code order.
2025-04-02 09:16:34 +11:00
Michael Goulet 160905b625 Trim suggestion part before generating highlights 2025-02-21 00:54:01 +00:00
Michael Goulet 0a7ab1d6df More sophisticated span trimming 2025-02-21 00:41:17 +00:00
Esteban Küber f0845adb0c Show diff suggestion format on verbose replacement
```
error[E0610]: `{integer}` is a primitive type and therefore doesn't have fields
  --> $DIR/attempted-access-non-fatal.rs:7:15
   |
LL |     let _ = 2.l;
   |               ^
   |
help: if intended to be a floating point literal, consider adding a `0` after the period and a `f64` suffix
   |
LL -     let _ = 2.l;
LL +     let _ = 2.0f64;
   |
```
2025-02-10 20:21:39 +00:00
Zalathar e48fc62ce0 Un-redact one occurrence of "coverage attribute not allowed here" 2024-12-25 19:23:48 +11:00
Zalathar 3996209398 Overhaul error messages for disallowed coverage attributes 2024-12-25 16:17:09 +11:00
Zalathar 9124662da3 Expand the main test for where the coverage attribute is allowed
Some of these cases are also implicitly checked by other tests, but it's
helpful to also explicitly list them in the main test.
2024-12-25 16:01:26 +11:00
Zalathar 5e98118901 Fully redact the [E0788] error message in tests, to make changes easier 2024-12-25 16:00:47 +11:00
Zalathar d4005b6811 Rename tests/ui/coverage-attr/no-coverage.rs to allowed-positions.rs 2024-12-25 11:40:39 +11:00
Eric Huss 5d9f17f58c Add test for coverage on a body-less trait function 2024-12-24 00:09:39 +11:00
Zalathar 87c2f9a5be Revert "Auto merge of #130766 - clarfonthey:stable-coverage-attribute, r=wesleywiser"
This reverts commit 1d35638dc3, reversing
changes made to f23a80a4c2.
2024-12-23 12:30:37 +11:00
Eric Huss dbf5ae3a86 Add reference annotations for the coverage attribute 2024-12-18 15:03:44 -08:00
ltdk cb487cc2fa Stabilize #[coverage] attribute 2024-12-16 21:07:06 -05:00
Esteban Küber 65a54a7f27 Tweak multispan rendering
Consider comments and bare delimiters the same as an "empty line" for purposes of hiding rendered code output of long multispans. This results in more aggressive shortening of rendered output without losing too much context, specially in `*.stderr` tests that have "hidden" comments.
2024-12-12 23:36:27 +00:00
Zalathar 622d5898c2 Rename directive needs-profiler-support to needs-profiler-runtime 2024-10-09 20:58:27 +11:00
Zalathar 8e382ba022 Avoid ICE in coverage builds with bad #[coverage(..)] attributes
This code can sometimes witness malformed coverage attributes in builds that
are going to fail, so use `span_delayed_bug` to avoid an inappropriate ICE in
that case.
2024-10-03 21:12:24 +10:00
Esteban Küber 692bc344d5 Make parse error suggestions verbose and fix spans
Go over all structured parser suggestions and make them verbose style.

When suggesting to add or remove delimiters, turn them into multiple suggestion parts.
2024-07-12 03:02:57 +00:00
Zalathar 7f37f8af5f coverage: Allow #[coverage(..)] on impl and mod
These attributes apply to all enclosed functions/methods/closures, unless
explicitly overridden by another coverage attribute.
2024-06-26 10:08:05 +10:00
Zalathar 1852141219 coverage: Bless coverage attribute tests 2024-06-24 20:15:03 +10:00
Zalathar ebb3aa0d46 Also test that yes/no must be bare words 2024-06-20 17:11:53 +10:00
Zalathar 388aea471f More status-quo tests for the #[coverage(..)] attribute
These tests reveal some inconsistencies that are tracked by
<https://github.com/rust-lang/rust/issues/126658>.
2024-06-20 17:11:53 +10:00
Zalathar 9a084e6310 Add a more thorough test of incorrect/unusal #[coverage(..)] syntax
This test reflects the current implementation behaviour, which is not
necessarily the desired behaviour.
2024-06-18 21:07:37 +10:00
Zalathar 605b61534a Create tests/ui/coverage-attr/ 2024-06-18 20:30:25 +10:00