rust/compiler/rustc_builtin_macros
Nicholas Nethercote 43018eacb6 Ignore #[test_case] on anything other than fn/const/static.
`expand_test_case` looks for any item with a `#[test_case]` attribute
and adds a `test_path_symbol` attribute to it while also fiddling with
the item's ident's span.

This is pretty weird, because `#[test_case]` is only valid on
`fn`/`const`/`static` items, as far as I can tell. But you don't
currently get an error or warning if you use it on other kinds of items.

This commit changes things so that a `#[test_case]` item is modified
only if it is `fn`/`const`/`static`. This is relevant for moving idents
from `Item` to `ItemKind`, because some item kinds don't have an ident,
e.g. `impl` blocks.

The commit also does the following.
- Renames a local variable `test_id` as `test_ident`.
- Changes a `const` to `static` in
  `tests/ui/custom_test_frameworks/full.rs` to give the `static` case
  some test coverage.
- Adds a `struct` and `impl` to the same test to give some test coverage
  to the non-affected item kinds. These have a `FIXME` comment
  identifying the weirdness here. Hopefully this will be useful
  breadcrumbs for somebody else in the future.
2025-04-01 13:42:00 +11:00
..
src Ignore #[test_case] on anything other than fn/const/static. 2025-04-01 13:42:00 +11:00
Cargo.toml Remove unnecessary [lints.rust] sections. 2025-03-11 12:11:04 +11:00
messages.ftl Combine autodiff errors together 2025-03-11 09:37:53 +01:00