Skip to content

Commit 15853b8

Browse files
committed
Adjust wording for --cfg/--check-cfg errors
1 parent 91fdcb2 commit 15853b8

19 files changed

+20
-20
lines changed

compiler/rustc_interface/src/interface.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ pub(crate) fn parse_cfg(dcx: DiagCtxtHandle<'_>, cfgs: Vec<String>) -> Cfg {
8585
let ident = meta_item.ident().expect("multi-segment cfg key");
8686

8787
if !ident.name.can_be_raw() {
88-
error!("argument key must be an identifier");
88+
error!("malformed cfg input, expected a valid identifier");
8989
}
9090

9191
return (ident.name, meta_item.value_str());
@@ -223,7 +223,7 @@ pub(crate) fn parse_check_cfg(dcx: DiagCtxtHandle<'_>, specs: Vec<String>) -> Ch
223223
}
224224

225225
if !ident.name.can_be_raw() {
226-
error!("`cfg()` names must be identifiers");
226+
error!("malformed cfg input, expected a valid identifier");
227227
}
228228

229229
names.push(ident);
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
error: invalid `--cfg` argument: `crate` (argument key must be an identifier)
1+
error: invalid `--cfg` argument: `crate` (malformed cfg input, expected a valid identifier)
22

tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.cfg_raw_crate.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ error: `crate` cannot be a raw identifier
22
|
33
= note: this occurred on the command line: `--cfg=r#crate`
44

5-
error: invalid `--cfg` argument: `r#crate` (argument key must be an identifier)
5+
error: invalid `--cfg` argument: `r#crate` (malformed cfg input, expected a valid identifier)
66

tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.cfg_raw_self_lower.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ error: `self` cannot be a raw identifier
22
|
33
= note: this occurred on the command line: `--cfg=r#self`
44

5-
error: invalid `--cfg` argument: `r#self` (argument key must be an identifier)
5+
error: invalid `--cfg` argument: `r#self` (malformed cfg input, expected a valid identifier)
66

tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.cfg_raw_self_upper.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ error: `Self` cannot be a raw identifier
22
|
33
= note: this occurred on the command line: `--cfg=r#Self`
44

5-
error: invalid `--cfg` argument: `r#Self` (argument key must be an identifier)
5+
error: invalid `--cfg` argument: `r#Self` (malformed cfg input, expected a valid identifier)
66

tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.cfg_raw_super.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ error: `super` cannot be a raw identifier
22
|
33
= note: this occurred on the command line: `--cfg=r#super`
44

5-
error: invalid `--cfg` argument: `r#super` (argument key must be an identifier)
5+
error: invalid `--cfg` argument: `r#super` (malformed cfg input, expected a valid identifier)
66

tests/ui/cfg/path-kw-as-cfg-pred-cli-cfg.cfg_raw_underscore.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ error: `_` cannot be a raw identifier
22
|
33
= note: this occurred on the command line: `--cfg=r#_`
44

5-
error: invalid `--cfg` argument: `r#_` (argument key must be an identifier)
5+
error: invalid `--cfg` argument: `r#_` (malformed cfg input, expected a valid identifier)
66

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
error: invalid `--cfg` argument: `self` (argument key must be an identifier)
1+
error: invalid `--cfg` argument: `self` (malformed cfg input, expected a valid identifier)
22

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
error: invalid `--cfg` argument: `Self` (argument key must be an identifier)
1+
error: invalid `--cfg` argument: `Self` (malformed cfg input, expected a valid identifier)
22

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
error: invalid `--cfg` argument: `super` (argument key must be an identifier)
1+
error: invalid `--cfg` argument: `super` (malformed cfg input, expected a valid identifier)
22

0 commit comments

Comments
 (0)