1
Fork 0
rust/compiler/rustc_expand/src
Jacob Pratt 3a8621d681
Rollup merge of #138844 - petrochenkov:cfgtrace2, r=nnethercote
expand: Leave traces when expanding `cfg` attributes

This is the same as https://github.com/rust-lang/rust/pull/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](https://github.com/rust-lang/rfcs/pull/3631) 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`
2025-03-27 13:11:17 -04:00
..
mbe Allow builtin macros to be used more than once. 2025-03-19 14:12:47 +01:00
base.rs Track whether an assoc item is in a trait impl or an inherent impl 2025-03-25 10:12:07 +00:00
build.rs Rollup merge of #138898 - fmease:decrustify-parser-post-ty-ascr, r=compiler-errors 2025-03-26 19:40:28 +11:00
config.rs expand: Leave traces when expanding cfg attributes 2025-03-26 15:30:12 +03:00
errors.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
expand.rs expand: Leave traces when expanding cfg attributes 2025-03-26 15:30:12 +03:00
lib.rs Remove #![warn(unreachable_pub)] from all compiler/ crates. 2025-03-11 13:14:21 +11:00
mbe.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
module.rs Reject macro calls inside of #![crate_name] 2025-02-15 16:47:30 +01:00
placeholders.rs Track whether an assoc item is in a trait impl or an inherent impl 2025-03-25 10:12:07 +00:00
proc_macro.rs Remove NtItem and NtStmt. 2025-03-07 14:51:07 +11:00
proc_macro_server.rs Use strip_{prefix|suffix} instead of {starts|ends}_with+indexing 2025-03-17 07:06:10 +00:00