Files
rust/compiler/rustc_parse
Nicholas Nethercote ea7bee7515 Change AttrItem::span from a method to a field
Currently the method computes the span from the path's span and the
args' span. That used to be fine but then `unsafe(..)`/`safe(..)` were
added without it being changed. So it doesn't account for those optional
keywords and parentheses. The only way to handle those reliably is with
a dedicated span for the entire `AttrItem`.

Consequences:
- `NormalAttr` grows from 72 bytes to 80. (It's the only AST node that
  contains an `AttrItem`.) Not ideal, but non-doc-comment attributes
  aren't that common (not compared to expressions, for example). Also,
  `NormalAttr` is always boxed and jemalloc will round up 72 byte
  allocations to 80 bytes anyway.
- In `lint-unsafe-code.rs` various spans now point to `unsafe(foo)`
  rather than just `foo`. (It makes sense to include the `unsafe` keyword
  in the complaint about unsafety.)
2026-07-20 15:10:16 +10:00
..