mirror of
https://github.com/allankoechke/rust.git
synced 2026-11-30 17:26:12 +00:00
Attribute templated mismatch suggestions come in two forms: - for a normal attribute, something like `#[inline(always)]`; - for an attribute embedded in `cfg_attr`, something like `inline(always)`. This commit replaces the former with the latter, and removes the need for the fragile span-based test for detecting embedded attributes in `template_suggestions`, and also `AttributeParseError::attr_span`. It takes advantage of the newly added (and accurate) `AttrItem::span` field. This change has a minor effect on error messages: when there are multiple suggestions their order can change because the `#[`/`]` are no longer included. This actually improves things, because e.g. if you write the invalid `#[inline(please)]`, the simpler `#[inline]` will be suggested ahead of the longer `#[inline(always)]` and `#[inline(never)`] alternatives.