expand: Leave traces when expanding cfg attributes by petrochenkov · Pull Request #138844 · rust-lang/rust (original) (raw)

This is the same as #138515, but for cfg(true) instead of cfg_attr.

The difference is that cfg(true)s already left "traces" after themselves - the cfg attributes themselves, with expanded_inert_attrs set to true, with full tokens, available to proc macros.
This is not a reasonably expected behavior, but it could not be removed without a replacement, because a major rustdoc feature and a number of clippy lints rely on it. This PR implements a replacement.

This needs a crater run, because it changes observable behavior (in an intended way) - proc macros can no longer see expanded cfg(true) attributes.

(Some minor unnecessary special casing for sym::cfg_attr is also removed in this PR.)

r? @nnethercote