Skip to content

Conversation

mu001999
Copy link
Contributor

@mu001999 mu001999 commented Sep 24, 2025

Fixes #146968

Emit error CfgPredicateIdentifier if the word is path-segment keyword.

r? petrochenkov

@rustbot
Copy link
Collaborator

rustbot commented Sep 24, 2025

Some changes occurred in compiler/rustc_attr_parsing

cc @jdonszelmann

@rustbot rustbot added A-attributes Area: Attributes (`#[…]`, `#![…]`) S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 24, 2025
@petrochenkov
Copy link
Contributor

Could you

  • add similar test cases for some non path-segment keyword, like struct
  • add test cases for --cfg on command line and make sure that they behave identically to cfg! and #[cfg].

After that we should be able to run crater on this.
@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 26, 2025
@rustbot
Copy link
Collaborator

rustbot commented Sep 26, 2025

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@mu001999 mu001999 force-pushed the fix/path-kw-as-cfg-pred branch from 505d13f to b2be57d Compare September 27, 2025 03:24
@rustbot

This comment has been minimized.

@mu001999
Copy link
Contributor Author

add test cases for --cfg on command line and make sure that they behave identically to cfg! and #[cfg]

--cfg will emit same error but will be suppressed because parse_cfg is called with ParseSess::with_fatal_emitter

@mu001999
Copy link
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 27, 2025
@petrochenkov
Copy link
Contributor

add test cases for --cfg on command line and make sure that they behave identically to cfg! and #[cfg]

--cfg will emit same error but will be suppressed because parse_cfg is called with ParseSess::with_fatal_emitter

with_fatal_emitter doesn't suppress errors, it makes them fatal.
--cfg parsing has its own error reporting logic in fn parse_cfg in compiler\rustc_interface\src\interface.rs, and the new errors are not emitted there.
@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Sep 30, 2025
@mu001999
Copy link
Contributor Author

with_fatal_emitter doesn't suppress errors, it makes them fatal.

@petrochenkov I found with_fatal_emitter create dcx with FatalOnlyEmitter, see

pub fn with_fatal_emitter(locale_resources: Vec<&'static str>, fatal_note: String) -> Self {
let translator = Translator::with_fallback_bundle(locale_resources, false);
let sm = Arc::new(SourceMap::new(FilePathMapping::empty()));
let fatal_emitter =
Box::new(HumanEmitter::new(stderr_destination(ColorConfig::Auto), translator));
let dcx = DiagCtxt::new(Box::new(FatalOnlyEmitter {
fatal_emitter,
fatal_note: Some(fatal_note),
}))
.disable_warnings();
ParseSess::with_dcx(dcx, sm)
}

and the comment of FatalOnlyEmitter and the impl of FatalOnlyEmitter::emit_diagnostic show only errors with diag.level == Level::Fatal can be emitted, see

/// An emitter that does nothing when emitting a non-fatal diagnostic.
/// Fatal diagnostics are forwarded to `fatal_emitter` to avoid silent
/// failures of rustc, as witnessed e.g. in issue #89358.
pub struct FatalOnlyEmitter {
pub fatal_emitter: Box<dyn Emitter + DynSend>,
pub fatal_note: Option<String>,
}
impl Emitter for FatalOnlyEmitter {
fn source_map(&self) -> Option<&SourceMap> {
None
}
fn emit_diagnostic(&mut self, mut diag: DiagInner, registry: &Registry) {
if diag.level == Level::Fatal {
if let Some(fatal_note) = &self.fatal_note {
diag.sub(Level::Note, fatal_note.clone(), MultiSpan::new());
}
self.fatal_emitter.emit_diagnostic(diag, registry);
}
}
fn translator(&self) -> &Translator {
self.fatal_emitter.translator()
}
}

@mu001999
Copy link
Contributor Author

mu001999 commented Sep 30, 2025

I have debug the logic in fn parse_cfg, and the err.emit is called in fact, but it is suppressed by the FatalOnlyEmitter.

@petrochenkov
Copy link
Contributor

petrochenkov commented Sep 30, 2025

Ah, ok, "fatal emitter" means "fatal-only emitter".

In any case, the behavior is not correct.
I guess the assumption when using the fatal emitter was that we always reach the "expected key or key="value"" error at the bottom anyway, but that's not actually the case.
If we get to return (ident.name, meta_item.value_str()), then all the non-fatal errors are lost, which is incorrect.

@mu001999 mu001999 marked this pull request as draft October 9, 2025 06:02
@rust-log-analyzer

This comment has been minimized.

@mu001999 mu001999 force-pushed the fix/path-kw-as-cfg-pred branch from 956aa91 to 97cd2c7 Compare October 9, 2025 11:16
@rust-log-analyzer

This comment has been minimized.

@mu001999 mu001999 force-pushed the fix/path-kw-as-cfg-pred branch from 97cd2c7 to a7d6090 Compare October 9, 2025 11:54
@rust-log-analyzer

This comment has been minimized.

@mu001999 mu001999 force-pushed the fix/path-kw-as-cfg-pred branch from a7d6090 to c8bc460 Compare October 9, 2025 15:31
@rust-log-analyzer

This comment has been minimized.

@mu001999 mu001999 force-pushed the fix/path-kw-as-cfg-pred branch from cc53ca4 to 9c2ed4c Compare October 9, 2025 18:10
@mu001999
Copy link
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 17, 2025
@mu001999 mu001999 force-pushed the fix/path-kw-as-cfg-pred branch from 0f6589e to 2309d40 Compare October 17, 2025 12:46
if ident.is_reserved() {
if !ident.name.can_be_raw() {
if s.trim().starts_with(&format!("r#{}", ident.as_str())) {
error!(format!("argument key must be an identifier, but `{}` cannot be a raw identifier", ident.name));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So now we have to manually detect all recoverable parsing errors here, not just keywords instead of identifiers.
The set of recoverable errors is open, parser does much more recovery now than at the times of #64467, you can't catch them all manually.

If we don't want to remove the use of fatal-only emitter, then we need to set Recovery::Forbidden in the parser, then parse_meta_item will return Err on any syntactically invalid stuff instead of recovering.
Then the only remaining thing to check will be is_path_segment_keyword, like in rustc_attr_parsing.

@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 17, 2025
@rustbot
Copy link
Collaborator

rustbot commented Oct 17, 2025

rustc_errors::emitter was changed

cc @Muscraft

@mu001999 mu001999 force-pushed the fix/path-kw-as-cfg-pred branch from 7f6d7bf to 96e3c6b Compare October 17, 2025 15:58
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this test and the change in behavior of --check-cfg was specifically added at the request of T-lang in the stabilization of #[cfg(true)]/#[cfg(false)] #138632 (comment)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR will need to go through lang team too after a crater run.
(Similarly to other cases in this PR, this test case was accepted because --cfg parsing swallowed non-fatal parsing errors.)

@rust-log-analyzer

This comment has been minimized.

@mu001999 mu001999 force-pushed the fix/path-kw-as-cfg-pred branch from 96e3c6b to c41ceed Compare October 17, 2025 17:01
@rustbot rustbot added the A-run-make Area: port run-make Makefiles to rmake.rs label Oct 17, 2025
@rust-log-analyzer

This comment has been minimized.

@rustbot
Copy link
Collaborator

rustbot commented Oct 18, 2025

Some changes occurred in src/tools/clippy

cc @rust-lang/clippy

@rustbot rustbot added the T-clippy Relevant to the Clippy team. label Oct 18, 2025
@mu001999 mu001999 force-pushed the fix/path-kw-as-cfg-pred branch from 6c405e7 to 9171a1c Compare October 18, 2025 02:14
@mu001999
Copy link
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 18, 2025
@samueltardieu
Copy link
Member

It looks like you removed some .32bit.stderr files from src/tools/clippy/tests/ui/ instead of renaming them.

@mu001999 mu001999 force-pushed the fix/path-kw-as-cfg-pred branch from 9171a1c to c0b4b6c Compare October 18, 2025 12:56
@mu001999
Copy link
Contributor Author

mu001999 commented Oct 18, 2025

It looks like you removed some .32bit.stderr files from src/tools/clippy/tests/ui/ instead of renaming them.

Good catch! Recovered. Seems the 32bit revision is not tested on both my device and CI 🤔

@bors
Copy link
Collaborator

bors commented Oct 18, 2025

☔ The latest upstream changes (presumably #147842) made this pull request unmergeable. Please resolve the merge conflicts.

@mu001999 mu001999 force-pushed the fix/path-kw-as-cfg-pred branch from c0b4b6c to 8321359 Compare October 19, 2025 02:03
@rustbot
Copy link
Collaborator

rustbot commented Oct 19, 2025

This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed.

Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers.

@rust-log-analyzer
Copy link
Collaborator

The job aarch64-gnu-llvm-20-1 failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
test [ui] tests/ui/cfg/expanded-cfg.rs ... ok
test [ui] tests/ui/cfg/disallowed-cli-cfgs.rs#windows_ ... ok
test [ui] tests/ui/cfg/disallowed-cli-cfgs.rs#unix_ ... ok
test [ui] tests/ui/cfg/nested-cfg-attr-conditional-compilation.rs ... ok
test [ui] tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.rs#cfg_crate ... ok
test [ui] tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.rs#cfg_priv ... ok
test [ui] tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.rs#cfg_raw_crate ... ok
test [ui] tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.rs#cfg_raw_self_lower ... ok
test [ui] tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.rs#cfg_raw_self_upper ... ok
test [ui] tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.rs#cfg_raw_super ... ok
test [ui] tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.rs#cfg_raw_underscore ... ok
test [ui] tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.rs#cfg_self_lower ... ok
test [ui] tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.rs#cfg_self_upper ... ok
test [ui] tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.rs#cfg_super ... ok
test [ui] tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.rs#cfg_struct ... ok
test [ui] tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.rs#cfg_underscore ... ok
test [ui] tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.rs#check_cfg_crate ... ok
test [ui] tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.rs#check_cfg_priv ... ok
test [ui] tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.rs#check_cfg_raw_crate ... ok
test [ui] tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.rs#check_cfg_raw_self_lower ... ok
test [ui] tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.rs#check_cfg_raw_self_upper ... ok
test [ui] tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.rs#check_cfg_raw_super ... ok
test [ui] tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.rs#check_cfg_raw_underscore ... ok
test [ui] tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.rs#check_cfg_self_upper ... ok
test [ui] tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.rs#check_cfg_self_lower ... ok
test [ui] tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.rs#check_cfg_struct ... ok
test [ui] tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.rs#check_cfg_super ... ok
test [ui] tests/ui/cfg/path-kw-as-cfg-pred-cli-check-cfg.rs#check_cfg_underscore ... ok
test [ui] tests/ui/cfg/path-kw-as-cfg-pred-cli-raw-allow.rs ... ok
test [ui] tests/ui/cfg/raw-true-false.rs ... ok
test [ui] tests/ui/cfg/path-kw-as-cfg-pred.rs ... FAILED
test [ui] tests/ui/check-cfg/allow-at-crate-level.rs ... ok
test [ui] tests/ui/check-cfg/allow-macro-cfg.rs ... ok
test [ui] tests/ui/check-cfg/allow-same-level.rs ... ok
test [ui] tests/ui/check-cfg/allow-upper-level.rs ... ok
test [ui] tests/ui/check-cfg/allow-top-level.rs ... ok
---
test [ui] tests/ui/zero-sized/zero-sized-btreemap-insert.rs ... ok

failures:

---- [ui] tests/ui/cfg/path-kw-as-cfg-pred.rs stdout ----
Saved the actual stderr to `/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/cfg/path-kw-as-cfg-pred/path-kw-as-cfg-pred.stderr`
diff of stderr:

118 LL | #[cfg_attr(r#_, cfg(r#_))]
119    |                     ^^^
120 
- error: `cfg` predicate key must be an identifier
-   --> $DIR/path-kw-as-cfg-pred.rs:18:7
+ error[E0539]: malformed `cfg` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:18:1
123    |
124 LL | #[cfg(crate)]
-    |       ^^^^^
+    | ^^^^^^-----^^
+    | |     |
+    | |     expected a valid identifier here
+    | help: must be of the form: `#[cfg(predicate)]`
+    |
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
126 
- error: `cfg` predicate key must be an identifier
-   --> $DIR/path-kw-as-cfg-pred.rs:20:7
+ error[E0539]: malformed `cfg` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:20:1
129    |
130 LL | #[cfg(super)]
-    |       ^^^^^
+    | ^^^^^^-----^^
+    | |     |
+    | |     expected a valid identifier here
+    | help: must be of the form: `#[cfg(predicate)]`
+    |
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
132 
- error: `cfg` predicate key must be an identifier
-   --> $DIR/path-kw-as-cfg-pred.rs:22:7
+ error[E0539]: malformed `cfg` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:22:1
135    |
136 LL | #[cfg(self)]
-    |       ^^^^
+    | ^^^^^^----^^
+    | |     |
+    | |     expected a valid identifier here
+    | help: must be of the form: `#[cfg(predicate)]`
+    |
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
138 
- error: `cfg` predicate key must be an identifier
-   --> $DIR/path-kw-as-cfg-pred.rs:24:7
+ error[E0539]: malformed `cfg` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:24:1
141    |
142 LL | #[cfg(Self)]
-    |       ^^^^
+    | ^^^^^^----^^
+    | |     |
+    | |     expected a valid identifier here
+    | help: must be of the form: `#[cfg(predicate)]`
+    |
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
144 
- error: `cfg` predicate key must be an identifier
-   --> $DIR/path-kw-as-cfg-pred.rs:26:12
+ error[E0539]: malformed `cfg_attr` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:26:1
147    |
148 LL | #[cfg_attr(crate, path = "foo")]
-    |            ^^^^^
+    | ^^^^^^^^^^^-----^^^^^^^^^^^^^^^^
+    | |          |
+    | |          expected a valid identifier here
+    | help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]`
+    |
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
150 
- error: `cfg` predicate key must be an identifier
-   --> $DIR/path-kw-as-cfg-pred.rs:28:12
+ error[E0539]: malformed `cfg_attr` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:28:1
153    |
154 LL | #[cfg_attr(super, path = "foo")]
-    |            ^^^^^
+    | ^^^^^^^^^^^-----^^^^^^^^^^^^^^^^
+    | |          |
+    | |          expected a valid identifier here
+    | help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]`
+    |
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
156 
- error: `cfg` predicate key must be an identifier
-   --> $DIR/path-kw-as-cfg-pred.rs:30:12
+ error[E0539]: malformed `cfg_attr` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:30:1
159    |
160 LL | #[cfg_attr(self, path = "foo")]
-    |            ^^^^
+    | ^^^^^^^^^^^----^^^^^^^^^^^^^^^^
+    | |          |
+    | |          expected a valid identifier here
+    | help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]`
+    |
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
162 
- error: `cfg` predicate key must be an identifier
-   --> $DIR/path-kw-as-cfg-pred.rs:32:12
+ error[E0539]: malformed `cfg_attr` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:32:1
165    |
166 LL | #[cfg_attr(Self, path = "foo")]
-    |            ^^^^
+    | ^^^^^^^^^^^----^^^^^^^^^^^^^^^^
+    | |          |
+    | |          expected a valid identifier here
+    | help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]`
+    |
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
168 
- error: `cfg` predicate key must be an identifier
-   --> $DIR/path-kw-as-cfg-pred.rs:34:22
+ error[E0539]: malformed `cfg` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:34:18
171    |
172 LL | #[cfg_attr(true, cfg(crate))]
-    |                      ^^^^^
+    |                  ^^^^-----^
+    |                  |   |
+    |                  |   expected a valid identifier here
+    |                  help: must be of the form: `#[cfg(predicate)]`
+    |
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
174 
- error: `cfg` predicate key must be an identifier
-   --> $DIR/path-kw-as-cfg-pred.rs:36:22
+ error[E0539]: malformed `cfg` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:36:18
177    |
178 LL | #[cfg_attr(true, cfg(super))]
-    |                      ^^^^^
+    |                  ^^^^-----^
+    |                  |   |
+    |                  |   expected a valid identifier here
+    |                  help: must be of the form: `#[cfg(predicate)]`
+    |
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
180 
- error: `cfg` predicate key must be an identifier
-   --> $DIR/path-kw-as-cfg-pred.rs:38:22
+ error[E0539]: malformed `cfg` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:38:18
183    |
184 LL | #[cfg_attr(true, cfg(self))]
-    |                      ^^^^
+    |                  ^^^^----^
+    |                  |   |
+    |                  |   expected a valid identifier here
+    |                  help: must be of the form: `#[cfg(predicate)]`
+    |
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
186 
- error: `cfg` predicate key must be an identifier
-   --> $DIR/path-kw-as-cfg-pred.rs:40:22
+ error[E0539]: malformed `cfg` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:40:18
189    |
190 LL | #[cfg_attr(true, cfg(Self))]
-    |                      ^^^^
+    |                  ^^^^----^
+    |                  |   |
+    |                  |   expected a valid identifier here
+    |                  help: must be of the form: `#[cfg(predicate)]`
+    |
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
192 
193 error: expected identifier, found keyword `struct`
194   --> $DIR/path-kw-as-cfg-pred.rs:43:7

254 LL | #[cfg_attr(true, cfg(_))]
255    |                      ^ expected identifier, found reserved identifier
256 
- error: `cfg` predicate key must be an identifier
-   --> $DIR/path-kw-as-cfg-pred.rs:88:7
+ error[E0539]: malformed `cfg` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:88:1
259    |
260 LL | #[cfg(r#crate)]
-    |       ^^^^^^^
+    | ^^^^^^-------^^
+    | |     |
+    | |     expected a valid identifier here
+    | help: must be of the form: `#[cfg(predicate)]`
+    |
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
262 
- error: `cfg` predicate key must be an identifier
-   --> $DIR/path-kw-as-cfg-pred.rs:91:7
+ error[E0539]: malformed `cfg` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:91:1
265    |
266 LL | #[cfg(r#super)]
-    |       ^^^^^^^
+    | ^^^^^^-------^^
+    | |     |
+    | |     expected a valid identifier here
+    | help: must be of the form: `#[cfg(predicate)]`
+    |
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
268 
- error: `cfg` predicate key must be an identifier
-   --> $DIR/path-kw-as-cfg-pred.rs:94:7
+ error[E0539]: malformed `cfg` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:94:1
271    |
272 LL | #[cfg(r#self)]
-    |       ^^^^^^
+    | ^^^^^^------^^
+    | |     |
+    | |     expected a valid identifier here
+    | help: must be of the form: `#[cfg(predicate)]`
+    |
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
274 
- error: `cfg` predicate key must be an identifier
-   --> $DIR/path-kw-as-cfg-pred.rs:97:7
+ error[E0539]: malformed `cfg` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:97:1
277    |
278 LL | #[cfg(r#Self)]
-    |       ^^^^^^
- 
- error: `cfg` predicate key must be an identifier
-   --> $DIR/path-kw-as-cfg-pred.rs:100:12
+    | ^^^^^^------^^
+    | |     |
+    | |     expected a valid identifier here
+    | help: must be of the form: `#[cfg(predicate)]`
283    |
- LL | #[cfg_attr(r#crate, cfg(r#crate))]
-    |            ^^^^^^^
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
286 
- error: `cfg` predicate key must be an identifier
-   --> $DIR/path-kw-as-cfg-pred.rs:100:25
+ error[E0539]: malformed `cfg_attr` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:100:1
289    |
290 LL | #[cfg_attr(r#crate, cfg(r#crate))]
-    |                         ^^^^^^^
- 
- error: `cfg` predicate key must be an identifier
-   --> $DIR/path-kw-as-cfg-pred.rs:105:12
+    | ^^^^^^^^^^^-------^^^^^^^^^^^^^^^^
+    | |          |
+    | |          expected a valid identifier here
+    | help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]`
295    |
- LL | #[cfg_attr(r#super, cfg(r#super))]
-    |            ^^^^^^^
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
298 
- error: `cfg` predicate key must be an identifier
-   --> $DIR/path-kw-as-cfg-pred.rs:105:25
+ error[E0539]: malformed `cfg_attr` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:105:1
301    |
302 LL | #[cfg_attr(r#super, cfg(r#super))]
-    |                         ^^^^^^^
- 
- error: `cfg` predicate key must be an identifier
-   --> $DIR/path-kw-as-cfg-pred.rs:110:12
+    | ^^^^^^^^^^^-------^^^^^^^^^^^^^^^^
+    | |          |
+    | |          expected a valid identifier here
+    | help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]`
307    |
- LL | #[cfg_attr(r#self, cfg(r#self))]
-    |            ^^^^^^
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
310 
- error: `cfg` predicate key must be an identifier
-   --> $DIR/path-kw-as-cfg-pred.rs:110:24
+ error[E0539]: malformed `cfg_attr` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:110:1
313    |
314 LL | #[cfg_attr(r#self, cfg(r#self))]
-    |                        ^^^^^^
- 
- error: `cfg` predicate key must be an identifier
-   --> $DIR/path-kw-as-cfg-pred.rs:115:12
+    | ^^^^^^^^^^^------^^^^^^^^^^^^^^^
+    | |          |
+    | |          expected a valid identifier here
+    | help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]`
319    |
- LL | #[cfg_attr(r#Self, cfg(r#Self))]
-    |            ^^^^^^
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
322 
- error: `cfg` predicate key must be an identifier
-   --> $DIR/path-kw-as-cfg-pred.rs:115:24
+ error[E0539]: malformed `cfg_attr` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:115:1
325    |
326 LL | #[cfg_attr(r#Self, cfg(r#Self))]
-    |                        ^^^^^^
+    | ^^^^^^^^^^^------^^^^^^^^^^^^^^^
+    | |          |
+    | |          expected a valid identifier here
+    | help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]`
+    |
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
328 
- error: `cfg` predicate key must be an identifier
-   --> $DIR/path-kw-as-cfg-pred.rs:7:15
+ error[E0539]: malformed `cfg` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:7:9
331    |
332 LL |         #[cfg($crate)]
-    |               ^^^^^^
+    |         ^^^^^^------^^
+    |         |     |
+    |         |     expected a valid identifier here
+    |         help: must be of the form: `#[cfg(predicate)]`
334 ...
335 LL |     foo!();
336    |     ------ in this macro invocation

337    |
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
338    = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
339 
- error: `cfg` predicate key must be an identifier
-   --> $DIR/path-kw-as-cfg-pred.rs:9:20
+ error[E0539]: malformed `cfg_attr` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:9:9
342    |
343 LL |         #[cfg_attr($crate, path = "foo")]
-    |                    ^^^^^^
+    |         ^^^^^^^^^^^------^^^^^^^^^^^^^^^^
+    |         |          |
+    |         |          expected a valid identifier here
+    |         help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]`
345 ...
346 LL |     foo!();
347    |     ------ in this macro invocation

348    |
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
349    = note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
350 
- error: `cfg` predicate key must be an identifier
-   --> $DIR/path-kw-as-cfg-pred.rs:11:30
+ error[E0539]: malformed `cfg` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:11:26
353    |
354 LL |         #[cfg_attr(true, cfg($crate))]
-    |                              ^^^^^^
+    |                          ^^^^------^
+    |                          |   |
+    |                          |   expected a valid identifier here
+    |                          help: must be of the form: `#[cfg(predicate)]`
356 ...
357 LL |     foo!();
358    |     ------ in this macro invocation

359    |
---
+ For more information about this error, try `rustc --explain E0539`.
441 

Note: some mismatched output was normalized before being compared
-   --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:18:1
-   --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:20:1
-   --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:22:1
-   --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:24:1
-   --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:26:1
-   --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:28:1
-   --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:30:1
-   --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:32:1
-   --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:34:18
-   --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:36:18
-   --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:38:18
-   --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:40:18
-   --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:88:1
-   --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:91:1
-   --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:94:1
-   --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:97:1
-   --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:100:1
-   --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:105:1
-   --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:110:1
-   --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:115:1
-   --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:7:9
-   --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:9:9
-   --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:11:26
+ error[E0539]: malformed `cfg` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:18:1
+    | ^^^^^^-----^^
+    | |     |
+    | |     expected a valid identifier here
+    | help: must be of the form: `#[cfg(predicate)]`
+    |
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
+ error[E0539]: malformed `cfg` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:20:1
+    | ^^^^^^-----^^
+    | |     |
+    | |     expected a valid identifier here
+    | help: must be of the form: `#[cfg(predicate)]`
+    |
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
+ error[E0539]: malformed `cfg` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:22:1
+    | ^^^^^^----^^
+    | |     |
+    | |     expected a valid identifier here
+    | help: must be of the form: `#[cfg(predicate)]`
+    |
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
+ error[E0539]: malformed `cfg` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:24:1
+    | ^^^^^^----^^
+    | |     |
+    | |     expected a valid identifier here
+    | help: must be of the form: `#[cfg(predicate)]`
+    |
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
+ error[E0539]: malformed `cfg_attr` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:26:1
+    | ^^^^^^^^^^^-----^^^^^^^^^^^^^^^^
+    | |          |
+    | |          expected a valid identifier here
+    | help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]`
+    |
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
+ error[E0539]: malformed `cfg_attr` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:28:1
+    | ^^^^^^^^^^^-----^^^^^^^^^^^^^^^^
+    | |          |
+    | |          expected a valid identifier here
+    | help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]`
+    |
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
+ error[E0539]: malformed `cfg_attr` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:30:1
+    | ^^^^^^^^^^^----^^^^^^^^^^^^^^^^
+    | |          |
+    | |          expected a valid identifier here
+    | help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]`
+    |
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
+ error[E0539]: malformed `cfg_attr` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:32:1
+    | ^^^^^^^^^^^----^^^^^^^^^^^^^^^^
+    | |          |
+    | |          expected a valid identifier here
+    | help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]`
+    |
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
+ error[E0539]: malformed `cfg` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:34:18
+    |                  ^^^^-----^
+    |                  |   |
+    |                  |   expected a valid identifier here
+    |                  help: must be of the form: `#[cfg(predicate)]`
+    |
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
+ error[E0539]: malformed `cfg` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:36:18
+    |                  ^^^^-----^
+    |                  |   |
+    |                  |   expected a valid identifier here
+    |                  help: must be of the form: `#[cfg(predicate)]`
+    |
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
+ error[E0539]: malformed `cfg` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:38:18
+    |                  ^^^^----^
+    |                  |   |
+    |                  |   expected a valid identifier here
+    |                  help: must be of the form: `#[cfg(predicate)]`
+    |
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
+ error[E0539]: malformed `cfg` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:40:18
+    |                  ^^^^----^
+    |                  |   |
+    |                  |   expected a valid identifier here
+    |                  help: must be of the form: `#[cfg(predicate)]`
+    |
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
+ error[E0539]: malformed `cfg` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:88:1
+    | ^^^^^^-------^^
+    | |     |
+    | |     expected a valid identifier here
+    | help: must be of the form: `#[cfg(predicate)]`
+    |
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
+ error[E0539]: malformed `cfg` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:91:1
+    | ^^^^^^-------^^
+    | |     |
+    | |     expected a valid identifier here
+    | help: must be of the form: `#[cfg(predicate)]`
+    |
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
+ error[E0539]: malformed `cfg` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:94:1
+    | ^^^^^^------^^
+    | |     |
+    | |     expected a valid identifier here
+    | help: must be of the form: `#[cfg(predicate)]`
+    |
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
+ error[E0539]: malformed `cfg` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:97:1
+    | ^^^^^^------^^
+    | |     |
+    | |     expected a valid identifier here
+    | help: must be of the form: `#[cfg(predicate)]`
+    |
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
+ error[E0539]: malformed `cfg_attr` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:100:1
+    | ^^^^^^^^^^^-------^^^^^^^^^^^^^^^^
+    | |          |
+    | |          expected a valid identifier here
+    | help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]`
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
+ error[E0539]: malformed `cfg_attr` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:105:1
+    | ^^^^^^^^^^^-------^^^^^^^^^^^^^^^^
+    | |          |
+    | |          expected a valid identifier here
+    | help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]`
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
+ error[E0539]: malformed `cfg_attr` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:110:1
+    | ^^^^^^^^^^^------^^^^^^^^^^^^^^^
+    | |          |
+    | |          expected a valid identifier here
+    | help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]`
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
+ error[E0539]: malformed `cfg_attr` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:115:1
+    | ^^^^^^^^^^^------^^^^^^^^^^^^^^^
+    | |          |
+    | |          expected a valid identifier here
+    | help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]`
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
+ error[E0539]: malformed `cfg` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:7:9
+    |         ^^^^^^------^^
+    |         |     |
+    |         |     expected a valid identifier here
+    |         help: must be of the form: `#[cfg(predicate)]`
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
+ error[E0539]: malformed `cfg_attr` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:9:9
+    |         ^^^^^^^^^^^------^^^^^^^^^^^^^^^^
+    |         |          |
+    |         |          expected a valid identifier here
+    |         help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]`
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>
+ error[E0539]: malformed `cfg` attribute input
+   --> $DIR/path-kw-as-cfg-pred.rs:11:26
+    |                          ^^^^------^
+    |                          |   |
+    |                          |   expected a valid identifier here
+    |                          help: must be of the form: `#[cfg(predicate)]`
+    = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
+ error: aborting due to 64 previous errors
+ For more information about this error, try `rustc --explain E0539`.


The actual stderr differed from the expected stderr
To update references, rerun the tests and pass the `--bless` flag
To only update this specific test, also pass `--test-args cfg/path-kw-as-cfg-pred.rs`

error: 1 errors occurred comparing output.
status: exit status: 1
command: env -u RUSTC_LOG_COLOR RUSTC_ICE="0" RUST_BACKTRACE="short" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs" "-Zthreads=1" "-Zsimulate-remapped-rust-src-base=/rustc/FAKE_PREFIX" "-Ztranslate-remapped-path-to-local-path=no" "-Z" "ignore-directory-in-diagnostics-source-blocks=/cargo" "-Z" "ignore-directory-in-diagnostics-source-blocks=/checkout/vendor" "--sysroot" "/checkout/obj/build/aarch64-unknown-linux-gnu/stage2" "--target=aarch64-unknown-linux-gnu" "--check-cfg" "cfg(test,FALSE)" "--error-format" "json" "--json" "future-incompat" "-Ccodegen-units=1" "-Zui-testing" "-Zdeduplicate-diagnostics=no" "-Zwrite-long-types-to-disk=no" "-Cstrip=debuginfo" "--emit" "metadata" "-C" "prefer-dynamic" "--out-dir" "/checkout/obj/build/aarch64-unknown-linux-gnu/test/ui/cfg/path-kw-as-cfg-pred" "-A" "unused" "-A" "internal_features" "-A" "unused_parens" "-A" "unused_braces" "-Crpath" "-Cdebuginfo=0" "-Lnative=/checkout/obj/build/aarch64-unknown-linux-gnu/native/rust-test-helpers" "--edition=2024"
stdout: none
--- stderr -------------------------------
error: `crate` cannot be a raw identifier
##[error]  --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:70:10
   |
LL |     cfg!(r#crate); //~ ERROR `crate` cannot be a raw identifier
   |          ^^^^^^^

error: `super` cannot be a raw identifier
##[error]  --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:72:10
   |
LL |     cfg!(r#super); //~ ERROR `super` cannot be a raw identifier
   |          ^^^^^^^

error: `self` cannot be a raw identifier
##[error]  --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:74:10
   |
LL |     cfg!(r#self); //~ ERROR `self` cannot be a raw identifier
   |          ^^^^^^

error: `Self` cannot be a raw identifier
##[error]  --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:76:10
   |
LL |     cfg!(r#Self); //~ ERROR `Self` cannot be a raw identifier
   |          ^^^^^^

error: `_` cannot be a raw identifier
##[error]  --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:85:10
   |
LL |     cfg!(r#_); //~ ERROR `_` cannot be a raw identifier
   |          ^^^

error: `crate` cannot be a raw identifier
##[error]  --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:88:7
   |
LL | #[cfg(r#crate)] //~ ERROR `cfg` predicate key must be an identifier
   |       ^^^^^^^

error: `super` cannot be a raw identifier
##[error]  --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:91:7
   |
LL | #[cfg(r#super)] //~ ERROR `cfg` predicate key must be an identifier
   |       ^^^^^^^

error: `self` cannot be a raw identifier
##[error]  --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:94:7
   |
LL | #[cfg(r#self)] //~ ERROR `cfg` predicate key must be an identifier
   |       ^^^^^^

error: `Self` cannot be a raw identifier
##[error]  --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:97:7
   |
LL | #[cfg(r#Self)] //~ ERROR `cfg` predicate key must be an identifier
   |       ^^^^^^

error: `crate` cannot be a raw identifier
##[error]  --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:100:12
   |
LL | #[cfg_attr(r#crate, cfg(r#crate))] //~ ERROR `cfg` predicate key must be an identifier
   |            ^^^^^^^

error: `crate` cannot be a raw identifier
##[error]  --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:100:25
   |
LL | #[cfg_attr(r#crate, cfg(r#crate))] //~ ERROR `cfg` predicate key must be an identifier
   |                         ^^^^^^^

error: `super` cannot be a raw identifier
##[error]  --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:105:12
   |
LL | #[cfg_attr(r#super, cfg(r#super))] //~ ERROR `cfg` predicate key must be an identifier
   |            ^^^^^^^

error: `super` cannot be a raw identifier
##[error]  --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:105:25
   |
LL | #[cfg_attr(r#super, cfg(r#super))] //~ ERROR `cfg` predicate key must be an identifier
   |                         ^^^^^^^

error: `self` cannot be a raw identifier
##[error]  --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:110:12
   |
LL | #[cfg_attr(r#self, cfg(r#self))] //~ ERROR `cfg` predicate key must be an identifier
   |            ^^^^^^

error: `self` cannot be a raw identifier
##[error]  --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:110:24
   |
LL | #[cfg_attr(r#self, cfg(r#self))] //~ ERROR `cfg` predicate key must be an identifier
   |                        ^^^^^^

error: `Self` cannot be a raw identifier
##[error]  --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:115:12
   |
LL | #[cfg_attr(r#Self, cfg(r#Self))] //~ ERROR `cfg` predicate key must be an identifier
   |            ^^^^^^

error: `Self` cannot be a raw identifier
##[error]  --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:115:24
   |
LL | #[cfg_attr(r#Self, cfg(r#Self))] //~ ERROR `cfg` predicate key must be an identifier
   |                        ^^^^^^

error: `_` cannot be a raw identifier
##[error]  --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:125:7
   |
LL | #[cfg(r#_)] //~ ERROR `_` cannot be a raw identifier
   |       ^^^

error: `_` cannot be a raw identifier
##[error]  --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:131:12
   |
LL | #[cfg_attr(r#_, cfg(r#_))] //~ ERROR `_` cannot be a raw identifier
   |            ^^^

error: `_` cannot be a raw identifier
##[error]  --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:131:21
   |
LL | #[cfg_attr(r#_, cfg(r#_))] //~ ERROR `_` cannot be a raw identifier
   |                     ^^^

error[E0539]: malformed `cfg` attribute input
##[error]  --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:18:1
   |
LL | #[cfg(crate)] //~ ERROR `cfg` predicate key must be an identifier
   | ^^^^^^-----^^
   | |     |
   | |     expected a valid identifier here
   | help: must be of the form: `#[cfg(predicate)]`
   |
   = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>

error[E0539]: malformed `cfg` attribute input
##[error]  --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:20:1
   |
LL | #[cfg(super)] //~ ERROR `cfg` predicate key must be an identifier
   | ^^^^^^-----^^
   | |     |
   | |     expected a valid identifier here
   | help: must be of the form: `#[cfg(predicate)]`
   |
   = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>

error[E0539]: malformed `cfg` attribute input
##[error]  --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:22:1
   |
LL | #[cfg(self)] //~ ERROR `cfg` predicate key must be an identifier
   | ^^^^^^----^^
   | |     |
   | |     expected a valid identifier here
   | help: must be of the form: `#[cfg(predicate)]`
   |
   = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>

error[E0539]: malformed `cfg` attribute input
##[error]  --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:24:1
   |
LL | #[cfg(Self)] //~ ERROR `cfg` predicate key must be an identifier
   | ^^^^^^----^^
   | |     |
   | |     expected a valid identifier here
   | help: must be of the form: `#[cfg(predicate)]`
   |
   = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>

error[E0539]: malformed `cfg_attr` attribute input
##[error]  --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:26:1
   |
LL | #[cfg_attr(crate, path = "foo")] //~ ERROR `cfg` predicate key must be an identifier
   | ^^^^^^^^^^^-----^^^^^^^^^^^^^^^^
   | |          |
   | |          expected a valid identifier here
   | help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]`
   |
   = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>

error[E0539]: malformed `cfg_attr` attribute input
##[error]  --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:28:1
   |
LL | #[cfg_attr(super, path = "foo")] //~ ERROR `cfg` predicate key must be an identifier
   | ^^^^^^^^^^^-----^^^^^^^^^^^^^^^^
   | |          |
   | |          expected a valid identifier here
   | help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]`
   |
   = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>

error[E0539]: malformed `cfg_attr` attribute input
##[error]  --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:30:1
   |
LL | #[cfg_attr(self, path = "foo")] //~ ERROR `cfg` predicate key must be an identifier
   | ^^^^^^^^^^^----^^^^^^^^^^^^^^^^
   | |          |
   | |          expected a valid identifier here
   | help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]`
   |
   = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>

error[E0539]: malformed `cfg_attr` attribute input
##[error]  --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:32:1
   |
LL | #[cfg_attr(Self, path = "foo")] //~ ERROR `cfg` predicate key must be an identifier
   | ^^^^^^^^^^^----^^^^^^^^^^^^^^^^
   | |          |
   | |          expected a valid identifier here
   | help: must be of the form: `#[cfg_attr(predicate, attr1, attr2, ...)]`
   |
   = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg_attr-attribute>

error[E0539]: malformed `cfg` attribute input
##[error]  --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:34:18
   |
LL | #[cfg_attr(true, cfg(crate))] //~ ERROR `cfg` predicate key must be an identifier
   |                  ^^^^-----^
   |                  |   |
   |                  |   expected a valid identifier here
   |                  help: must be of the form: `#[cfg(predicate)]`
   |
   = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>

error[E0539]: malformed `cfg` attribute input
##[error]  --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:36:18
   |
LL | #[cfg_attr(true, cfg(super))] //~ ERROR `cfg` predicate key must be an identifier
   |                  ^^^^-----^
   |                  |   |
   |                  |   expected a valid identifier here
   |                  help: must be of the form: `#[cfg(predicate)]`
   |
   = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>

error[E0539]: malformed `cfg` attribute input
##[error]  --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:38:18
   |
LL | #[cfg_attr(true, cfg(self))] //~ ERROR `cfg` predicate key must be an identifier
   |                  ^^^^----^
   |                  |   |
   |                  |   expected a valid identifier here
   |                  help: must be of the form: `#[cfg(predicate)]`
   |
   = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>

error[E0539]: malformed `cfg` attribute input
##[error]  --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:40:18
   |
LL | #[cfg_attr(true, cfg(Self))] //~ ERROR `cfg` predicate key must be an identifier
   |                  ^^^^----^
   |                  |   |
   |                  |   expected a valid identifier here
   |                  help: must be of the form: `#[cfg(predicate)]`
   |
   = note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>

error: expected identifier, found keyword `struct`
##[error]  --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:43:7
   |
LL | #[cfg(struct)] //~ ERROR expected identifier, found keyword
   |       ^^^^^^ expected identifier, found keyword

error: expected identifier, found reserved keyword `priv`
##[error]  --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:45:7
   |
LL | #[cfg(priv)] //~ ERROR expected identifier, found reserved keyword `priv`
   |       ^^^^ expected identifier, found reserved keyword

error: expected identifier, found reserved identifier `_`
##[error]  --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:47:7
   |
LL | #[cfg(_)] //~ ERROR expected identifier, found reserved identifier `_`
   |       ^ expected identifier, found reserved identifier

error: expected identifier, found keyword `struct`
##[error]  --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:49:12
   |
LL | #[cfg_attr(struct, path = "foo")] //~ ERROR expected identifier, found keyword
   |            ^^^^^^ expected identifier, found keyword
   |
help: escape `struct` to use it as an identifier
   |
LL | #[cfg_attr(r#struct, path = "foo")] //~ ERROR expected identifier, found keyword
   |            ++

error: expected identifier, found reserved keyword `priv`
##[error]  --> /checkout/tests/ui/cfg/path-kw-as-cfg-pred.rs:51:12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-attributes Area: Attributes (`#[…]`, `#![…]`) A-compiletest Area: The compiletest test runner A-run-make Area: port run-make Makefiles to rmake.rs A-testsuite Area: The testsuite used to check the correctness of rustc F-explicit_tail_calls `#![feature(explicit_tail_calls)]` S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-clippy Relevant to the Clippy team. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cfg!($crate), cfg!(crate), cfg!(self), cfg!(Self), and cfg!(super) should not be accepted

7 participants