Use cfg(false) in UI tests

This commit is contained in:
clubby789 2025-03-29 17:24:03 +00:00
parent d83f415325
commit 303c1b45c2
141 changed files with 470 additions and 470 deletions

View file

@ -2,7 +2,7 @@
fn main() {}
#[cfg(FALSE)]
#[cfg(false)]
fn syntax() {
let _ = #[attr] [];
let _ = #[attr] [0];

View file

@ -4,5 +4,5 @@
fn main() {}
#[cfg(FALSE)]
#[cfg(false)]
enum Foo { pub V, }

View file

@ -1,6 +1,6 @@
//@ pp-exact
#[cfg(FALSE)]
#[cfg(false)]
fn simple_attr() {
#[attr]
@ -10,21 +10,21 @@ fn simple_attr() {
if true {}
}
#[cfg(FALSE)]
#[cfg(false)]
fn if_else_chain() {
#[first_attr]
if true {} else if false {} else {}
}
#[cfg(FALSE)]
#[cfg(false)]
fn if_let() {
#[attr]
if let Some(_) = Some(true) {}
}
#[cfg(FALSE)]
#[cfg(false)]
fn let_attr_if() {
let _ = #[attr] if let _ = 0 {};
let _ = #[attr] if true {};

View file

@ -4,7 +4,7 @@
fn main() {}
#[cfg(FALSE)]
#[cfg(false)]
extern "C" {
static X: u8;
type X;
@ -14,7 +14,7 @@ extern "C" {
pub fn foo();
}
#[cfg(FALSE)]
#[cfg(false)]
trait T {
const X: u8;
type X;
@ -30,7 +30,7 @@ trait T {
pub default fn foo();
}
#[cfg(FALSE)]
#[cfg(false)]
impl T for S {
const X: u8;
type X;

View file

@ -1,4 +1,4 @@
fn main() {
#[cfg(FALSE)]
#[cfg(false)]
<() as module>::mac!(); //~ ERROR macros cannot use qualified paths
}

View file

@ -11,7 +11,7 @@ fn f() {
};
}
#[cfg(FALSE)]
#[cfg(false)]
fn g() {
let _ = async {
for await _i in core::async_iter::from_iter(0..3) {

View file

@ -3,11 +3,11 @@
struct S;
impl S {
#[cfg(FALSE)]
#[cfg(false)]
unsafe async fn g() {} //~ ERROR expected one of `extern` or `fn`, found keyword `async`
}
#[cfg(FALSE)]
#[cfg(false)]
unsafe async fn f() {} //~ ERROR expected one of `extern` or `fn`, found keyword `async`
fn main() {}

View file

@ -1,5 +1,5 @@
// Ensure that `-Z crate-attr=cfg(FALSE)` can comment out the whole crate
//@ compile-flags: --crate-type=lib -Zcrate-attr=cfg(FALSE)
// Ensure that `-Z crate-attr=cfg(false)` can comment out the whole crate
//@ compile-flags: --crate-type=lib -Zcrate-attr=cfg(false)
//@ check-pass
// NOTE: duplicate items are load-bearing

View file

@ -1,6 +1,6 @@
//@ check-pass
#[cfg(FALSE)]
#[cfg(false)]
auto trait Foo {}
//~^ WARN `auto` traits are unstable
//~| WARN unstable syntax can change at any point in the future, causing a hard error!

View file

@ -1,4 +1,4 @@
// `#![no_std]` on a fully unconfigured crate is respected if it's placed before `cfg(FALSE)`.
// `#![no_std]` on a fully unconfigured crate is respected if it's placed before `cfg(false)`.
// This crate has no such attribute, therefore this crate does link to libstd.
#![cfg(FALSE)]
#![cfg(false)]

View file

@ -1,5 +1,5 @@
// `#![no_std]` on a fully unconfigured crate is respected if it's placed before `cfg(FALSE)`.
// `#![no_std]` on a fully unconfigured crate is respected if it's placed before `cfg(false)`.
// Therefore this crate does link to libstd.
#![cfg(FALSE)]
#![cfg(false)]
#![no_std]

View file

@ -1,8 +1,8 @@
// `#![no_std]` on a fully unconfigured crate is respected if it's placed before `cfg(FALSE)`.
// `#![no_std]` on a fully unconfigured crate is respected if it's placed before `cfg(false)`.
// Therefore this crate doesn't link to libstd.
//@ no-prefer-dynamic
#![no_std]
#![crate_type = "lib"]
#![cfg(FALSE)]
#![cfg(false)]

View file

@ -1,8 +1,8 @@
pub mod inner {
#[cfg(FALSE)]
#[cfg(false)]
pub fn uwu() {}
#[cfg(FALSE)]
#[cfg(false)]
pub mod doesnt_exist {
pub fn hello() {}
}

View file

@ -1,10 +1,10 @@
// Features above `cfg(FALSE)` are in effect in a fully unconfigured crate (issue #104633).
// Features above `cfg(false)` are in effect in a fully unconfigured crate (issue #104633).
//@ check-pass
//@ compile-flags: --crate-type lib
#![feature(decl_macro)]
#![cfg(FALSE)]
#![cfg(false)]
#![feature(box_patterns)]
macro mac() {} // OK

View file

@ -3,7 +3,7 @@
// check that cfg correctly chooses between the macro impls (see also
// cfg-macros-foo.rs)
#[cfg(FALSE)]
#[cfg(false)]
#[macro_use]
mod foo {
macro_rules! bar {

View file

@ -11,7 +11,7 @@ fn foo(f: Foo) {
Foo::Bar => {},
#[cfg(not(FALSE))]
Foo::Baz => {},
#[cfg(FALSE)]
#[cfg(false)]
Basdfwe => {}
}
}

View file

@ -6,7 +6,7 @@
#[cfg_eval]
fn main() {
#[cfg_eval]
let _ = #[cfg(FALSE)] 0;
let _ = #[cfg(false)] 0;
//~^ ERROR removing an expression is not supported in this position
//~| ERROR expected expression, found `;`
//~| ERROR removing an expression is not supported in this position

View file

@ -1,19 +1,19 @@
error: removing an expression is not supported in this position
--> $DIR/cfg-stmt-recovery.rs:9:13
|
LL | let _ = #[cfg(FALSE)] 0;
LL | let _ = #[cfg(false)] 0;
| ^^^^^^^^^^^^^
error: expected expression, found `;`
--> $DIR/cfg-stmt-recovery.rs:9:28
|
LL | let _ = #[cfg(FALSE)] 0;
LL | let _ = #[cfg(false)] 0;
| ^ expected expression
error: removing an expression is not supported in this position
--> $DIR/cfg-stmt-recovery.rs:9:13
|
LL | let _ = #[cfg(FALSE)] 0;
LL | let _ = #[cfg(false)] 0;
| ^^^^^^^^^^^^^
error: aborting due to 3 previous errors

View file

@ -7,47 +7,47 @@
fn main() {
let a = 413;
#[cfg(FALSE)]
#[cfg(false)]
let a = ();
assert_eq!(a, 413);
let mut b = 612;
#[cfg(FALSE)]
#[cfg(false)]
{
b = 1111;
}
assert_eq!(b, 612);
#[cfg(FALSE)]
#[cfg(false)]
undefined_fn();
#[cfg(FALSE)]
#[cfg(false)]
undefined_macro!();
#[cfg(FALSE)]
#[cfg(false)]
undefined_macro![];
#[cfg(FALSE)]
#[cfg(false)]
undefined_macro!{};
// pretty printer bug...
// #[cfg(FALSE)]
// #[cfg(false)]
// undefined_macro!{}
let () = (#[cfg(FALSE)] 341,); // Should this also work on parens?
let t = (1, #[cfg(FALSE)] 3, 4);
let () = (#[cfg(false)] 341,); // Should this also work on parens?
let t = (1, #[cfg(false)] 3, 4);
assert_eq!(t, (1, 4));
let f = |_: u32, _: u32| ();
f(2, 1, #[cfg(FALSE)] 6);
f(2, 1, #[cfg(false)] 6);
let _: u32 = a.clone(#[cfg(FALSE)] undefined);
let _: u32 = a.clone(#[cfg(false)] undefined);
let _: [(); 0] = [#[cfg(FALSE)] 126];
let t = [#[cfg(FALSE)] 1, 2, 6];
let _: [(); 0] = [#[cfg(false)] 126];
let t = [#[cfg(false)] 1, 2, 6];
assert_eq!(t, [2, 6]);
{
let r;
#[cfg(FALSE)]
#[cfg(false)]
(r = 5);
#[cfg(not(FALSE))]
(r = 10);
@ -75,7 +75,7 @@ fn main() {
612
});
assert_eq!((#[cfg(FALSE)] 1, #[cfg(not(FALSE))] 2), (2,));
assert_eq!((#[cfg(false)] 1, #[cfg(not(FALSE))] 2), (2,));
assert_eq!(n, 612);
// check that lints work

View file

@ -6,16 +6,16 @@
// Crate use statements
#[cfg(FALSE)]
#[cfg(false)]
use flippity;
#[cfg(FALSE)]
#[cfg(false)]
static b: bool = false;
static b: bool = true;
mod rustrt {
#[cfg(FALSE)]
#[cfg(false)]
extern "C" {
// This symbol doesn't exist and would be a link error if this
// module was codegened
@ -25,12 +25,12 @@ mod rustrt {
extern "C" {}
}
#[cfg(FALSE)]
#[cfg(false)]
type t = isize;
type t = bool;
#[cfg(FALSE)]
#[cfg(false)]
enum tg {
foo,
}
@ -39,12 +39,12 @@ enum tg {
bar,
}
#[cfg(FALSE)]
#[cfg(false)]
struct r {
i: isize,
}
#[cfg(FALSE)]
#[cfg(false)]
fn r(i: isize) -> r {
r { i: i }
}
@ -57,7 +57,7 @@ fn r(i: isize) -> r {
r { i: i }
}
#[cfg(FALSE)]
#[cfg(false)]
mod m {
// This needs to parse but would fail in typeck. Since it's not in
// the current config it should not be typechecked.
@ -69,7 +69,7 @@ mod m {
mod m {
// Submodules have slightly different code paths than the top-level
// module, so let's make sure this jazz works here as well
#[cfg(FALSE)]
#[cfg(false)]
pub fn f() {}
pub fn f() {}
@ -77,7 +77,7 @@ mod m {
// Since the FALSE configuration isn't defined main will just be
// parsed, but nothing further will be done with it
#[cfg(FALSE)]
#[cfg(false)]
pub fn main() {
panic!()
}
@ -93,14 +93,14 @@ pub fn main() {
}
fn test_in_fn_ctxt() {
#[cfg(FALSE)]
#[cfg(false)]
fn f() {
panic!()
}
fn f() {}
f();
#[cfg(FALSE)]
#[cfg(false)]
static i: isize = 0;
static i: isize = 1;
assert_eq!(i, 1);
@ -109,7 +109,7 @@ fn test_in_fn_ctxt() {
mod test_foreign_items {
pub mod rustrt {
extern "C" {
#[cfg(FALSE)]
#[cfg(false)]
pub fn write() -> String;
pub fn write() -> String;
}
@ -117,7 +117,7 @@ mod test_foreign_items {
}
mod test_use_statements {
#[cfg(FALSE)]
#[cfg(false)]
use flippity_foo;
}
@ -127,24 +127,24 @@ mod test_methods {
}
impl Fooable for Foo {
#[cfg(FALSE)]
#[cfg(false)]
fn what(&self) {}
fn what(&self) {}
#[cfg(FALSE)]
#[cfg(false)]
fn the(&self) {}
fn the(&self) {}
}
trait Fooable {
#[cfg(FALSE)]
#[cfg(false)]
fn what(&self);
fn what(&self);
#[cfg(FALSE)]
#[cfg(false)]
fn the(&self);
fn the(&self);

View file

@ -12,7 +12,7 @@ LL | pub mod doesnt_exist {
note: the item is gated here
--> $DIR/auxiliary/cfged_out.rs:5:5
|
LL | #[cfg(FALSE)]
LL | #[cfg(false)]
| ^^^^^^^^^^^^^
error[E0425]: cannot find function `uwu` in crate `cfged_out`
@ -35,7 +35,7 @@ LL | pub fn uwu() {}
note: the item is gated here
--> $DIR/auxiliary/cfged_out.rs:2:5
|
LL | #[cfg(FALSE)]
LL | #[cfg(false)]
| ^^^^^^^^^^^^^
error[E0425]: cannot find function `meow` in module `cfged_out::inner::right`

View file

@ -1,10 +1,10 @@
pub mod inner {
#[cfg(FALSE)]
#[cfg(false)]
mod gone {
pub fn uwu() {}
}
#[cfg(FALSE)] //~ NOTE the item is gated here
#[cfg(false)] //~ NOTE the item is gated here
pub use super::uwu;
//~^ NOTE found an item that was configured out
}
@ -14,7 +14,7 @@ pub use a::x;
//~| NOTE no `x` in `a`
mod a {
#[cfg(FALSE)] //~ NOTE the item is gated here
#[cfg(false)] //~ NOTE the item is gated here
pub fn x() {}
//~^ NOTE found an item that was configured out
}
@ -25,10 +25,10 @@ pub use b::{x, y};
//~| NOTE no `y` in `b`
mod b {
#[cfg(FALSE)] //~ NOTE the item is gated here
#[cfg(false)] //~ NOTE the item is gated here
pub fn x() {}
//~^ NOTE found an item that was configured out
#[cfg(FALSE)] //~ NOTE the item is gated here
#[cfg(false)] //~ NOTE the item is gated here
pub fn y() {}
//~^ NOTE found an item that was configured out
}

View file

@ -12,7 +12,7 @@ LL | pub fn x() {}
note: the item is gated here
--> $DIR/diagnostics-reexport.rs:17:5
|
LL | #[cfg(FALSE)]
LL | #[cfg(false)]
| ^^^^^^^^^^^^^
error[E0432]: unresolved imports `b::x`, `b::y`
@ -31,7 +31,7 @@ LL | pub fn x() {}
note: the item is gated here
--> $DIR/diagnostics-reexport.rs:28:5
|
LL | #[cfg(FALSE)]
LL | #[cfg(false)]
| ^^^^^^^^^^^^^
note: found an item that was configured out
--> $DIR/diagnostics-reexport.rs:32:12
@ -41,7 +41,7 @@ LL | pub fn y() {}
note: the item is gated here
--> $DIR/diagnostics-reexport.rs:31:5
|
LL | #[cfg(FALSE)]
LL | #[cfg(false)]
| ^^^^^^^^^^^^^
error[E0425]: cannot find function `uwu` in module `inner`
@ -58,7 +58,7 @@ LL | pub use super::uwu;
note: the item is gated here
--> $DIR/diagnostics-reexport.rs:7:5
|
LL | #[cfg(FALSE)]
LL | #[cfg(false)]
| ^^^^^^^^^^^^^
error: aborting due to 3 previous errors

View file

@ -1,11 +1,11 @@
#![allow(unexpected_cfgs)] // since we want to recognize them as unexpected
pub mod inner {
#[cfg(FALSE)] //~ NOTE the item is gated here
#[cfg(false)] //~ NOTE the item is gated here
pub fn uwu() {}
//~^ NOTE found an item that was configured out
#[cfg(FALSE)] //~ NOTE the item is gated here
#[cfg(false)] //~ NOTE the item is gated here
//~^ NOTE the item is gated here
//~| NOTE the item is gated here
pub mod doesnt_exist {

View file

@ -12,7 +12,7 @@ LL | pub mod doesnt_exist {
note: the item is gated here
--> $DIR/diagnostics-same-crate.rs:8:5
|
LL | #[cfg(FALSE)]
LL | #[cfg(false)]
| ^^^^^^^^^^^^^
error[E0432]: unresolved import `super::inner::doesnt_exist`
@ -29,7 +29,7 @@ LL | pub mod doesnt_exist {
note: the item is gated here
--> $DIR/diagnostics-same-crate.rs:8:5
|
LL | #[cfg(FALSE)]
LL | #[cfg(false)]
| ^^^^^^^^^^^^^
error[E0433]: failed to resolve: could not find `doesnt_exist` in `inner`
@ -46,7 +46,7 @@ LL | pub mod doesnt_exist {
note: the item is gated here
--> $DIR/diagnostics-same-crate.rs:8:5
|
LL | #[cfg(FALSE)]
LL | #[cfg(false)]
| ^^^^^^^^^^^^^
error[E0425]: cannot find function `uwu` in module `inner`
@ -63,7 +63,7 @@ LL | pub fn uwu() {}
note: the item is gated here
--> $DIR/diagnostics-same-crate.rs:4:5
|
LL | #[cfg(FALSE)]
LL | #[cfg(false)]
| ^^^^^^^^^^^^^
error[E0425]: cannot find function `meow` in module `inner::right`

View file

@ -12,7 +12,7 @@
//@ compile-flags: --check-cfg=cfg() --cfg=unknown_but_active_cfg
#[allow(unexpected_cfgs)]
#[cfg(FALSE)]
#[cfg(unknown_and_inactive_cfg)]
//~^ WARNING unexpected `cfg` condition name
fn bar() {}

View file

@ -1,10 +1,10 @@
warning: unexpected `cfg` condition name: `FALSE`
warning: unexpected `cfg` condition name: `unknown_and_inactive_cfg`
--> $DIR/allow-same-level.rs:15:7
|
LL | #[cfg(FALSE)]
| ^^^^^
LL | #[cfg(unknown_and_inactive_cfg)]
| ^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: to expect this configuration use `--check-cfg=cfg(FALSE)`
= help: to expect this configuration use `--check-cfg=cfg(unknown_and_inactive_cfg)`
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
= note: `#[warn(unexpected_cfgs)]` on by default

View file

@ -6,7 +6,7 @@
#![allow(unexpected_cfgs)]
#[cfg(FALSE)]
#[cfg(false)]
fn bar() {}
fn foo() {

View file

@ -6,7 +6,7 @@
#[allow(unexpected_cfgs)]
mod aa {
#[cfg(FALSE)]
#[cfg(false)]
fn bar() {}
}

View file

@ -1,18 +1,18 @@
//@ compile-flags:--cfg yes --check-cfg=cfg(yes,no)
fn f_lt<#[cfg(yes)] 'a: 'a, #[cfg(FALSE)] T>() {}
fn f_ty<#[cfg(FALSE)] 'a: 'a, #[cfg(yes)] T>() {}
fn f_lt<#[cfg(yes)] 'a: 'a, #[cfg(false)] T>() {}
fn f_ty<#[cfg(false)] 'a: 'a, #[cfg(yes)] T>() {}
type FnGood = for<#[cfg(yes)] 'a, #[cfg(FALSE)] T> fn(); // OK
type FnBad = for<#[cfg(FALSE)] 'a, #[cfg(yes)] T> fn();
type FnGood = for<#[cfg(yes)] 'a, #[cfg(false)] T> fn(); // OK
type FnBad = for<#[cfg(false)] 'a, #[cfg(yes)] T> fn();
//~^ ERROR only lifetime parameters can be used in this context
type PolyGood = dyn for<#[cfg(yes)] 'a, #[cfg(FALSE)] T> Copy; // OK
type PolyBad = dyn for<#[cfg(FALSE)] 'a, #[cfg(yes)] T> Copy;
type PolyGood = dyn for<#[cfg(yes)] 'a, #[cfg(false)] T> Copy; // OK
type PolyBad = dyn for<#[cfg(false)] 'a, #[cfg(yes)] T> Copy;
//~^ ERROR only lifetime parameters can be used in this context
struct WhereGood where for<#[cfg(yes)] 'a, #[cfg(FALSE)] T> u8: Copy; // OK
struct WhereBad where for<#[cfg(FALSE)] 'a, #[cfg(yes)] T> u8: Copy;
struct WhereGood where for<#[cfg(yes)] 'a, #[cfg(false)] T> u8: Copy; // OK
struct WhereBad where for<#[cfg(false)] 'a, #[cfg(yes)] T> u8: Copy;
//~^ ERROR only lifetime parameters can be used in this context
fn f_lt_no<#[cfg_attr(FALSE, unknown)] 'a>() {} // OK

View file

@ -31,7 +31,7 @@ LL | struct WhereYes where for<#[cfg_attr(yes, unknown)] 'a> u8: Copy;
error[E0658]: only lifetime parameters can be used in this context
--> $DIR/cfg-generic-params.rs:7:48
|
LL | type FnBad = for<#[cfg(FALSE)] 'a, #[cfg(yes)] T> fn();
LL | type FnBad = for<#[cfg(false)] 'a, #[cfg(yes)] T> fn();
| ^
|
= note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
@ -41,7 +41,7 @@ LL | type FnBad = for<#[cfg(FALSE)] 'a, #[cfg(yes)] T> fn();
error[E0658]: only lifetime parameters can be used in this context
--> $DIR/cfg-generic-params.rs:11:54
|
LL | type PolyBad = dyn for<#[cfg(FALSE)] 'a, #[cfg(yes)] T> Copy;
LL | type PolyBad = dyn for<#[cfg(false)] 'a, #[cfg(yes)] T> Copy;
| ^
|
= note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information
@ -51,7 +51,7 @@ LL | type PolyBad = dyn for<#[cfg(FALSE)] 'a, #[cfg(yes)] T> Copy;
error[E0658]: only lifetime parameters can be used in this context
--> $DIR/cfg-generic-params.rs:15:57
|
LL | struct WhereBad where for<#[cfg(FALSE)] 'a, #[cfg(yes)] T> u8: Copy;
LL | struct WhereBad where for<#[cfg(false)] 'a, #[cfg(yes)] T> u8: Copy;
| ^
|
= note: see issue #108185 <https://github.com/rust-lang/rust/issues/108185> for more information

View file

@ -1 +1 @@
#![cfg(FALSE)] //~ ERROR `main` function not found in crate `cfg_in_crate_1`
#![cfg(false)] //~ ERROR `main` function not found in crate `cfg_in_crate_1`

View file

@ -1,7 +1,7 @@
error[E0601]: `main` function not found in crate `cfg_in_crate_1`
--> $DIR/cfg-in-crate-1.rs:1:15
|
LL | #![cfg(FALSE)]
LL | #![cfg(false)]
| ^ consider adding a `main` function to `$DIR/cfg-in-crate-1.rs`
error: aborting due to 1 previous error

View file

@ -2,10 +2,10 @@
#![feature(custom_test_frameworks)]
fn main() {
let _ = #[cfg(FALSE)] ();
let _ = #[cfg(false)] ();
//~^ ERROR removing an expression is not supported in this position
let _ = 1 + 2 + #[cfg(FALSE)] 3;
let _ = 1 + 2 + #[cfg(false)] 3;
//~^ ERROR removing an expression is not supported in this position
let _ = [1, 2, 3][#[cfg(FALSE)] 1];
let _ = [1, 2, 3][#[cfg(false)] 1];
//~^ ERROR removing an expression is not supported in this position
}

View file

@ -1,19 +1,19 @@
error: removing an expression is not supported in this position
--> $DIR/cfg-non-opt-expr.rs:5:13
|
LL | let _ = #[cfg(FALSE)] ();
LL | let _ = #[cfg(false)] ();
| ^^^^^^^^^^^^^
error: removing an expression is not supported in this position
--> $DIR/cfg-non-opt-expr.rs:7:21
|
LL | let _ = 1 + 2 + #[cfg(FALSE)] 3;
LL | let _ = 1 + 2 + #[cfg(false)] 3;
| ^^^^^^^^^^^^^
error: removing an expression is not supported in this position
--> $DIR/cfg-non-opt-expr.rs:9:23
|
LL | let _ = [1, 2, 3][#[cfg(FALSE)] 1];
LL | let _ = [1, 2, 3][#[cfg(false)] 1];
| ^^^^^^^^^^^^^
error: aborting due to 3 previous errors

View file

@ -1,3 +1,3 @@
//@ ignore-test (auxiliary, used by other tests)
#![cfg_attr(all(), cfg(FALSE))]
#![cfg_attr(all(), cfg(false))]

View file

@ -1,6 +1,6 @@
fn main() {}
#[cfg(FALSE)]
#[cfg(false)]
fn container() {
const unsafe WhereIsFerris Now() {}
//~^ ERROR expected one of `extern` or `fn`

View file

@ -1,6 +1,6 @@
fn main() {}
#[cfg(FALSE)]
#[cfg(false)]
fn container() {
const extern "Rust" PUT_ANYTHING_YOU_WANT_HERE bug() -> usize { 1 }
//~^ ERROR expected `fn`

View file

@ -6,7 +6,7 @@
mod to_reuse {
use crate::S;
pub fn foo<'a>(#[cfg(FALSE)] a: u8, _b: &'a S) -> u32 {
pub fn foo<'a>(#[cfg(false)] a: u8, _b: &'a S) -> u32 {
1
}
}

View file

@ -1,5 +1,5 @@
#![feature(stmt_expr_attributes)]
fn main() {
let _ = #[cfg(FALSE)] if true {}; //~ ERROR removing an expression
let _ = #[cfg(false)] if true {}; //~ ERROR removing an expression
}

View file

@ -1,7 +1,7 @@
error: removing an expression is not supported in this position
--> $DIR/bad-cfg.rs:4:13
|
LL | let _ = #[cfg(FALSE)] if true {};
LL | let _ = #[cfg(false)] if true {};
| ^^^^^^^^^^^^^
error: aborting due to 1 previous error

View file

@ -1,12 +1,12 @@
//@ check-pass
#[cfg(FALSE)]
#[cfg(false)]
fn simple_attr() {
#[attr] if true {}
#[allow_warnings] if true {}
}
#[cfg(FALSE)]
#[cfg(false)]
fn if_else_chain() {
#[first_attr] if true {
} else if false {
@ -14,20 +14,20 @@ fn if_else_chain() {
}
}
#[cfg(FALSE)]
#[cfg(false)]
fn if_let() {
#[attr] if let Some(_) = Some(true) {}
}
fn bar() {
#[cfg(FALSE)]
#[cfg(false)]
if true {
let x: () = true; // Should not error due to the #[cfg(FALSE)]
let x: () = true; // Should not error due to the #[cfg(false)]
}
#[cfg_attr(not(FALSE), cfg(FALSE))]
#[cfg_attr(not(FALSE), cfg(false))]
if true {
let a: () = true; // Should not error due to the applied #[cfg(FALSE)]
let a: () = true; // Should not error due to the applied #[cfg(false)]
}
}

View file

@ -1,11 +1,11 @@
#[cfg(FALSE)]
#[cfg(false)]
fn if_else_parse_error() {
if true {
} #[attr] else if false { //~ ERROR expected
}
}
#[cfg(FALSE)]
#[cfg(false)]
fn else_attr_ifparse_error() {
if true {
} else #[attr] if false { //~ ERROR outer attributes are not allowed
@ -13,7 +13,7 @@ fn else_attr_ifparse_error() {
}
}
#[cfg(FALSE)]
#[cfg(false)]
fn else_parse_error() {
if true {
} else if false {

View file

@ -3,7 +3,7 @@
fn main() {
let x = 1;
#[cfg(FALSE)]
#[cfg(false)]
if false {
x = 2;
} else if true {

View file

@ -2,7 +2,7 @@
#![feature(let_chains)]
#[cfg(FALSE)]
#[cfg(false)]
fn foo() {
#[attr]
if let Some(_) = Some(true) && let Ok(_) = Ok(1) {

View file

@ -12,7 +12,7 @@ fn main() {
//~^^ ERROR `yield` can only be used
}
#[cfg(FALSE)]
#[cfg(false)]
fn foo() {
// Ok in 2024 edition
yield; //~ ERROR yield syntax is experimental

View file

@ -4,6 +4,6 @@ fn main() {
println!("x: {}", x);
// `box` syntax is allowed to be cfg-ed out for historical reasons (#65742).
#[cfg(FALSE)]
#[cfg(false)]
let box _x = Box::new('c');
}

View file

@ -17,7 +17,7 @@ fn test_async_gen() {
fn main() {}
#[cfg(FALSE)]
#[cfg(false)]
fn foo() {
gen {};
//[e2024]~^ ERROR: gen blocks are experimental

View file

@ -30,7 +30,7 @@ fn other_guards_dont() {
while let (x if guard(x)) = 0 {}
//~^ ERROR: guard patterns are experimental
#[cfg(FALSE)]
#[cfg(false)]
while let (x if guard(x)) = 0 {}
//~^ ERROR: guard patterns are experimental
}

View file

@ -6,8 +6,8 @@ fn main() {
let mut ref mut z = 14; //~ ERROR [E0658]
z = &mut 15;
#[cfg(FALSE)]
#[cfg(false)]
let mut ref x = 10; //~ ERROR [E0658]
#[cfg(FALSE)]
#[cfg(false)]
let mut ref mut y = 10; //~ ERROR [E0658]
}

View file

@ -15,12 +15,12 @@ fn main() {
//~^ ERROR `!` patterns are experimental
}
// Check that the gate operates even behind `cfg`.
#[cfg(FALSE)]
#[cfg(false)]
match *ptr {
!
//~^ ERROR `!` patterns are experimental
}
#[cfg(FALSE)]
#[cfg(false)]
match *ptr {
! => {}
//~^ ERROR `!` patterns are experimental
@ -60,13 +60,13 @@ fn main() {
// Check that the gate operates even behind `cfg`.
match Some(0) {
None => {}
#[cfg(FALSE)]
#[cfg(false)]
Some(_)
//~^ ERROR `match` arm with no body
}
match Some(0) {
_ => {}
#[cfg(FALSE)]
#[cfg(false)]
Some(_) if false
//~^ ERROR `match` arm with no body
}

View file

@ -9,7 +9,7 @@ fn main() {
};
// Test that the gate works behind a cfg
#[cfg(FALSE)]
#[cfg(false)]
val.match { //~ ERROR postfix match is experimental
Some(42) => "the answer to life, the universe, and everything",
_ => "might be the answer to something"

View file

@ -1,7 +1,7 @@
//@ compile-flags: --edition 2021
pub fn demo() -> Option<i32> {
#[cfg(FALSE)]
#[cfg(false)]
{
do yeet //~ ERROR `do yeet` expression is experimental
}
@ -9,7 +9,7 @@ pub fn demo() -> Option<i32> {
Some(1)
}
#[cfg(FALSE)]
#[cfg(false)]
pub fn alternative() -> Result<(), String> {
do yeet "hello"; //~ ERROR `do yeet` expression is experimental
}

View file

@ -5,7 +5,7 @@
macro a() {}
//~^ ERROR: `macro` is experimental
#[cfg(FALSE)]
#[cfg(false)]
macro b() {}
macro_rules! identity {
@ -17,13 +17,13 @@ identity! {
//~^ ERROR: `macro` is experimental
}
#[cfg(FALSE)]
#[cfg(false)]
identity! {
macro d() {} // No error
}
identity! {
#[cfg(FALSE)]
#[cfg(false)]
macro e() {}
}

View file

@ -2,7 +2,7 @@
// This file is used to test the behavior of the early-pass syntax warnings.
// If macro syntax is stabilized, replace with a different unstable syntax.
#[cfg(FALSE)]
#[cfg(false)]
macro b() {}
//~^ WARN: `macro` is experimental
//~| WARN: unstable syntax
@ -11,13 +11,13 @@ macro_rules! identity {
($($x:tt)*) => ($($x)*);
}
#[cfg(FALSE)]
#[cfg(false)]
identity! {
macro d() {} // No error
}
identity! {
#[cfg(FALSE)]
#[cfg(false)]
macro e() {}
//~^ WARN: `macro` is experimental
//~| WARN: unstable syntax

View file

@ -25,7 +25,7 @@ fn main() {
// Check that cfg works right
#[cfg(FALSE)]
#[cfg(false)]
fn c() {
#[rustc_dummy]
5;
@ -37,7 +37,7 @@ fn j() {
5;
}
#[cfg_attr(not(FALSE), cfg(FALSE))]
#[cfg_attr(not(FALSE), cfg(false))]
fn d() {
#[rustc_dummy]
8;
@ -57,7 +57,7 @@ macro_rules! item_mac {
#[rustc_dummy]
42;
#[cfg(FALSE)]
#[cfg(false)]
fn f() {
#[rustc_dummy]
5;
@ -69,7 +69,7 @@ macro_rules! item_mac {
5;
}
#[cfg_attr(not(FALSE), cfg(FALSE))]
#[cfg_attr(not(FALSE), cfg(false))]
fn g() {
#[rustc_dummy]
8;
@ -90,42 +90,42 @@ item_mac!(e);
// check that the gate visitor works right:
extern "C" {
#[cfg(FALSE)]
#[cfg(false)]
fn x(a: [u8; #[rustc_dummy] 5]);
fn y(a: [u8; #[rustc_dummy] 5]); //~ ERROR attributes on expressions are experimental
}
struct Foo;
impl Foo {
#[cfg(FALSE)]
#[cfg(false)]
const X: u8 = #[rustc_dummy] 5;
const Y: u8 = #[rustc_dummy] 5; //~ ERROR attributes on expressions are experimental
}
trait Bar {
#[cfg(FALSE)]
#[cfg(false)]
const X: [u8; #[rustc_dummy] 5];
const Y: [u8; #[rustc_dummy] 5]; //~ ERROR attributes on expressions are experimental
}
struct Joyce {
#[cfg(FALSE)]
#[cfg(false)]
field: [u8; #[rustc_dummy] 5],
field2: [u8; #[rustc_dummy] 5] //~ ERROR attributes on expressions are experimental
}
struct Walky(
#[cfg(FALSE)] [u8; #[rustc_dummy] 5],
#[cfg(false)] [u8; #[rustc_dummy] 5],
[u8; #[rustc_dummy] 5] //~ ERROR attributes on expressions are experimental
);
enum Mike {
Happy(
#[cfg(FALSE)] [u8; #[rustc_dummy] 5],
#[cfg(false)] [u8; #[rustc_dummy] 5],
[u8; #[rustc_dummy] 5] //~ ERROR attributes on expressions are experimental
),
Angry {
#[cfg(FALSE)]
#[cfg(false)]
field: [u8; #[rustc_dummy] 5],
field2: [u8; #[rustc_dummy] 5] //~ ERROR attributes on expressions are experimental
}
@ -133,7 +133,7 @@ enum Mike {
fn pat() {
match 5 {
#[cfg(FALSE)]
#[cfg(false)]
5 => #[rustc_dummy] (),
6 => #[rustc_dummy] (), //~ ERROR attributes on expressions are experimental
_ => (),

View file

@ -3,5 +3,5 @@
pub fn main() {
// Make sure that this view item is filtered out because otherwise it would
// trigger a compilation error
#[cfg(FALSE)] use bar as foo;
#[cfg(false)] use bar as foo;
}

View file

@ -9,7 +9,7 @@
fn main() {}
#[cfg(FALSE)]
#[cfg(false)]
fn syntax() {
match scrutinee {
...X => {} //~ ERROR range-to patterns with `...` are not allowed

View file

@ -3,7 +3,7 @@
fn main() {}
#[cfg(FALSE)]
#[cfg(false)]
fn foo() {
if let 0... = 1 {} //~ ERROR inclusive range with no end
if let 0..= = 1 {} //~ ERROR inclusive range with no end

View file

@ -1,6 +1,6 @@
fn main() {}
#[cfg(FALSE)]
#[cfg(false)]
fn syntax() {
match &0 {
&0.. | _ => {}

View file

@ -4,7 +4,7 @@
fn main() {}
#[cfg(FALSE)]
#[cfg(false)]
fn syntax() {
match scrutinee {
X.. | 0.. | 'a'.. | 0.0f32.. => {}

View file

@ -3,7 +3,7 @@
struct Foo;
impl Foo {
#![cfg(FALSE)]
#![cfg(false)]
fn method(&self) -> bool { false }
}
@ -12,7 +12,7 @@ impl Foo {
#![cfg(not(FALSE))]
// check that we don't eat attributes too eagerly.
#[cfg(FALSE)]
#[cfg(false)]
fn method(&self) -> bool { false }
fn method(&self) -> bool { true }

View file

@ -9,7 +9,7 @@ unsafe fn access(n:*mut A) -> (i32, f64) {
(x, y)
}
#[cfg(FALSE)]
#[cfg(false)]
unsafe fn access(n:*mut A) -> (i32, f64) {
let x : i32 = (*n).x;
let y : f64 = (*n).y;

View file

@ -3,7 +3,7 @@
#![allow(dead_code)]
struct Foo {
#[cfg(FALSE)]
#[cfg(false)]
bar: baz,
foo: isize,
}
@ -15,18 +15,18 @@ struct Foo2 {
enum Bar1 {
Bar1_1,
#[cfg(FALSE)]
#[cfg(false)]
Bar1_2(NotAType),
}
enum Bar2 {
#[cfg(FALSE)]
#[cfg(false)]
Bar2_1(NotAType),
}
enum Bar3 {
Bar3_1 {
#[cfg(FALSE)]
#[cfg(false)]
foo: isize,
bar: isize,
}

View file

@ -3,7 +3,7 @@
// `#[cfg]` on struct field permits empty unusable struct
struct S {
#[cfg(FALSE)]
#[cfg(false)]
a: int,
}

View file

@ -59,7 +59,7 @@ const _: () = sink! {
// The invalid literals used to cause errors, but this was changed by #102944.
// Except for `0b010.0f32`, because it's a lexer error.
#[cfg(FALSE)]
#[cfg(false)]
fn configured_out() {
"string"any_suffix; // OK
10u123; // OK

View file

@ -9,7 +9,7 @@ extern "C" {}
#[link(name = "foo", name = "bar")] //~ ERROR multiple `name` arguments
#[link(name = "...", kind = "dylib", kind = "bar")] //~ ERROR multiple `kind` arguments
#[link(name = "...", modifiers = "+verbatim", modifiers = "bar")] //~ ERROR multiple `modifiers` arguments
#[link(name = "...", cfg(FALSE), cfg(FALSE))] //~ ERROR multiple `cfg` arguments
#[link(name = "...", cfg(false), cfg(false))] //~ ERROR multiple `cfg` arguments
#[link(wasm_import_module = "foo", wasm_import_module = "bar")] //~ ERROR multiple `wasm_import_module` arguments
extern "C" {}

View file

@ -31,7 +31,7 @@ LL | #[link(name = "...", modifiers = "+verbatim", modifiers = "bar")]
error: multiple `cfg` arguments in a single `#[link]` attribute
--> $DIR/link-attr-validation-late.rs:12:34
|
LL | #[link(name = "...", cfg(FALSE), cfg(FALSE))]
LL | #[link(name = "...", cfg(false), cfg(false))]
| ^^^^^^^^^^
error: multiple `wasm_import_module` arguments in a single `#[link]` attribute

View file

@ -17,7 +17,7 @@ macro_rules! foo2 {
() => {};
}
#[cfg(FALSE)]
#[cfg(false)]
macro_rules! foo {
() => {};
}

View file

@ -6,7 +6,7 @@
macro_rules! expand_it {
() => {
#[cfg(FALSE)] 25; //~ WARN trailing semicolon in macro
#[cfg(false)] 25; //~ WARN trailing semicolon in macro
//~| WARN this was previously
}
}

View file

@ -1,7 +1,7 @@
warning: trailing semicolon in macro used in expression position
--> $DIR/lint-trailing-macro-call.rs:9:25
|
LL | #[cfg(FALSE)] 25;
LL | #[cfg(false)] 25;
| ^
...
LL | expand_it!()
@ -20,7 +20,7 @@ Future incompatibility report: Future breakage diagnostic:
warning: trailing semicolon in macro used in expression position
--> $DIR/lint-trailing-macro-call.rs:9:25
|
LL | #[cfg(FALSE)] 25;
LL | #[cfg(false)] 25;
| ^
...
LL | expand_it!()

View file

@ -9,7 +9,7 @@ macro_rules! compiles_fine {
// check that the attributes are recognised by requiring this
// to be removed to avoid a compile error
#[cfg(FALSE)]
#[cfg(false)]
static MISTYPED: () = "foo";
}
}

View file

@ -5,7 +5,7 @@ macro_rules! test { ($nm:ident,
$i:item) => (mod $nm { #![$a] $i }); }
test!(a,
#[cfg(FALSE)],
#[cfg(false)],
pub fn bar() { });
test!(b,

View file

@ -5,7 +5,7 @@ macro_rules! test { ($nm:ident,
$i:item) => (mod $nm { #[$a] $i }); }
test!(a,
#[cfg(FALSE)],
#[cfg(false)],
pub fn bar() { });
test!(b,

View file

@ -16,7 +16,7 @@ LL | $i:item) => (mod $nm { #[$a] $i }); }
| ^^^^^
LL |
LL | / test!(a,
LL | | #[cfg(FALSE)],
LL | | #[cfg(false)],
LL | | pub fn bar() { });
| |_______________________- in this macro invocation
= note: this error originates in the macro `test` (in Nightly builds, run with -Z macro-backtrace for more info)

View file

@ -1,6 +1,6 @@
//@ run-pass
#[cfg(FALSE)]
#[cfg(false)]
macro_rules! foo { () => (1) }
#[cfg(not(FALSE))]

View file

@ -1,4 +1,4 @@
#[cfg_attr(all(), cfg_attr(all(), cfg(FALSE)))]
#[cfg_attr(all(), cfg_attr(all(), cfg(false)))]
fn f() {}
fn main() { f() } //~ ERROR cannot find function `f` in this scope

View file

@ -9,5 +9,5 @@ fn main() {}
enum E { A, B }
use E::*;
#[cfg(FALSE)]
#[cfg(false)]
fn fun1((A | B): E) {} //~ ERROR top-level or-patterns are not allowed

View file

@ -9,5 +9,5 @@ fn main() {}
enum E { A, B }
use E::*;
#[cfg(FALSE)]
#[cfg(false)]
fn fun1(A | B: E) {} //~ ERROR top-level or-patterns are not allowed

View file

@ -18,7 +18,7 @@ accept_pat!([p | q]);
// Non-macro tests:
#[cfg(FALSE)]
#[cfg(false)]
fn or_patterns() {
// Top level of `let`:
let (| A | B);

View file

@ -6,7 +6,7 @@
fn main() {}
#[cfg(FALSE)]
#[cfg(false)]
fn leading() {
fn fun1( A: E) {} //~ ERROR top-level or-patterns are not allowed
fn fun2( A: E) {} //~ ERROR unexpected `||` before function parameter
@ -21,7 +21,7 @@ fn leading() {
let NS { f: | A }: NS; //~ ERROR unexpected token `||` in pattern
}
#[cfg(FALSE)]
#[cfg(false)]
fn trailing() {
let ( A ): E; //~ ERROR a trailing `|` is not allowed in an or-pattern
let (a ,): (E,); //~ ERROR a trailing `|` is not allowed in an or-pattern

View file

@ -6,7 +6,7 @@
fn main() {}
#[cfg(FALSE)]
#[cfg(false)]
fn leading() {
fn fun1( | A: E) {} //~ ERROR top-level or-patterns are not allowed
fn fun2( || A: E) {} //~ ERROR unexpected `||` before function parameter
@ -21,7 +21,7 @@ fn leading() {
let NS { f: || A }: NS; //~ ERROR unexpected token `||` in pattern
}
#[cfg(FALSE)]
#[cfg(false)]
fn trailing() {
let ( A | ): E; //~ ERROR a trailing `|` is not allowed in an or-pattern
let (a |,): (E,); //~ ERROR a trailing `|` is not allowed in an or-pattern

View file

@ -4,7 +4,7 @@
fn main() {}
#[cfg(FALSE)]
#[cfg(false)]
const _: () = {
pub trait A {
const _: () = ();

View file

@ -2,7 +2,7 @@
fn main() {}
#[cfg(FALSE)]
#[cfg(false)]
impl S {
static IA: u8 = 0; //~ ERROR associated `static` items are not allowed
static IB: u8; //~ ERROR associated `static` items are not allowed
@ -12,7 +12,7 @@ impl S {
//~^ ERROR a static item cannot be `default`
}
#[cfg(FALSE)]
#[cfg(false)]
trait T {
static TA: u8 = 0; //~ ERROR associated `static` items are not allowed
static TB: u8; //~ ERROR associated `static` items are not allowed
@ -22,7 +22,7 @@ trait T {
//~^ ERROR a static item cannot be `default`
}
#[cfg(FALSE)]
#[cfg(false)]
impl T for S {
static TA: u8 = 0; //~ ERROR associated `static` items are not allowed
static TB: u8; //~ ERROR associated `static` items are not allowed

View file

@ -1,108 +1,108 @@
fn main() {}
#[cfg(FALSE)] fn e() { let _ = [#[attr]]; }
#[cfg(false)] fn e() { let _ = [#[attr]]; }
//~^ ERROR expected expression, found `]`
#[cfg(FALSE)] fn e() { let _ = foo#[attr](); }
#[cfg(false)] fn e() { let _ = foo#[attr](); }
//~^ ERROR expected one of
#[cfg(FALSE)] fn e() { let _ = foo(#![attr]); }
#[cfg(false)] fn e() { let _ = foo(#![attr]); }
//~^ ERROR an inner attribute is not permitted in this context
//~| ERROR an inner attribute is not permitted in this context
//~| ERROR expected expression, found `)`
#[cfg(FALSE)] fn e() { let _ = x.foo(#![attr]); }
#[cfg(false)] fn e() { let _ = x.foo(#![attr]); }
//~^ ERROR an inner attribute is not permitted in this context
//~| ERROR expected expression, found `)`
#[cfg(FALSE)] fn e() { let _ = 0 + #![attr] 0; }
#[cfg(false)] fn e() { let _ = 0 + #![attr] 0; }
//~^ ERROR an inner attribute is not permitted in this context
#[cfg(FALSE)] fn e() { let _ = !#![attr] 0; }
#[cfg(false)] fn e() { let _ = !#![attr] 0; }
//~^ ERROR an inner attribute is not permitted in this context
#[cfg(FALSE)] fn e() { let _ = -#![attr] 0; }
#[cfg(false)] fn e() { let _ = -#![attr] 0; }
//~^ ERROR an inner attribute is not permitted in this context
#[cfg(FALSE)] fn e() { let _ = x #![attr] as Y; }
#[cfg(false)] fn e() { let _ = x #![attr] as Y; }
//~^ ERROR expected one of
#[cfg(FALSE)] fn e() { let _ = || #![attr] foo; }
#[cfg(false)] fn e() { let _ = || #![attr] foo; }
//~^ ERROR an inner attribute is not permitted in this context
#[cfg(FALSE)] fn e() { let _ = move || #![attr] foo; }
#[cfg(false)] fn e() { let _ = move || #![attr] foo; }
//~^ ERROR an inner attribute is not permitted in this context
#[cfg(FALSE)] fn e() { let _ = || #![attr] {foo}; }
#[cfg(false)] fn e() { let _ = || #![attr] {foo}; }
//~^ ERROR an inner attribute is not permitted in this context
#[cfg(FALSE)] fn e() { let _ = move || #![attr] {foo}; }
#[cfg(false)] fn e() { let _ = move || #![attr] {foo}; }
//~^ ERROR an inner attribute is not permitted in this context
#[cfg(FALSE)] fn e() { let _ = #[attr] ..#[attr] 0; }
#[cfg(false)] fn e() { let _ = #[attr] ..#[attr] 0; }
//~^ ERROR attributes are not allowed on range expressions starting with `..`
#[cfg(FALSE)] fn e() { let _ = #[attr] ..; }
#[cfg(false)] fn e() { let _ = #[attr] ..; }
//~^ ERROR attributes are not allowed on range expressions starting with `..`
#[cfg(FALSE)] fn e() { let _ = #[attr] &#![attr] 0; }
#[cfg(false)] fn e() { let _ = #[attr] &#![attr] 0; }
//~^ ERROR an inner attribute is not permitted in this context
#[cfg(FALSE)] fn e() { let _ = #[attr] &mut #![attr] 0; }
#[cfg(false)] fn e() { let _ = #[attr] &mut #![attr] 0; }
//~^ ERROR an inner attribute is not permitted in this context
#[cfg(FALSE)] fn e() { let _ = if 0 #[attr] {}; }
#[cfg(false)] fn e() { let _ = if 0 #[attr] {}; }
//~^ ERROR outer attributes are not allowed on `if`
#[cfg(FALSE)] fn e() { let _ = if 0 {#![attr]}; }
#[cfg(false)] fn e() { let _ = if 0 {#![attr]}; }
//~^ ERROR an inner attribute is not permitted in this context
#[cfg(FALSE)] fn e() { let _ = if 0 {} #[attr] else {}; }
#[cfg(false)] fn e() { let _ = if 0 {} #[attr] else {}; }
//~^ ERROR expected one of
#[cfg(FALSE)] fn e() { let _ = if 0 {} else #[attr] {}; }
#[cfg(false)] fn e() { let _ = if 0 {} else #[attr] {}; }
//~^ ERROR outer attributes are not allowed on `if`
#[cfg(FALSE)] fn e() { let _ = if 0 {} else {#![attr]}; }
#[cfg(false)] fn e() { let _ = if 0 {} else {#![attr]}; }
//~^ ERROR an inner attribute is not permitted in this context
#[cfg(FALSE)] fn e() { let _ = if 0 {} else #[attr] if 0 {}; }
#[cfg(false)] fn e() { let _ = if 0 {} else #[attr] if 0 {}; }
//~^ ERROR outer attributes are not allowed on `if`
#[cfg(FALSE)] fn e() { let _ = if 0 {} else if 0 #[attr] {}; }
#[cfg(false)] fn e() { let _ = if 0 {} else if 0 #[attr] {}; }
//~^ ERROR outer attributes are not allowed on `if`
#[cfg(FALSE)] fn e() { let _ = if 0 {} else if 0 {#![attr]}; }
#[cfg(false)] fn e() { let _ = if 0 {} else if 0 {#![attr]}; }
//~^ ERROR an inner attribute is not permitted in this context
#[cfg(FALSE)] fn e() { let _ = if let _ = 0 #[attr] {}; }
#[cfg(false)] fn e() { let _ = if let _ = 0 #[attr] {}; }
//~^ ERROR outer attributes are not allowed on `if`
#[cfg(FALSE)] fn e() { let _ = if let _ = 0 {#![attr]}; }
#[cfg(false)] fn e() { let _ = if let _ = 0 {#![attr]}; }
//~^ ERROR an inner attribute is not permitted in this context
#[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} #[attr] else {}; }
#[cfg(false)] fn e() { let _ = if let _ = 0 {} #[attr] else {}; }
//~^ ERROR expected one of
#[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else #[attr] {}; }
#[cfg(false)] fn e() { let _ = if let _ = 0 {} else #[attr] {}; }
//~^ ERROR outer attributes are not allowed on `if`
#[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else {#![attr]}; }
#[cfg(false)] fn e() { let _ = if let _ = 0 {} else {#![attr]}; }
//~^ ERROR an inner attribute is not permitted in this context
#[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else #[attr] if let _ = 0 {}; }
#[cfg(false)] fn e() { let _ = if let _ = 0 {} else #[attr] if let _ = 0 {}; }
//~^ ERROR outer attributes are not allowed on `if`
#[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 #[attr] {}; }
#[cfg(false)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 #[attr] {}; }
//~^ ERROR outer attributes are not allowed on `if`
#[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 {#![attr]}; }
#[cfg(false)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 {#![attr]}; }
//~^ ERROR an inner attribute is not permitted in this context
#[cfg(FALSE)] fn s() { #[attr] #![attr] let _ = 0; }
#[cfg(false)] fn s() { #[attr] #![attr] let _ = 0; }
//~^ ERROR an inner attribute is not permitted following an outer attribute
#[cfg(FALSE)] fn s() { #[attr] #![attr] 0; }
#[cfg(false)] fn s() { #[attr] #![attr] 0; }
//~^ ERROR an inner attribute is not permitted following an outer attribute
#[cfg(FALSE)] fn s() { #[attr] #![attr] foo!(); }
#[cfg(false)] fn s() { #[attr] #![attr] foo!(); }
//~^ ERROR an inner attribute is not permitted following an outer attribute
#[cfg(FALSE)] fn s() { #[attr] #![attr] foo![]; }
#[cfg(false)] fn s() { #[attr] #![attr] foo![]; }
//~^ ERROR an inner attribute is not permitted following an outer attribute
#[cfg(FALSE)] fn s() { #[attr] #![attr] foo!{}; }
#[cfg(false)] fn s() { #[attr] #![attr] foo!{}; }
//~^ ERROR an inner attribute is not permitted following an outer attribute
// FIXME: Allow attributes in pattern constexprs?
// note: requires parens in patterns to allow disambiguation
#[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] 10 => () } }
#[cfg(false)] fn e() { match 0 { 0..=#[attr] 10 => () } }
//~^ ERROR inclusive range with no end
//~| ERROR expected one of `=>`, `if`, or `|`, found `#`
#[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] -10 => () } }
#[cfg(false)] fn e() { match 0 { 0..=#[attr] -10 => () } }
//~^ ERROR inclusive range with no end
//~| ERROR expected one of `=>`, `if`, or `|`, found `#`
#[cfg(FALSE)] fn e() { match 0 { 0..=-#[attr] 10 => () } }
#[cfg(false)] fn e() { match 0 { 0..=-#[attr] 10 => () } }
//~^ ERROR unexpected token: `#`
#[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] FOO => () } }
#[cfg(false)] fn e() { match 0 { 0..=#[attr] FOO => () } }
//~^ ERROR inclusive range with no end
//~| ERROR expected one of `=>`, `if`, or `|`, found `#`
#[cfg(FALSE)] fn e() { let _ = x.#![attr]foo(); }
#[cfg(false)] fn e() { let _ = x.#![attr]foo(); }
//~^ ERROR unexpected token: `#`
//~| ERROR expected one of `.`
#[cfg(FALSE)] fn e() { let _ = x.#[attr]foo(); }
#[cfg(false)] fn e() { let _ = x.#[attr]foo(); }
//~^ ERROR unexpected token: `#`
//~| ERROR expected one of `.`
// make sure we don't catch this bug again...
#[cfg(FALSE)] fn e() { { fn foo() { #[attr]; } } }
#[cfg(false)] fn e() { { fn foo() { #[attr]; } } }
//~^ ERROR expected statement after outer attribute
#[cfg(FALSE)] fn e() { { fn foo() { #[attr] } } }
#[cfg(false)] fn e() { { fn foo() { #[attr] } } }
//~^ ERROR expected statement after outer attribute

View file

@ -1,19 +1,19 @@
error: expected expression, found `]`
--> $DIR/attr-stmt-expr-attr-bad.rs:3:40
|
LL | #[cfg(FALSE)] fn e() { let _ = [#[attr]]; }
LL | #[cfg(false)] fn e() { let _ = [#[attr]]; }
| ^ expected expression
error: expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, found `#`
--> $DIR/attr-stmt-expr-attr-bad.rs:5:35
|
LL | #[cfg(FALSE)] fn e() { let _ = foo#[attr](); }
LL | #[cfg(false)] fn e() { let _ = foo#[attr](); }
| ^ expected one of 8 possible tokens
error: an inner attribute is not permitted in this context
--> $DIR/attr-stmt-expr-attr-bad.rs:7:36
|
LL | #[cfg(FALSE)] fn e() { let _ = foo(#![attr]); }
LL | #[cfg(false)] fn e() { let _ = foo(#![attr]); }
| ^^^^^^^^
|
= note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
@ -22,7 +22,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = foo(#![attr]); }
error: an inner attribute is not permitted in this context
--> $DIR/attr-stmt-expr-attr-bad.rs:7:36
|
LL | #[cfg(FALSE)] fn e() { let _ = foo(#![attr]); }
LL | #[cfg(false)] fn e() { let _ = foo(#![attr]); }
| ^^^^^^^^
|
= note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
@ -32,13 +32,13 @@ LL | #[cfg(FALSE)] fn e() { let _ = foo(#![attr]); }
error: expected expression, found `)`
--> $DIR/attr-stmt-expr-attr-bad.rs:7:44
|
LL | #[cfg(FALSE)] fn e() { let _ = foo(#![attr]); }
LL | #[cfg(false)] fn e() { let _ = foo(#![attr]); }
| ^ expected expression
error: an inner attribute is not permitted in this context
--> $DIR/attr-stmt-expr-attr-bad.rs:11:38
|
LL | #[cfg(FALSE)] fn e() { let _ = x.foo(#![attr]); }
LL | #[cfg(false)] fn e() { let _ = x.foo(#![attr]); }
| ^^^^^^^^
|
= note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
@ -47,13 +47,13 @@ LL | #[cfg(FALSE)] fn e() { let _ = x.foo(#![attr]); }
error: expected expression, found `)`
--> $DIR/attr-stmt-expr-attr-bad.rs:11:46
|
LL | #[cfg(FALSE)] fn e() { let _ = x.foo(#![attr]); }
LL | #[cfg(false)] fn e() { let _ = x.foo(#![attr]); }
| ^ expected expression
error: an inner attribute is not permitted in this context
--> $DIR/attr-stmt-expr-attr-bad.rs:14:36
|
LL | #[cfg(FALSE)] fn e() { let _ = 0 + #![attr] 0; }
LL | #[cfg(false)] fn e() { let _ = 0 + #![attr] 0; }
| ^^^^^^^^
|
= note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
@ -62,7 +62,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = 0 + #![attr] 0; }
error: an inner attribute is not permitted in this context
--> $DIR/attr-stmt-expr-attr-bad.rs:16:33
|
LL | #[cfg(FALSE)] fn e() { let _ = !#![attr] 0; }
LL | #[cfg(false)] fn e() { let _ = !#![attr] 0; }
| ^^^^^^^^
|
= note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
@ -71,7 +71,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = !#![attr] 0; }
error: an inner attribute is not permitted in this context
--> $DIR/attr-stmt-expr-attr-bad.rs:18:33
|
LL | #[cfg(FALSE)] fn e() { let _ = -#![attr] 0; }
LL | #[cfg(false)] fn e() { let _ = -#![attr] 0; }
| ^^^^^^^^
|
= note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
@ -80,13 +80,13 @@ LL | #[cfg(FALSE)] fn e() { let _ = -#![attr] 0; }
error: expected one of `!`, `.`, `::`, `;`, `?`, `else`, `{`, or an operator, found `#`
--> $DIR/attr-stmt-expr-attr-bad.rs:20:34
|
LL | #[cfg(FALSE)] fn e() { let _ = x #![attr] as Y; }
LL | #[cfg(false)] fn e() { let _ = x #![attr] as Y; }
| ^ expected one of 8 possible tokens
error: an inner attribute is not permitted in this context
--> $DIR/attr-stmt-expr-attr-bad.rs:22:35
|
LL | #[cfg(FALSE)] fn e() { let _ = || #![attr] foo; }
LL | #[cfg(false)] fn e() { let _ = || #![attr] foo; }
| ^^^^^^^^
|
= note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
@ -95,7 +95,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = || #![attr] foo; }
error: an inner attribute is not permitted in this context
--> $DIR/attr-stmt-expr-attr-bad.rs:24:40
|
LL | #[cfg(FALSE)] fn e() { let _ = move || #![attr] foo; }
LL | #[cfg(false)] fn e() { let _ = move || #![attr] foo; }
| ^^^^^^^^
|
= note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
@ -104,7 +104,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = move || #![attr] foo; }
error: an inner attribute is not permitted in this context
--> $DIR/attr-stmt-expr-attr-bad.rs:26:35
|
LL | #[cfg(FALSE)] fn e() { let _ = || #![attr] {foo}; }
LL | #[cfg(false)] fn e() { let _ = || #![attr] {foo}; }
| ^^^^^^^^
|
= note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
@ -113,7 +113,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = || #![attr] {foo}; }
error: an inner attribute is not permitted in this context
--> $DIR/attr-stmt-expr-attr-bad.rs:28:40
|
LL | #[cfg(FALSE)] fn e() { let _ = move || #![attr] {foo}; }
LL | #[cfg(false)] fn e() { let _ = move || #![attr] {foo}; }
| ^^^^^^^^
|
= note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
@ -122,19 +122,19 @@ LL | #[cfg(FALSE)] fn e() { let _ = move || #![attr] {foo}; }
error: attributes are not allowed on range expressions starting with `..`
--> $DIR/attr-stmt-expr-attr-bad.rs:30:40
|
LL | #[cfg(FALSE)] fn e() { let _ = #[attr] ..#[attr] 0; }
LL | #[cfg(false)] fn e() { let _ = #[attr] ..#[attr] 0; }
| ^^
error: attributes are not allowed on range expressions starting with `..`
--> $DIR/attr-stmt-expr-attr-bad.rs:32:40
|
LL | #[cfg(FALSE)] fn e() { let _ = #[attr] ..; }
LL | #[cfg(false)] fn e() { let _ = #[attr] ..; }
| ^^
error: an inner attribute is not permitted in this context
--> $DIR/attr-stmt-expr-attr-bad.rs:34:41
|
LL | #[cfg(FALSE)] fn e() { let _ = #[attr] &#![attr] 0; }
LL | #[cfg(false)] fn e() { let _ = #[attr] &#![attr] 0; }
| ^^^^^^^^
|
= note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
@ -143,7 +143,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = #[attr] &#![attr] 0; }
error: an inner attribute is not permitted in this context
--> $DIR/attr-stmt-expr-attr-bad.rs:36:45
|
LL | #[cfg(FALSE)] fn e() { let _ = #[attr] &mut #![attr] 0; }
LL | #[cfg(false)] fn e() { let _ = #[attr] &mut #![attr] 0; }
| ^^^^^^^^
|
= note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
@ -152,21 +152,21 @@ LL | #[cfg(FALSE)] fn e() { let _ = #[attr] &mut #![attr] 0; }
error: outer attributes are not allowed on `if` and `else` branches
--> $DIR/attr-stmt-expr-attr-bad.rs:38:37
|
LL | #[cfg(FALSE)] fn e() { let _ = if 0 #[attr] {}; }
LL | #[cfg(false)] fn e() { let _ = if 0 #[attr] {}; }
| -- ^^^^^^^ -- the attributes are attached to this branch
| |
| the branch belongs to this `if`
|
help: remove the attributes
|
LL - #[cfg(FALSE)] fn e() { let _ = if 0 #[attr] {}; }
LL + #[cfg(FALSE)] fn e() { let _ = if 0 {}; }
LL - #[cfg(false)] fn e() { let _ = if 0 #[attr] {}; }
LL + #[cfg(false)] fn e() { let _ = if 0 {}; }
|
error: an inner attribute is not permitted in this context
--> $DIR/attr-stmt-expr-attr-bad.rs:40:38
|
LL | #[cfg(FALSE)] fn e() { let _ = if 0 {#![attr]}; }
LL | #[cfg(false)] fn e() { let _ = if 0 {#![attr]}; }
| ^^^^^^^^
|
= note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
@ -175,27 +175,27 @@ LL | #[cfg(FALSE)] fn e() { let _ = if 0 {#![attr]}; }
error: expected one of `.`, `;`, `?`, `else`, or an operator, found `#`
--> $DIR/attr-stmt-expr-attr-bad.rs:42:40
|
LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} #[attr] else {}; }
LL | #[cfg(false)] fn e() { let _ = if 0 {} #[attr] else {}; }
| ^ expected one of `.`, `;`, `?`, `else`, or an operator
error: outer attributes are not allowed on `if` and `else` branches
--> $DIR/attr-stmt-expr-attr-bad.rs:44:45
|
LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else #[attr] {}; }
LL | #[cfg(false)] fn e() { let _ = if 0 {} else #[attr] {}; }
| ---- ^^^^^^^ -- the attributes are attached to this branch
| |
| the branch belongs to this `else`
|
help: remove the attributes
|
LL - #[cfg(FALSE)] fn e() { let _ = if 0 {} else #[attr] {}; }
LL + #[cfg(FALSE)] fn e() { let _ = if 0 {} else {}; }
LL - #[cfg(false)] fn e() { let _ = if 0 {} else #[attr] {}; }
LL + #[cfg(false)] fn e() { let _ = if 0 {} else {}; }
|
error: an inner attribute is not permitted in this context
--> $DIR/attr-stmt-expr-attr-bad.rs:46:46
|
LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else {#![attr]}; }
LL | #[cfg(false)] fn e() { let _ = if 0 {} else {#![attr]}; }
| ^^^^^^^^
|
= note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
@ -204,35 +204,35 @@ LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else {#![attr]}; }
error: outer attributes are not allowed on `if` and `else` branches
--> $DIR/attr-stmt-expr-attr-bad.rs:48:45
|
LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else #[attr] if 0 {}; }
LL | #[cfg(false)] fn e() { let _ = if 0 {} else #[attr] if 0 {}; }
| ---- ^^^^^^^ ------- the attributes are attached to this branch
| |
| the branch belongs to this `else`
|
help: remove the attributes
|
LL - #[cfg(FALSE)] fn e() { let _ = if 0 {} else #[attr] if 0 {}; }
LL + #[cfg(FALSE)] fn e() { let _ = if 0 {} else if 0 {}; }
LL - #[cfg(false)] fn e() { let _ = if 0 {} else #[attr] if 0 {}; }
LL + #[cfg(false)] fn e() { let _ = if 0 {} else if 0 {}; }
|
error: outer attributes are not allowed on `if` and `else` branches
--> $DIR/attr-stmt-expr-attr-bad.rs:50:50
|
LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else if 0 #[attr] {}; }
LL | #[cfg(false)] fn e() { let _ = if 0 {} else if 0 #[attr] {}; }
| -- ^^^^^^^ -- the attributes are attached to this branch
| |
| the branch belongs to this `if`
|
help: remove the attributes
|
LL - #[cfg(FALSE)] fn e() { let _ = if 0 {} else if 0 #[attr] {}; }
LL + #[cfg(FALSE)] fn e() { let _ = if 0 {} else if 0 {}; }
LL - #[cfg(false)] fn e() { let _ = if 0 {} else if 0 #[attr] {}; }
LL + #[cfg(false)] fn e() { let _ = if 0 {} else if 0 {}; }
|
error: an inner attribute is not permitted in this context
--> $DIR/attr-stmt-expr-attr-bad.rs:52:51
|
LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else if 0 {#![attr]}; }
LL | #[cfg(false)] fn e() { let _ = if 0 {} else if 0 {#![attr]}; }
| ^^^^^^^^
|
= note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
@ -241,21 +241,21 @@ LL | #[cfg(FALSE)] fn e() { let _ = if 0 {} else if 0 {#![attr]}; }
error: outer attributes are not allowed on `if` and `else` branches
--> $DIR/attr-stmt-expr-attr-bad.rs:54:45
|
LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 #[attr] {}; }
LL | #[cfg(false)] fn e() { let _ = if let _ = 0 #[attr] {}; }
| -- ^^^^^^^ -- the attributes are attached to this branch
| |
| the branch belongs to this `if`
|
help: remove the attributes
|
LL - #[cfg(FALSE)] fn e() { let _ = if let _ = 0 #[attr] {}; }
LL + #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {}; }
LL - #[cfg(false)] fn e() { let _ = if let _ = 0 #[attr] {}; }
LL + #[cfg(false)] fn e() { let _ = if let _ = 0 {}; }
|
error: an inner attribute is not permitted in this context
--> $DIR/attr-stmt-expr-attr-bad.rs:56:46
|
LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {#![attr]}; }
LL | #[cfg(false)] fn e() { let _ = if let _ = 0 {#![attr]}; }
| ^^^^^^^^
|
= note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
@ -264,27 +264,27 @@ LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {#![attr]}; }
error: expected one of `.`, `;`, `?`, `else`, or an operator, found `#`
--> $DIR/attr-stmt-expr-attr-bad.rs:58:48
|
LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} #[attr] else {}; }
LL | #[cfg(false)] fn e() { let _ = if let _ = 0 {} #[attr] else {}; }
| ^ expected one of `.`, `;`, `?`, `else`, or an operator
error: outer attributes are not allowed on `if` and `else` branches
--> $DIR/attr-stmt-expr-attr-bad.rs:60:53
|
LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else #[attr] {}; }
LL | #[cfg(false)] fn e() { let _ = if let _ = 0 {} else #[attr] {}; }
| ---- ^^^^^^^ -- the attributes are attached to this branch
| |
| the branch belongs to this `else`
|
help: remove the attributes
|
LL - #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else #[attr] {}; }
LL + #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else {}; }
LL - #[cfg(false)] fn e() { let _ = if let _ = 0 {} else #[attr] {}; }
LL + #[cfg(false)] fn e() { let _ = if let _ = 0 {} else {}; }
|
error: an inner attribute is not permitted in this context
--> $DIR/attr-stmt-expr-attr-bad.rs:62:54
|
LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else {#![attr]}; }
LL | #[cfg(false)] fn e() { let _ = if let _ = 0 {} else {#![attr]}; }
| ^^^^^^^^
|
= note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
@ -293,35 +293,35 @@ LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else {#![attr]}; }
error: outer attributes are not allowed on `if` and `else` branches
--> $DIR/attr-stmt-expr-attr-bad.rs:64:53
|
LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else #[attr] if let _ = 0 {}; }
LL | #[cfg(false)] fn e() { let _ = if let _ = 0 {} else #[attr] if let _ = 0 {}; }
| ---- ^^^^^^^ --------------- the attributes are attached to this branch
| |
| the branch belongs to this `else`
|
help: remove the attributes
|
LL - #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else #[attr] if let _ = 0 {}; }
LL + #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 {}; }
LL - #[cfg(false)] fn e() { let _ = if let _ = 0 {} else #[attr] if let _ = 0 {}; }
LL + #[cfg(false)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 {}; }
|
error: outer attributes are not allowed on `if` and `else` branches
--> $DIR/attr-stmt-expr-attr-bad.rs:66:66
|
LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 #[attr] {}; }
LL | #[cfg(false)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 #[attr] {}; }
| -- ^^^^^^^ -- the attributes are attached to this branch
| |
| the branch belongs to this `if`
|
help: remove the attributes
|
LL - #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 #[attr] {}; }
LL + #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 {}; }
LL - #[cfg(false)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 #[attr] {}; }
LL + #[cfg(false)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 {}; }
|
error: an inner attribute is not permitted in this context
--> $DIR/attr-stmt-expr-attr-bad.rs:68:67
|
LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 {#![attr]}; }
LL | #[cfg(false)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 {#![attr]}; }
| ^^^^^^^^
|
= note: inner attributes, like `#![no_std]`, annotate the item enclosing them, and are usually found at the beginning of source files
@ -330,7 +330,7 @@ LL | #[cfg(FALSE)] fn e() { let _ = if let _ = 0 {} else if let _ = 0 {#![attr]}
error: an inner attribute is not permitted following an outer attribute
--> $DIR/attr-stmt-expr-attr-bad.rs:71:32
|
LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] let _ = 0; }
LL | #[cfg(false)] fn s() { #[attr] #![attr] let _ = 0; }
| ------- ^^^^^^^^ not permitted following an outer attribute
| |
| previous outer attribute
@ -341,7 +341,7 @@ LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] let _ = 0; }
error: an inner attribute is not permitted following an outer attribute
--> $DIR/attr-stmt-expr-attr-bad.rs:73:32
|
LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] 0; }
LL | #[cfg(false)] fn s() { #[attr] #![attr] 0; }
| ------- ^^^^^^^^ not permitted following an outer attribute
| |
| previous outer attribute
@ -352,7 +352,7 @@ LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] 0; }
error: an inner attribute is not permitted following an outer attribute
--> $DIR/attr-stmt-expr-attr-bad.rs:75:32
|
LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] foo!(); }
LL | #[cfg(false)] fn s() { #[attr] #![attr] foo!(); }
| ------- ^^^^^^^^ ------- the inner attribute doesn't annotate this item macro invocation
| | |
| | not permitted following an outer attribute
@ -363,7 +363,7 @@ LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] foo!(); }
error: an inner attribute is not permitted following an outer attribute
--> $DIR/attr-stmt-expr-attr-bad.rs:77:32
|
LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] foo![]; }
LL | #[cfg(false)] fn s() { #[attr] #![attr] foo![]; }
| ------- ^^^^^^^^ ------- the inner attribute doesn't annotate this item macro invocation
| | |
| | not permitted following an outer attribute
@ -374,7 +374,7 @@ LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] foo![]; }
error: an inner attribute is not permitted following an outer attribute
--> $DIR/attr-stmt-expr-attr-bad.rs:79:32
|
LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] foo!{}; }
LL | #[cfg(false)] fn s() { #[attr] #![attr] foo!{}; }
| ------- ^^^^^^^^ ------ the inner attribute doesn't annotate this item macro invocation
| | |
| | not permitted following an outer attribute
@ -385,100 +385,100 @@ LL | #[cfg(FALSE)] fn s() { #[attr] #![attr] foo!{}; }
error[E0586]: inclusive range with no end
--> $DIR/attr-stmt-expr-attr-bad.rs:85:35
|
LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] 10 => () } }
LL | #[cfg(false)] fn e() { match 0 { 0..=#[attr] 10 => () } }
| ^^^
|
= note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`)
help: use `..` instead
|
LL - #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] 10 => () } }
LL + #[cfg(FALSE)] fn e() { match 0 { 0..#[attr] 10 => () } }
LL - #[cfg(false)] fn e() { match 0 { 0..=#[attr] 10 => () } }
LL + #[cfg(false)] fn e() { match 0 { 0..#[attr] 10 => () } }
|
error: expected one of `=>`, `if`, or `|`, found `#`
--> $DIR/attr-stmt-expr-attr-bad.rs:85:38
|
LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] 10 => () } }
LL | #[cfg(false)] fn e() { match 0 { 0..=#[attr] 10 => () } }
| ^ expected one of `=>`, `if`, or `|`
error[E0586]: inclusive range with no end
--> $DIR/attr-stmt-expr-attr-bad.rs:88:35
|
LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] -10 => () } }
LL | #[cfg(false)] fn e() { match 0 { 0..=#[attr] -10 => () } }
| ^^^
|
= note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`)
help: use `..` instead
|
LL - #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] -10 => () } }
LL + #[cfg(FALSE)] fn e() { match 0 { 0..#[attr] -10 => () } }
LL - #[cfg(false)] fn e() { match 0 { 0..=#[attr] -10 => () } }
LL + #[cfg(false)] fn e() { match 0 { 0..#[attr] -10 => () } }
|
error: expected one of `=>`, `if`, or `|`, found `#`
--> $DIR/attr-stmt-expr-attr-bad.rs:88:38
|
LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] -10 => () } }
LL | #[cfg(false)] fn e() { match 0 { 0..=#[attr] -10 => () } }
| ^ expected one of `=>`, `if`, or `|`
error: unexpected token: `#`
--> $DIR/attr-stmt-expr-attr-bad.rs:91:39
|
LL | #[cfg(FALSE)] fn e() { match 0 { 0..=-#[attr] 10 => () } }
LL | #[cfg(false)] fn e() { match 0 { 0..=-#[attr] 10 => () } }
| ^
error[E0586]: inclusive range with no end
--> $DIR/attr-stmt-expr-attr-bad.rs:93:35
|
LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] FOO => () } }
LL | #[cfg(false)] fn e() { match 0 { 0..=#[attr] FOO => () } }
| ^^^
|
= note: inclusive ranges must be bounded at the end (`..=b` or `a..=b`)
help: use `..` instead
|
LL - #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] FOO => () } }
LL + #[cfg(FALSE)] fn e() { match 0 { 0..#[attr] FOO => () } }
LL - #[cfg(false)] fn e() { match 0 { 0..=#[attr] FOO => () } }
LL + #[cfg(false)] fn e() { match 0 { 0..#[attr] FOO => () } }
|
error: expected one of `=>`, `if`, or `|`, found `#`
--> $DIR/attr-stmt-expr-attr-bad.rs:93:38
|
LL | #[cfg(FALSE)] fn e() { match 0 { 0..=#[attr] FOO => () } }
LL | #[cfg(false)] fn e() { match 0 { 0..=#[attr] FOO => () } }
| ^ expected one of `=>`, `if`, or `|`
error: unexpected token: `#`
--> $DIR/attr-stmt-expr-attr-bad.rs:97:34
|
LL | #[cfg(FALSE)] fn e() { let _ = x.#![attr]foo(); }
LL | #[cfg(false)] fn e() { let _ = x.#![attr]foo(); }
| ^
error: expected one of `.`, `;`, `?`, `else`, or an operator, found `#`
--> $DIR/attr-stmt-expr-attr-bad.rs:97:34
|
LL | #[cfg(FALSE)] fn e() { let _ = x.#![attr]foo(); }
LL | #[cfg(false)] fn e() { let _ = x.#![attr]foo(); }
| ^ expected one of `.`, `;`, `?`, `else`, or an operator
error: unexpected token: `#`
--> $DIR/attr-stmt-expr-attr-bad.rs:100:34
|
LL | #[cfg(FALSE)] fn e() { let _ = x.#[attr]foo(); }
LL | #[cfg(false)] fn e() { let _ = x.#[attr]foo(); }
| ^
error: expected one of `.`, `;`, `?`, `else`, or an operator, found `#`
--> $DIR/attr-stmt-expr-attr-bad.rs:100:34
|
LL | #[cfg(FALSE)] fn e() { let _ = x.#[attr]foo(); }
LL | #[cfg(false)] fn e() { let _ = x.#[attr]foo(); }
| ^ expected one of `.`, `;`, `?`, `else`, or an operator
error: expected statement after outer attribute
--> $DIR/attr-stmt-expr-attr-bad.rs:105:37
|
LL | #[cfg(FALSE)] fn e() { { fn foo() { #[attr]; } } }
LL | #[cfg(false)] fn e() { { fn foo() { #[attr]; } } }
| ^^^^^^^
error: expected statement after outer attribute
--> $DIR/attr-stmt-expr-attr-bad.rs:107:37
|
LL | #[cfg(FALSE)] fn e() { { fn foo() { #[attr] } } }
LL | #[cfg(false)] fn e() { { fn foo() { #[attr] } } }
| ^^^^^^^
error: aborting due to 53 previous errors

View file

@ -1,7 +1,7 @@
#![feature(stmt_expr_attributes)]
fn foo() -> String {
#[cfg(FALSE)]
#[cfg(false)]
[1, 2, 3].iter().map(|c| c.to_string()).collect::<String>() //~ ERROR expected `;`, found `#`
#[cfg(not(FALSE))]
String::new()

View file

@ -1,7 +1,7 @@
error: expected `;`, found `#`
--> $DIR/multiple-tail-expr-behind-cfg.rs:5:64
|
LL | #[cfg(FALSE)]
LL | #[cfg(false)]
| ------------- only `;` terminated statements or tail expressions are allowed after this attribute
LL | [1, 2, 3].iter().map(|c| c.to_string()).collect::<String>()
| ^ expected `;` here
@ -18,7 +18,7 @@ LL | { [1, 2, 3].iter().map(|c| c.to_string()).collect::<String>() }
| + +
help: it seems like you are trying to provide different expressions depending on `cfg`, consider using `if cfg!(..)`
|
LL ~ if cfg!(FALSE) {
LL ~ if cfg!(false) {
LL ~ [1, 2, 3].iter().map(|c| c.to_string()).collect::<String>()
LL ~ } else if cfg!(not(FALSE)) {
LL ~ String::new()

View file

@ -5,7 +5,7 @@ macro_rules! the_macro {
#[cfg()]
$foo //~ ERROR expected `;`, found `#`
#[cfg(FALSE)]
#[cfg(false)]
$bar
};
}

View file

@ -6,7 +6,7 @@ LL | #[cfg()]
LL | $foo
| ^ expected `;` here
LL |
LL | #[cfg(FALSE)]
LL | #[cfg(false)]
| - unexpected token
...
LL | the_macro!( (); (); );

View file

@ -1,6 +1,6 @@
//@ check-pass
#[cfg(FALSE)]
#[cfg(false)]
fn syntax() {
foo::<T = u8, T: Ord, String>();
foo::<T = u8, 'a, T: Ord>();

View file

@ -4,7 +4,7 @@
fn main() {}
#[cfg(FALSE)]
#[cfg(false)]
mod free_items {
default extern crate foo; //~ ERROR an extern crate cannot be `default`
default use foo; //~ ERROR a `use` import cannot be `default`
@ -28,7 +28,7 @@ mod free_items {
default macro_rules! foo {} //~ ERROR a macro definition cannot be `default`
}
#[cfg(FALSE)]
#[cfg(false)]
extern "C" {
default extern crate foo; //~ ERROR an extern crate cannot be `default`
//~^ ERROR extern crate is not supported in `extern` blocks
@ -65,7 +65,7 @@ extern "C" {
//~^ ERROR macro definition is not supported in `extern` blocks
}
#[cfg(FALSE)]
#[cfg(false)]
impl S {
default extern crate foo; //~ ERROR an extern crate cannot be `default`
//~^ ERROR extern crate is not supported in `trait`s or `impl`s
@ -102,7 +102,7 @@ impl S {
//~^ ERROR macro definition is not supported in `trait`s or `impl`s
}
#[cfg(FALSE)]
#[cfg(false)]
trait T {
default extern crate foo; //~ ERROR an extern crate cannot be `default`
//~^ ERROR extern crate is not supported in `trait`s or `impl`s

View file

@ -5,13 +5,13 @@
fn main() {}
#[cfg(FALSE)]
#[cfg(false)]
extern "some_abi_that_we_are_sure_does_not_exist_semantically" fn foo() {}
#[cfg(FALSE)]
#[cfg(false)]
extern "some_abi_that_we_are_sure_does_not_exist_semantically" {
fn foo();
}
#[cfg(FALSE)]
#[cfg(false)]
type T = extern "some_abi_that_we_are_sure_does_not_exist_semantically" fn();

View file

@ -5,8 +5,8 @@
fn main() {}
#[cfg(FALSE)]
#[cfg(false)]
extern crate async;
#[cfg(FALSE)]
#[cfg(false)]
extern crate async as something_else;

View file

@ -4,7 +4,7 @@
fn main() {}
#[cfg(FALSE)]
#[cfg(false)]
fn syntax() {
fn f();
fn f() {}

View file

@ -5,7 +5,7 @@
fn main() {}
#[cfg(FALSE)]
#[cfg(false)]
fn syntax() {
async fn f();
unsafe fn f();

View file

@ -2,7 +2,7 @@
fn main() {}
#[cfg(FALSE)]
#[cfg(false)]
extern "C" {
const A: isize; //~ ERROR extern items cannot be `const`
const B: isize = 42; //~ ERROR extern items cannot be `const`

View file

@ -4,7 +4,7 @@
fn main() {}
#[cfg(FALSE)]
#[cfg(false)]
extern "C" {
static X: u8;
static mut Y: u8;

View file

@ -2,7 +2,7 @@
fn main() {}
#[cfg(FALSE)]
#[cfg(false)]
extern "C" {
type A: Ord;
type A<'a> where 'a: 'static;

View file

@ -2,7 +2,7 @@
fn main() {}
#[cfg(FALSE)]
#[cfg(false)]
impl X {
const Y: u8;
}

Some files were not shown because too many files have changed in this diff Show more