Rollup merge of #153325 - DanielEScherzer:test-references-conditional-compilation, r=ehuss

tests/ui/cfg: add annotations for reference rules
This commit is contained in:
Matthias Krüger
2026-03-10 07:21:58 +01:00
committed by GitHub
26 changed files with 113 additions and 75 deletions
+1
View File
@@ -1,5 +1,6 @@
/// Test that placing a `cfg(true)` and `cfg(false)` on the same item result in
//. it being disabled.`
//@ reference: cfg.attr.duplicates
#[cfg(false)]
#[cfg(true)]
+3 -3
View File
@@ -1,11 +1,11 @@
error[E0425]: cannot find function `foo` in this scope
--> $DIR/both-true-false.rs:13:5
--> $DIR/both-true-false.rs:14:5
|
LL | foo();
| ^^^ not found in this scope
|
note: found an item that was configured out
--> $DIR/both-true-false.rs:6:4
--> $DIR/both-true-false.rs:7:4
|
LL | #[cfg(false)]
| ----- the item is gated here
@@ -13,7 +13,7 @@ LL | #[cfg(true)]
LL | fn foo() {}
| ^^^
note: found an item that was configured out
--> $DIR/both-true-false.rs:10:4
--> $DIR/both-true-false.rs:11:4
|
LL | #[cfg(false)]
| ----- the item is gated here
+2
View File
@@ -1,6 +1,8 @@
//! Test that use items with cfg(false) are properly filtered out
//@ run-pass
//@ reference: cfg.predicate.literal
//@ reference: cfg.attr.effect
pub fn main() {
// Make sure that this view item is filtered out because otherwise it would
+2
View File
@@ -1,6 +1,8 @@
//@ build-pass
//@ ignore-wasm32 no bare family
//@ ignore-sgx
//@ reference: cfg.target_family.unix
//@ reference: cfg.target_family.windows
#[cfg(windows)]
pub fn main() {
+2
View File
@@ -2,6 +2,8 @@
//@ compile-flags: -C panic=abort
//@ no-prefer-dynamic
//@ ignore-backends: gcc
//@ reference: cfg.panic.def
//@ reference: cfg.panic.values
#[cfg(panic = "unwind")]
pub fn bad() -> i32 { }
+2
View File
@@ -1,6 +1,8 @@
//@ build-pass
//@ compile-flags: -C panic=unwind
//@ needs-unwind
//@ reference: cfg.panic.def
//@ reference: cfg.panic.values
#[cfg(panic = "abort")]
pub fn bad() -> i32 { }
+1
View File
@@ -1,4 +1,5 @@
//@ check-fail
//@ reference: cfg.option-spec
#![allow(unexpected_cfgs)] // invalid cfgs
+4 -4
View File
@@ -1,5 +1,5 @@
error[E0539]: malformed `cfg` attribute input
--> $DIR/cfg-path-error.rs:5:1
--> $DIR/cfg-path-error.rs:6:1
|
LL | #[cfg(any(foo, foo::bar))]
| ^^^^^^^^^^^^^^^--------^^^
@@ -10,7 +10,7 @@ LL | #[cfg(any(foo, foo::bar))]
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
error[E0539]: malformed `cfg` attribute input
--> $DIR/cfg-path-error.rs:11:1
--> $DIR/cfg-path-error.rs:12:1
|
LL | #[cfg(any(foo::bar, foo))]
| ^^^^^^^^^^--------^^^^^^^^
@@ -21,7 +21,7 @@ LL | #[cfg(any(foo::bar, foo))]
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
error[E0539]: malformed `cfg` attribute input
--> $DIR/cfg-path-error.rs:17:1
--> $DIR/cfg-path-error.rs:18:1
|
LL | #[cfg(all(foo, foo::bar))]
| ^^^^^^^^^^^^^^^--------^^^
@@ -32,7 +32,7 @@ LL | #[cfg(all(foo, foo::bar))]
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
error[E0539]: malformed `cfg` attribute input
--> $DIR/cfg-path-error.rs:23:1
--> $DIR/cfg-path-error.rs:24:1
|
LL | #[cfg(all(foo::bar, foo))]
| ^^^^^^^^^^--------^^^^^^^^
+2
View File
@@ -1,4 +1,6 @@
//@ run-pass
//@ reference: cfg.target_abi.def
//@ reference: cfg.target_abi.values
#[cfg(target_abi = "eabihf")]
pub fn main() {
+2
View File
@@ -1,5 +1,7 @@
//@ build-pass
//@ ignore-sgx
//@ reference: cfg.target_family.def
//@ reference: cfg.target_family.values
#[cfg(target_family = "windows")]
+2
View File
@@ -1,4 +1,6 @@
//@ run-pass
//@ reference: cfg.target_vendor.def
//@ reference: cfg.target_vendor.values
#[cfg(target_vendor = "unknown")]
pub fn main() {
}
+2
View File
@@ -1,5 +1,7 @@
//@ run-pass
//@ compile-flags:--cfg set1 --cfg set2
//@ reference: cfg.cfg_attr.intro
//@ reference: cfg.cfg_attr.syntax
#![allow(dead_code, unexpected_cfgs)]
+1
View File
@@ -2,6 +2,7 @@
//@ check-pass
//@ aux-build: cfg_false_lib_no_std_after.rs
//@ reference: cfg.attr.crate-level-attrs
#![no_std]
+1
View File
@@ -7,6 +7,7 @@
//@ compile-flags: -Cpanic=abort
//@ aux-build: cfg_false_lib_no_std_before.rs
//@ reference: cfg.attr.crate-level-attrs
#![no_std]
+1
View File
@@ -2,6 +2,7 @@
//@ check-pass
//@ aux-build: cfg_false_lib.rs
//@ reference: cfg.attr.crate-level-attrs
#![no_std]
+1
View File
@@ -1,4 +1,5 @@
//@ run-pass
//@ reference: cfg.attr.allowed-positions
#![allow(dead_code)]
#![allow(unused_mut)]
#![allow(unused_variables)]
+3
View File
@@ -1,5 +1,8 @@
//@ run-pass
//@ compile-flags: --cfg fooA --cfg fooB --check-cfg=cfg(fooA,fooB,fooC,bar)
//@ reference: cfg.predicate.all
//@ reference: cfg.predicate.any
//@ reference: cfg.predicate.not
// fooA AND !bar
#[cfg(all(fooA, not(bar)))]
+2
View File
@@ -1,4 +1,6 @@
//@ run-pass
//@ reference: cfg.target_arch.def
//@ reference: cfg.target_arch.values
#[cfg(target_arch = "x86")]
pub fn main() { }
+1
View File
@@ -1,4 +1,5 @@
//@ run-pass
//@ reference: cfg.attr.allowed-positions
#![allow(dead_code)]
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
@@ -1,5 +1,6 @@
//@ check-fail
//@ compile-flags:--cfg foo --check-cfg=cfg(foo)
//@ reference: cfg.cfg_attr.attr-restriction
#![cfg_attr(foo, crate_type="bin")]
//~^ERROR `crate_type` within
@@ -1,17 +1,17 @@
error: `crate_type` within an `#![cfg_attr]` attribute is forbidden
--> $DIR/crate-attributes-using-cfg_attr.rs:4:18
--> $DIR/crate-attributes-using-cfg_attr.rs:5:18
|
LL | #![cfg_attr(foo, crate_type="bin")]
| ^^^^^^^^^^^^^^^^
error: `crate_name` within an `#![cfg_attr]` attribute is forbidden
--> $DIR/crate-attributes-using-cfg_attr.rs:7:18
--> $DIR/crate-attributes-using-cfg_attr.rs:8:18
|
LL | #![cfg_attr(foo, crate_name="bar")]
| ^^^^^^^^^^^^^^^^
error: `crate_type` within an `#![cfg_attr]` attribute is forbidden
--> $DIR/crate-attributes-using-cfg_attr.rs:4:18
--> $DIR/crate-attributes-using-cfg_attr.rs:5:18
|
LL | #![cfg_attr(foo, crate_type="bin")]
| ^^^^^^^^^^^^^^^^
@@ -19,7 +19,7 @@ LL | #![cfg_attr(foo, crate_type="bin")]
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
error: `crate_name` within an `#![cfg_attr]` attribute is forbidden
--> $DIR/crate-attributes-using-cfg_attr.rs:7:18
--> $DIR/crate-attributes-using-cfg_attr.rs:8:18
|
LL | #![cfg_attr(foo, crate_name="bar")]
| ^^^^^^^^^^^^^^^^
+3
View File
@@ -1,4 +1,7 @@
//@ compile-flags: --cfg foo=1x
//@ reference: cfg.option-spec
//@ reference: cfg.option-name
//@ reference: cfg.option-key-value
fn main() {}
@@ -1,4 +1,7 @@
//@ compile-flags: --check-cfg 'foo=1x'
//@ reference: cfg.option-spec
//@ reference: cfg.option-name
//@ reference: cfg.option-key-value
fn main() {}
+2
View File
@@ -1,4 +1,6 @@
//@ edition: 2024
//@ reference: cfg.attr.syntax
//@ reference: cfg.cfg_attr.syntax
#![allow(unexpected_cfgs)]
+64 -64
View File
@@ -1,125 +1,125 @@
error: `crate` cannot be a raw identifier
--> $DIR/path-kw-as-cfg-pred.rs:70:10
--> $DIR/path-kw-as-cfg-pred.rs:72:10
|
LL | cfg!(r#crate);
| ^^^^^^^
error: `super` cannot be a raw identifier
--> $DIR/path-kw-as-cfg-pred.rs:72:10
--> $DIR/path-kw-as-cfg-pred.rs:74:10
|
LL | cfg!(r#super);
| ^^^^^^^
error: `self` cannot be a raw identifier
--> $DIR/path-kw-as-cfg-pred.rs:74:10
--> $DIR/path-kw-as-cfg-pred.rs:76:10
|
LL | cfg!(r#self);
| ^^^^^^
error: `Self` cannot be a raw identifier
--> $DIR/path-kw-as-cfg-pred.rs:76:10
--> $DIR/path-kw-as-cfg-pred.rs:78:10
|
LL | cfg!(r#Self);
| ^^^^^^
error: `_` cannot be a raw identifier
--> $DIR/path-kw-as-cfg-pred.rs:85:10
--> $DIR/path-kw-as-cfg-pred.rs:87:10
|
LL | cfg!(r#_);
| ^^^
error: `crate` cannot be a raw identifier
--> $DIR/path-kw-as-cfg-pred.rs:88:7
--> $DIR/path-kw-as-cfg-pred.rs:90:7
|
LL | #[cfg(r#crate)]
| ^^^^^^^
error: `super` cannot be a raw identifier
--> $DIR/path-kw-as-cfg-pred.rs:91:7
--> $DIR/path-kw-as-cfg-pred.rs:93:7
|
LL | #[cfg(r#super)]
| ^^^^^^^
error: `self` cannot be a raw identifier
--> $DIR/path-kw-as-cfg-pred.rs:94:7
--> $DIR/path-kw-as-cfg-pred.rs:96:7
|
LL | #[cfg(r#self)]
| ^^^^^^
error: `Self` cannot be a raw identifier
--> $DIR/path-kw-as-cfg-pred.rs:97:7
--> $DIR/path-kw-as-cfg-pred.rs:99:7
|
LL | #[cfg(r#Self)]
| ^^^^^^
error: `crate` cannot be a raw identifier
--> $DIR/path-kw-as-cfg-pred.rs:100:12
--> $DIR/path-kw-as-cfg-pred.rs:102:12
|
LL | #[cfg_attr(r#crate, cfg(r#crate))]
| ^^^^^^^
error: `crate` cannot be a raw identifier
--> $DIR/path-kw-as-cfg-pred.rs:100:25
--> $DIR/path-kw-as-cfg-pred.rs:102:25
|
LL | #[cfg_attr(r#crate, cfg(r#crate))]
| ^^^^^^^
error: `super` cannot be a raw identifier
--> $DIR/path-kw-as-cfg-pred.rs:104:12
--> $DIR/path-kw-as-cfg-pred.rs:106:12
|
LL | #[cfg_attr(r#super, cfg(r#super))]
| ^^^^^^^
error: `super` cannot be a raw identifier
--> $DIR/path-kw-as-cfg-pred.rs:104:25
--> $DIR/path-kw-as-cfg-pred.rs:106:25
|
LL | #[cfg_attr(r#super, cfg(r#super))]
| ^^^^^^^
error: `self` cannot be a raw identifier
--> $DIR/path-kw-as-cfg-pred.rs:108:12
--> $DIR/path-kw-as-cfg-pred.rs:110:12
|
LL | #[cfg_attr(r#self, cfg(r#self))]
| ^^^^^^
error: `self` cannot be a raw identifier
--> $DIR/path-kw-as-cfg-pred.rs:108:24
--> $DIR/path-kw-as-cfg-pred.rs:110:24
|
LL | #[cfg_attr(r#self, cfg(r#self))]
| ^^^^^^
error: `Self` cannot be a raw identifier
--> $DIR/path-kw-as-cfg-pred.rs:112:12
--> $DIR/path-kw-as-cfg-pred.rs:114:12
|
LL | #[cfg_attr(r#Self, cfg(r#Self))]
| ^^^^^^
error: `Self` cannot be a raw identifier
--> $DIR/path-kw-as-cfg-pred.rs:112:24
--> $DIR/path-kw-as-cfg-pred.rs:114:24
|
LL | #[cfg_attr(r#Self, cfg(r#Self))]
| ^^^^^^
error: `_` cannot be a raw identifier
--> $DIR/path-kw-as-cfg-pred.rs:121:7
--> $DIR/path-kw-as-cfg-pred.rs:123:7
|
LL | #[cfg(r#_)]
| ^^^
error: `_` cannot be a raw identifier
--> $DIR/path-kw-as-cfg-pred.rs:127:12
--> $DIR/path-kw-as-cfg-pred.rs:129:12
|
LL | #[cfg_attr(r#_, cfg(r#_))]
| ^^^
error: `_` cannot be a raw identifier
--> $DIR/path-kw-as-cfg-pred.rs:127:21
--> $DIR/path-kw-as-cfg-pred.rs:129:21
|
LL | #[cfg_attr(r#_, cfg(r#_))]
| ^^^
error[E0539]: malformed `cfg` attribute input
--> $DIR/path-kw-as-cfg-pred.rs:18:1
--> $DIR/path-kw-as-cfg-pred.rs:20:1
|
LL | #[cfg(crate)]
| ^^^^^^-----^^
@@ -130,7 +130,7 @@ LL | #[cfg(crate)]
= 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
--> $DIR/path-kw-as-cfg-pred.rs:22:1
|
LL | #[cfg(super)]
| ^^^^^^-----^^
@@ -141,7 +141,7 @@ LL | #[cfg(super)]
= 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
--> $DIR/path-kw-as-cfg-pred.rs:24:1
|
LL | #[cfg(self)]
| ^^^^^^----^^
@@ -152,7 +152,7 @@ LL | #[cfg(self)]
= 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
--> $DIR/path-kw-as-cfg-pred.rs:26:1
|
LL | #[cfg(Self)]
| ^^^^^^----^^
@@ -163,7 +163,7 @@ LL | #[cfg(Self)]
= 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
--> $DIR/path-kw-as-cfg-pred.rs:28:1
|
LL | #[cfg_attr(crate, path = "foo")]
| ^^^^^^^^^^^-----^^^^^^^^^^^^^^^^
@@ -174,7 +174,7 @@ LL | #[cfg_attr(crate, path = "foo")]
= 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
--> $DIR/path-kw-as-cfg-pred.rs:30:1
|
LL | #[cfg_attr(super, path = "foo")]
| ^^^^^^^^^^^-----^^^^^^^^^^^^^^^^
@@ -185,7 +185,7 @@ LL | #[cfg_attr(super, path = "foo")]
= 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
--> $DIR/path-kw-as-cfg-pred.rs:32:1
|
LL | #[cfg_attr(self, path = "foo")]
| ^^^^^^^^^^^----^^^^^^^^^^^^^^^^
@@ -196,7 +196,7 @@ LL | #[cfg_attr(self, path = "foo")]
= 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
--> $DIR/path-kw-as-cfg-pred.rs:34:1
|
LL | #[cfg_attr(Self, path = "foo")]
| ^^^^^^^^^^^----^^^^^^^^^^^^^^^^
@@ -207,7 +207,7 @@ LL | #[cfg_attr(Self, path = "foo")]
= 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
--> $DIR/path-kw-as-cfg-pred.rs:36:18
|
LL | #[cfg_attr(true, cfg(crate))]
| ^^^^-----^
@@ -218,7 +218,7 @@ LL | #[cfg_attr(true, cfg(crate))]
= 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
--> $DIR/path-kw-as-cfg-pred.rs:38:18
|
LL | #[cfg_attr(true, cfg(super))]
| ^^^^-----^
@@ -229,7 +229,7 @@ LL | #[cfg_attr(true, cfg(super))]
= 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
--> $DIR/path-kw-as-cfg-pred.rs:40:18
|
LL | #[cfg_attr(true, cfg(self))]
| ^^^^----^
@@ -240,7 +240,7 @@ LL | #[cfg_attr(true, cfg(self))]
= 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
--> $DIR/path-kw-as-cfg-pred.rs:42:18
|
LL | #[cfg_attr(true, cfg(Self))]
| ^^^^----^
@@ -251,25 +251,25 @@ LL | #[cfg_attr(true, cfg(Self))]
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
error: expected identifier, found keyword `struct`
--> $DIR/path-kw-as-cfg-pred.rs:43:7
--> $DIR/path-kw-as-cfg-pred.rs:45:7
|
LL | #[cfg(struct)]
| ^^^^^^ expected identifier, found keyword
error: expected identifier, found reserved keyword `priv`
--> $DIR/path-kw-as-cfg-pred.rs:45:7
--> $DIR/path-kw-as-cfg-pred.rs:47:7
|
LL | #[cfg(priv)]
| ^^^^ expected identifier, found reserved keyword
error: expected identifier, found reserved identifier `_`
--> $DIR/path-kw-as-cfg-pred.rs:47:7
--> $DIR/path-kw-as-cfg-pred.rs:49:7
|
LL | #[cfg(_)]
| ^ expected identifier, found reserved identifier
error: expected identifier, found keyword `struct`
--> $DIR/path-kw-as-cfg-pred.rs:49:12
--> $DIR/path-kw-as-cfg-pred.rs:51:12
|
LL | #[cfg_attr(struct, path = "foo")]
| ^^^^^^ expected identifier, found keyword
@@ -280,7 +280,7 @@ LL | #[cfg_attr(r#struct, path = "foo")]
| ++
error: expected identifier, found reserved keyword `priv`
--> $DIR/path-kw-as-cfg-pred.rs:51:12
--> $DIR/path-kw-as-cfg-pred.rs:53:12
|
LL | #[cfg_attr(priv, path = "foo")]
| ^^^^ expected identifier, found reserved keyword
@@ -291,31 +291,31 @@ LL | #[cfg_attr(r#priv, path = "foo")]
| ++
error: expected identifier, found reserved identifier `_`
--> $DIR/path-kw-as-cfg-pred.rs:53:12
--> $DIR/path-kw-as-cfg-pred.rs:55:12
|
LL | #[cfg_attr(_, path = "foo")]
| ^ expected identifier, found reserved identifier
error: expected identifier, found keyword `struct`
--> $DIR/path-kw-as-cfg-pred.rs:55:22
--> $DIR/path-kw-as-cfg-pred.rs:57:22
|
LL | #[cfg_attr(true, cfg(struct))]
| ^^^^^^ expected identifier, found keyword
error: expected identifier, found reserved keyword `priv`
--> $DIR/path-kw-as-cfg-pred.rs:57:22
--> $DIR/path-kw-as-cfg-pred.rs:59:22
|
LL | #[cfg_attr(true, cfg(priv))]
| ^^^^ expected identifier, found reserved keyword
error: expected identifier, found reserved identifier `_`
--> $DIR/path-kw-as-cfg-pred.rs:59:22
--> $DIR/path-kw-as-cfg-pred.rs:61:22
|
LL | #[cfg_attr(true, cfg(_))]
| ^ expected identifier, found reserved identifier
error[E0539]: malformed `cfg` attribute input
--> $DIR/path-kw-as-cfg-pred.rs:88:1
--> $DIR/path-kw-as-cfg-pred.rs:90:1
|
LL | #[cfg(r#crate)]
| ^^^^^^-------^^
@@ -326,7 +326,7 @@ LL | #[cfg(r#crate)]
= 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
--> $DIR/path-kw-as-cfg-pred.rs:93:1
|
LL | #[cfg(r#super)]
| ^^^^^^-------^^
@@ -337,7 +337,7 @@ LL | #[cfg(r#super)]
= 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
--> $DIR/path-kw-as-cfg-pred.rs:96:1
|
LL | #[cfg(r#self)]
| ^^^^^^------^^
@@ -348,7 +348,7 @@ LL | #[cfg(r#self)]
= 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
--> $DIR/path-kw-as-cfg-pred.rs:99:1
|
LL | #[cfg(r#Self)]
| ^^^^^^------^^
@@ -359,7 +359,7 @@ LL | #[cfg(r#Self)]
= 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
--> $DIR/path-kw-as-cfg-pred.rs:102:1
|
LL | #[cfg_attr(r#crate, cfg(r#crate))]
| ^^^^^^^^^^^-------^^^^^^^^^^^^^^^^
@@ -370,7 +370,7 @@ LL | #[cfg_attr(r#crate, cfg(r#crate))]
= 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:104:1
--> $DIR/path-kw-as-cfg-pred.rs:106:1
|
LL | #[cfg_attr(r#super, cfg(r#super))]
| ^^^^^^^^^^^-------^^^^^^^^^^^^^^^^
@@ -381,7 +381,7 @@ 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>
error[E0539]: malformed `cfg_attr` attribute input
--> $DIR/path-kw-as-cfg-pred.rs:108:1
--> $DIR/path-kw-as-cfg-pred.rs:110:1
|
LL | #[cfg_attr(r#self, cfg(r#self))]
| ^^^^^^^^^^^------^^^^^^^^^^^^^^^
@@ -392,7 +392,7 @@ 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>
error[E0539]: malformed `cfg_attr` attribute input
--> $DIR/path-kw-as-cfg-pred.rs:112:1
--> $DIR/path-kw-as-cfg-pred.rs:114:1
|
LL | #[cfg_attr(r#Self, cfg(r#Self))]
| ^^^^^^^^^^^------^^^^^^^^^^^^^^^
@@ -403,7 +403,7 @@ 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>
error[E0539]: malformed `cfg` attribute input
--> $DIR/path-kw-as-cfg-pred.rs:7:9
--> $DIR/path-kw-as-cfg-pred.rs:9:9
|
LL | #[cfg($crate)]
| ^^^^^^------^^
@@ -418,7 +418,7 @@ LL | foo!();
= note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0539]: malformed `cfg_attr` attribute input
--> $DIR/path-kw-as-cfg-pred.rs:9:9
--> $DIR/path-kw-as-cfg-pred.rs:11:9
|
LL | #[cfg_attr($crate, path = "foo")]
| ^^^^^^^^^^^------^^^^^^^^^^^^^^^^
@@ -433,7 +433,7 @@ LL | foo!();
= note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0539]: malformed `cfg` attribute input
--> $DIR/path-kw-as-cfg-pred.rs:11:26
--> $DIR/path-kw-as-cfg-pred.rs:13:26
|
LL | #[cfg_attr(true, cfg($crate))]
| ^^^^------^
@@ -448,7 +448,7 @@ LL | foo!();
= note: this error originates in the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0539]: malformed `cfg` macro input
--> $DIR/path-kw-as-cfg-pred.rs:14:9
--> $DIR/path-kw-as-cfg-pred.rs:16:9
|
LL | cfg!($crate);
| ^^^^^------^
@@ -463,7 +463,7 @@ LL | foo!();
= note: this error originates in the macro `cfg` which comes from the expansion of the macro `foo` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0539]: malformed `cfg` macro input
--> $DIR/path-kw-as-cfg-pred.rs:65:5
--> $DIR/path-kw-as-cfg-pred.rs:67:5
|
LL | cfg!(crate);
| ^^^^^-----^
@@ -474,7 +474,7 @@ LL | cfg!(crate);
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
error[E0539]: malformed `cfg` macro input
--> $DIR/path-kw-as-cfg-pred.rs:66:5
--> $DIR/path-kw-as-cfg-pred.rs:68:5
|
LL | cfg!(super);
| ^^^^^-----^
@@ -485,7 +485,7 @@ LL | cfg!(super);
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
error[E0539]: malformed `cfg` macro input
--> $DIR/path-kw-as-cfg-pred.rs:67:5
--> $DIR/path-kw-as-cfg-pred.rs:69:5
|
LL | cfg!(self);
| ^^^^^----^
@@ -496,7 +496,7 @@ LL | cfg!(self);
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
error[E0539]: malformed `cfg` macro input
--> $DIR/path-kw-as-cfg-pred.rs:68:5
--> $DIR/path-kw-as-cfg-pred.rs:70:5
|
LL | cfg!(Self);
| ^^^^^----^
@@ -507,7 +507,7 @@ LL | cfg!(Self);
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
error[E0539]: malformed `cfg` macro input
--> $DIR/path-kw-as-cfg-pred.rs:70:5
--> $DIR/path-kw-as-cfg-pred.rs:72:5
|
LL | cfg!(r#crate);
| ^^^^^-------^
@@ -518,7 +518,7 @@ LL | cfg!(r#crate);
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
error[E0539]: malformed `cfg` macro input
--> $DIR/path-kw-as-cfg-pred.rs:72:5
--> $DIR/path-kw-as-cfg-pred.rs:74:5
|
LL | cfg!(r#super);
| ^^^^^-------^
@@ -529,7 +529,7 @@ LL | cfg!(r#super);
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
error[E0539]: malformed `cfg` macro input
--> $DIR/path-kw-as-cfg-pred.rs:74:5
--> $DIR/path-kw-as-cfg-pred.rs:76:5
|
LL | cfg!(r#self);
| ^^^^^------^
@@ -540,7 +540,7 @@ LL | cfg!(r#self);
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
error[E0539]: malformed `cfg` macro input
--> $DIR/path-kw-as-cfg-pred.rs:76:5
--> $DIR/path-kw-as-cfg-pred.rs:78:5
|
LL | cfg!(r#Self);
| ^^^^^------^
@@ -551,19 +551,19 @@ LL | cfg!(r#Self);
= note: for more information, visit <https://doc.rust-lang.org/reference/conditional-compilation.html#the-cfg-attribute>
error: expected identifier, found keyword `struct`
--> $DIR/path-kw-as-cfg-pred.rs:79:10
--> $DIR/path-kw-as-cfg-pred.rs:81:10
|
LL | cfg!(struct);
| ^^^^^^ expected identifier, found keyword
error: expected identifier, found reserved keyword `priv`
--> $DIR/path-kw-as-cfg-pred.rs:80:10
--> $DIR/path-kw-as-cfg-pred.rs:82:10
|
LL | cfg!(priv);
| ^^^^ expected identifier, found reserved keyword
error: expected identifier, found reserved identifier `_`
--> $DIR/path-kw-as-cfg-pred.rs:81:10
--> $DIR/path-kw-as-cfg-pred.rs:83:10
|
LL | cfg!(_);
| ^ expected identifier, found reserved identifier
+1
View File
@@ -1,4 +1,5 @@
//@ run-pass
//@ reference: cfg.predicate.literal
#![feature(link_cfg)]