Rollup merge of #138632 - clubby789:stabilize-cfg-boolean-lit, r=davidtwco,Urgau,traviscross
Stabilize `cfg_boolean_literals` Closes #131204 `@rustbot` labels +T-lang +I-lang-nominated This will end up conflicting with the test in #138293 so whichever doesn't land first will need updating -- # Stabilization Report ## General design ### What is the RFC for this feature and what changes have occurred to the user-facing design since the RFC was finalized? [RFC 3695](https://github.com/rust-lang/rfcs/pull/3695), none. ### What behavior are we committing to that has been controversial? Summarize the major arguments pro/con. None ### Are there extensions to this feature that remain unstable? How do we know that we are not accidentally committing to those? None ## Has a call-for-testing period been conducted? If so, what feedback was received? Yes; only positive feedback was received. ## Implementation quality ### Summarize the major parts of the implementation and provide links into the code (or to PRs) Implemented in [#131034](https://github.com/rust-lang/rust/pull/131034). ### Summarize existing test coverage of this feature - [Basic usage, including `#[cfg()]`, `cfg!()` and `#[cfg_attr()]`](6d71251cf9/tests/ui/cfg/true-false.rs
) - [`--cfg=true/false` on the command line being accessible via `r#true/r#false`](6d71251cf9/tests/ui/cfg/raw-true-false.rs
) - [Interaction with the unstable `#[doc(cfg(..))]` feature](6d71251/tests/rustdoc-ui/cfg-boolean-literal.rs
) - [Denying `--check-cfg=cfg(true/false)`](6d71251/tests/ui/check-cfg/invalid-arguments.rs
) - Ensuring `--cfg false` on the command line doesn't change the meaning of `cfg(false)`: `tests/ui/cfg/cmdline-false.rs` - Ensuring both `cfg(true)` and `cfg(false)` on the same item result in it being disabled: `tests/ui/cfg/both-true-false.rs` ### What outstanding bugs in the issue tracker involve this feature? Are they stabilization-blocking? The above mentioned issue; it should not block as it interacts with another unstable feature. ### What FIXMEs are still in the code for that feature and why is it ok to leave them there? None ### Summarize contributors to the feature by name for recognition and assuredness that people involved in the feature agree with stabilization - `@clubby789` (RFC) - `@Urgau` (Implementation in rustc) ### Which tools need to be adjusted to support this feature. Has this work been done? `rustdoc`'s unstable`#[doc(cfg(..)]` has been updated to respect it. `cargo` has been updated with a forward compatibility lint to enable supporting it in cargo once stabilized. ## Type system and execution rules ### What updates are needed to the reference/specification? (link to PRs when they exist) A few lines to be added to the reference for configuration predicates, specified in the RFC.
This commit is contained in:
commit
0de803c38d
160 changed files with 537 additions and 633 deletions
|
@ -7,7 +7,6 @@ use rustc_session::config::ExpectedValues;
|
|||
use rustc_session::lint::BuiltinLintDiag;
|
||||
use rustc_session::lint::builtin::UNEXPECTED_CFGS;
|
||||
use rustc_session::parse::feature_err;
|
||||
use rustc_span::symbol::kw;
|
||||
use rustc_span::{Span, Symbol, sym};
|
||||
|
||||
use crate::session_diagnostics::{self, UnsupportedLiteralReason};
|
||||
|
@ -89,20 +88,6 @@ pub fn eval_condition(
|
|||
let cfg = match cfg {
|
||||
MetaItemInner::MetaItem(meta_item) => meta_item,
|
||||
MetaItemInner::Lit(MetaItemLit { kind: LitKind::Bool(b), .. }) => {
|
||||
if let Some(features) = features {
|
||||
// we can't use `try_gate_cfg` as symbols don't differentiate between `r#true`
|
||||
// and `true`, and we want to keep the former working without feature gate
|
||||
gate_cfg(
|
||||
&(
|
||||
if *b { kw::True } else { kw::False },
|
||||
sym::cfg_boolean_literals,
|
||||
|features: &Features| features.cfg_boolean_literals(),
|
||||
),
|
||||
cfg.span(),
|
||||
sess,
|
||||
features,
|
||||
);
|
||||
}
|
||||
return *b;
|
||||
}
|
||||
_ => {
|
||||
|
|
|
@ -95,6 +95,8 @@ declare_features! (
|
|||
(accepted, c_unwind, "1.81.0", Some(74990)),
|
||||
/// Allows `#[cfg_attr(predicate, multiple, attributes, here)]`.
|
||||
(accepted, cfg_attr_multi, "1.33.0", Some(54881)),
|
||||
/// Allows the use of `#[cfg(<true/false>)]`.
|
||||
(accepted, cfg_boolean_literals, "CURRENT_RUSTC_VERSION", Some(131204)),
|
||||
/// Allows the use of `#[cfg(doctest)]`, set when rustdoc is collecting doctests.
|
||||
(accepted, cfg_doctest, "1.40.0", Some(62210)),
|
||||
/// Enables `#[cfg(panic = "...")]` config key.
|
||||
|
|
|
@ -391,8 +391,6 @@ declare_features! (
|
|||
(unstable, async_trait_bounds, "1.85.0", Some(62290)),
|
||||
/// Allows using C-variadics.
|
||||
(unstable, c_variadic, "1.34.0", Some(44930)),
|
||||
/// Allows the use of `#[cfg(<true/false>)]`.
|
||||
(unstable, cfg_boolean_literals, "1.83.0", Some(131204)),
|
||||
/// Allows the use of `#[cfg(contract_checks)` to check if contract checks are enabled.
|
||||
(unstable, cfg_contract_checks, "1.86.0", Some(128044)),
|
||||
/// Allows the use of `#[cfg(overflow_checks)` to check if integer overflow behaviour.
|
||||
|
|
|
@ -1,22 +0,0 @@
|
|||
# `cfg_boolean_literals`
|
||||
|
||||
The tracking issue for this feature is: [#131204]
|
||||
|
||||
[#131204]: https://github.com/rust-lang/rust/issues/131204
|
||||
|
||||
------------------------
|
||||
|
||||
The `cfg_boolean_literals` feature makes it possible to use the `true`/`false`
|
||||
literal as cfg predicate. They always evaluate to true/false respectively.
|
||||
|
||||
## Examples
|
||||
|
||||
```rust
|
||||
#![feature(cfg_boolean_literals)]
|
||||
|
||||
#[cfg(true)]
|
||||
const A: i32 = 5;
|
||||
|
||||
#[cfg(all(false))]
|
||||
const A: i32 = 58 * 89;
|
||||
```
|
|
@ -3789,35 +3789,6 @@ The tracking issue for this feature is: [#64797]
|
|||
[#64797]: https://github.com/rust-lang/rust/issues/64797
|
||||
|
||||
------------------------
|
||||
"##,
|
||||
default_severity: Severity::Allow,
|
||||
warn_since: None,
|
||||
deny_since: None,
|
||||
},
|
||||
Lint {
|
||||
label: "cfg_boolean_literals",
|
||||
description: r##"# `cfg_boolean_literals`
|
||||
|
||||
The tracking issue for this feature is: [#131204]
|
||||
|
||||
[#131204]: https://github.com/rust-lang/rust/issues/131204
|
||||
|
||||
------------------------
|
||||
|
||||
The `cfg_boolean_literals` feature makes it possible to use the `true`/`false`
|
||||
literal as cfg predicate. They always evaluate to true/false respectively.
|
||||
|
||||
## Examples
|
||||
|
||||
```rust
|
||||
#![feature(cfg_boolean_literals)]
|
||||
|
||||
#[cfg(true)]
|
||||
const A: i32 = 5;
|
||||
|
||||
#[cfg(all(false))]
|
||||
const A: i32 = 58 * 89;
|
||||
```
|
||||
"##,
|
||||
default_severity: Severity::Allow,
|
||||
warn_since: None,
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
fn main() {}
|
||||
|
||||
#[cfg(FALSE)]
|
||||
#[cfg(false)]
|
||||
fn syntax() {
|
||||
let _ = #[attr] [];
|
||||
let _ = #[attr] [0];
|
||||
|
|
|
@ -4,5 +4,5 @@
|
|||
|
||||
fn main() {}
|
||||
|
||||
#[cfg(FALSE)]
|
||||
#[cfg(false)]
|
||||
enum Foo { pub V, }
|
||||
|
|
|
@ -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 {};
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
//@ check-pass
|
||||
|
||||
#![feature(cfg_boolean_literals)]
|
||||
#![feature(doc_cfg)]
|
||||
|
||||
#[doc(cfg(false))]
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
// #138113: rustdoc didn't gate unstable predicates inside `doc(cfg(..))`
|
||||
#![feature(doc_cfg)]
|
||||
|
||||
// `cfg_boolean_literals`
|
||||
#[doc(cfg(false))] //~ ERROR `cfg(false)` is experimental and subject to change
|
||||
pub fn cfg_boolean_literals() {}
|
||||
|
||||
// `cfg_version`
|
||||
#[doc(cfg(sanitize = "thread"))] //~ ERROR `cfg(sanitize)` is experimental and subject to change
|
||||
pub fn cfg_sanitize() {}
|
||||
|
|
|
@ -1,15 +1,5 @@
|
|||
error[E0658]: `cfg(false)` is experimental and subject to change
|
||||
--> $DIR/doc-cfg-unstable.rs:5:11
|
||||
|
|
||||
LL | #[doc(cfg(false))]
|
||||
| ^^^^^
|
||||
|
|
||||
= note: see issue #131204 <https://github.com/rust-lang/rust/issues/131204> for more information
|
||||
= help: add `#![feature(cfg_boolean_literals)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: `cfg(sanitize)` is experimental and subject to change
|
||||
--> $DIR/doc-cfg-unstable.rs:9:11
|
||||
--> $DIR/doc-cfg-unstable.rs:5:11
|
||||
|
|
||||
LL | #[doc(cfg(sanitize = "thread"))]
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
@ -18,6 +8,6 @@ LL | #[doc(cfg(sanitize = "thread"))]
|
|||
= help: add `#![feature(cfg_sanitize)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error: aborting due to 2 previous errors
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
fn main() {
|
||||
#[cfg(FALSE)]
|
||||
#[cfg(false)]
|
||||
<() as module>::mac!(); //~ ERROR macros cannot use qualified paths
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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() {}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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!
|
||||
|
|
|
@ -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)]
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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)]
|
||||
|
|
|
@ -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() {}
|
||||
}
|
||||
|
|
14
tests/ui/cfg/both-true-false.rs
Normal file
14
tests/ui/cfg/both-true-false.rs
Normal file
|
@ -0,0 +1,14 @@
|
|||
/// Test that placing a `cfg(true)` and `cfg(false)` on the same item result in
|
||||
//. it being disabled.`
|
||||
|
||||
#[cfg(false)]
|
||||
#[cfg(true)]
|
||||
fn foo() {}
|
||||
|
||||
#[cfg(true)]
|
||||
#[cfg(false)]
|
||||
fn foo() {}
|
||||
|
||||
fn main() {
|
||||
foo(); //~ ERROR cannot find function `foo` in this scope
|
||||
}
|
9
tests/ui/cfg/both-true-false.stderr
Normal file
9
tests/ui/cfg/both-true-false.stderr
Normal file
|
@ -0,0 +1,9 @@
|
|||
error[E0425]: cannot find function `foo` in this scope
|
||||
--> $DIR/both-true-false.rs:13:5
|
||||
|
|
||||
LL | foo();
|
||||
| ^^^ not found in this scope
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0425`.
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -11,7 +11,7 @@ fn foo(f: Foo) {
|
|||
Foo::Bar => {},
|
||||
#[cfg(not(FALSE))]
|
||||
Foo::Baz => {},
|
||||
#[cfg(FALSE)]
|
||||
#[cfg(false)]
|
||||
Basdfwe => {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
9
tests/ui/cfg/cmdline-false.rs
Normal file
9
tests/ui/cfg/cmdline-false.rs
Normal file
|
@ -0,0 +1,9 @@
|
|||
/// Test that `--cfg false` doesn't cause `cfg(false)` to evaluate to `true`
|
||||
//@ compile-flags: --cfg false
|
||||
|
||||
#[cfg(false)]
|
||||
fn foo() {}
|
||||
|
||||
fn main() {
|
||||
foo(); //~ ERROR cannot find function `foo` in this scope
|
||||
}
|
9
tests/ui/cfg/cmdline-false.stderr
Normal file
9
tests/ui/cfg/cmdline-false.stderr
Normal file
|
@ -0,0 +1,9 @@
|
|||
error[E0425]: cannot find function `foo` in this scope
|
||||
--> $DIR/cmdline-false.rs:8:5
|
||||
|
|
||||
LL | foo();
|
||||
| ^^^ not found in this scope
|
||||
|
||||
error: aborting due to 1 previous error
|
||||
|
||||
For more information about this error, try `rustc --explain E0425`.
|
|
@ -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);
|
||||
|
|
|
@ -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`
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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`
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
//@ run-pass
|
||||
|
||||
#![feature(link_cfg)]
|
||||
#![feature(cfg_boolean_literals)]
|
||||
|
||||
#[cfg(true)]
|
||||
fn foo() -> bool {
|
||||
|
|
|
@ -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() {}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#![allow(unexpected_cfgs)]
|
||||
|
||||
#[cfg(FALSE)]
|
||||
#[cfg(false)]
|
||||
fn bar() {}
|
||||
|
||||
fn foo() {
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#[allow(unexpected_cfgs)]
|
||||
mod aa {
|
||||
#[cfg(FALSE)]
|
||||
#[cfg(false)]
|
||||
fn bar() {}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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`
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
//@ ignore-test (auxiliary, used by other tests)
|
||||
|
||||
#![cfg_attr(all(), cfg(FALSE))]
|
||||
#![cfg_attr(all(), cfg(false))]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
fn main() {}
|
||||
|
||||
#[cfg(FALSE)]
|
||||
#[cfg(false)]
|
||||
fn container() {
|
||||
const unsafe WhereIsFerris Now() {}
|
||||
//~^ ERROR expected one of `extern` or `fn`
|
||||
|
|
|
@ -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`
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)]
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
fn main() {
|
||||
let x = 1;
|
||||
|
||||
#[cfg(FALSE)]
|
||||
#[cfg(false)]
|
||||
if false {
|
||||
x = 2;
|
||||
} else if true {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#![feature(let_chains)]
|
||||
|
||||
#[cfg(FALSE)]
|
||||
#[cfg(false)]
|
||||
fn foo() {
|
||||
#[attr]
|
||||
if let Some(_) = Some(true) && let Ok(_) = Ok(1) {
|
||||
|
|
|
@ -1,10 +0,0 @@
|
|||
#[cfg(true)] //~ ERROR `cfg(true)` is experimental
|
||||
fn foo() {}
|
||||
|
||||
#[cfg_attr(true, cfg(false))] //~ ERROR `cfg(true)` is experimental
|
||||
//~^ ERROR `cfg(false)` is experimental
|
||||
fn foo() {}
|
||||
|
||||
fn main() {
|
||||
cfg!(false); //~ ERROR `cfg(false)` is experimental
|
||||
}
|
|
@ -1,43 +0,0 @@
|
|||
error[E0658]: `cfg(true)` is experimental and subject to change
|
||||
--> $DIR/feature-gate-cfg-boolean-literals.rs:1:7
|
||||
|
|
||||
LL | #[cfg(true)]
|
||||
| ^^^^
|
||||
|
|
||||
= note: see issue #131204 <https://github.com/rust-lang/rust/issues/131204> for more information
|
||||
= help: add `#![feature(cfg_boolean_literals)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: `cfg(true)` is experimental and subject to change
|
||||
--> $DIR/feature-gate-cfg-boolean-literals.rs:4:12
|
||||
|
|
||||
LL | #[cfg_attr(true, cfg(false))]
|
||||
| ^^^^
|
||||
|
|
||||
= note: see issue #131204 <https://github.com/rust-lang/rust/issues/131204> for more information
|
||||
= help: add `#![feature(cfg_boolean_literals)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: `cfg(false)` is experimental and subject to change
|
||||
--> $DIR/feature-gate-cfg-boolean-literals.rs:4:22
|
||||
|
|
||||
LL | #[cfg_attr(true, cfg(false))]
|
||||
| ^^^^^
|
||||
|
|
||||
= note: see issue #131204 <https://github.com/rust-lang/rust/issues/131204> for more information
|
||||
= help: add `#![feature(cfg_boolean_literals)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error[E0658]: `cfg(false)` is experimental and subject to change
|
||||
--> $DIR/feature-gate-cfg-boolean-literals.rs:9:10
|
||||
|
|
||||
LL | cfg!(false);
|
||||
| ^^^^^
|
||||
|
|
||||
= note: see issue #131204 <https://github.com/rust-lang/rust/issues/131204> for more information
|
||||
= help: add `#![feature(cfg_boolean_literals)]` to the crate attributes to enable
|
||||
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
|
||||
|
||||
error: aborting due to 4 previous errors
|
||||
|
||||
For more information about this error, try `rustc --explain E0658`.
|
|
@ -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
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ fn test_async_gen() {
|
|||
|
||||
fn main() {}
|
||||
|
||||
#[cfg(FALSE)]
|
||||
#[cfg(false)]
|
||||
fn foo() {
|
||||
gen {};
|
||||
//[e2024]~^ ERROR: gen blocks are experimental
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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]
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
//@ 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
|
||||
}
|
||||
|
|
|
@ -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() {}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
_ => (),
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
fn main() {}
|
||||
|
||||
#[cfg(FALSE)]
|
||||
#[cfg(false)]
|
||||
fn syntax() {
|
||||
match scrutinee {
|
||||
...X => {} //~ ERROR range-to patterns with `...` are not allowed
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
fn main() {}
|
||||
|
||||
#[cfg(FALSE)]
|
||||
#[cfg(false)]
|
||||
fn syntax() {
|
||||
match &0 {
|
||||
&0.. | _ => {}
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
fn main() {}
|
||||
|
||||
#[cfg(FALSE)]
|
||||
#[cfg(false)]
|
||||
fn syntax() {
|
||||
match scrutinee {
|
||||
X.. | 0.. | 'a'.. | 0.0f32.. => {}
|
||||
|
|
|
@ -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 }
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
// `#[cfg]` on struct field permits empty unusable struct
|
||||
|
||||
struct S {
|
||||
#[cfg(FALSE)]
|
||||
#[cfg(false)]
|
||||
a: int,
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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" {}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
//@ check-pass
|
||||
|
||||
#![feature(cfg_boolean_literals)]
|
||||
#![warn(unused)]
|
||||
|
||||
macro_rules! foo {
|
||||
|
|
|
@ -1,41 +1,41 @@
|
|||
warning: unused attribute `inline`
|
||||
--> $DIR/inert-attr-macro.rs:11:5
|
||||
--> $DIR/inert-attr-macro.rs:10:5
|
||||
|
|
||||
LL | #[inline] foo!();
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
note: the built-in attribute `inline` will be ignored, since it's applied to the macro invocation `foo`
|
||||
--> $DIR/inert-attr-macro.rs:11:15
|
||||
--> $DIR/inert-attr-macro.rs:10:15
|
||||
|
|
||||
LL | #[inline] foo!();
|
||||
| ^^^
|
||||
note: the lint level is defined here
|
||||
--> $DIR/inert-attr-macro.rs:4:9
|
||||
--> $DIR/inert-attr-macro.rs:3:9
|
||||
|
|
||||
LL | #![warn(unused)]
|
||||
| ^^^^^^
|
||||
= note: `#[warn(unused_attributes)]` implied by `#[warn(unused)]`
|
||||
|
||||
warning: unused attribute `allow`
|
||||
--> $DIR/inert-attr-macro.rs:15:5
|
||||
--> $DIR/inert-attr-macro.rs:14:5
|
||||
|
|
||||
LL | #[allow(warnings)] #[inline] foo!();
|
||||
| ^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
note: the built-in attribute `allow` will be ignored, since it's applied to the macro invocation `foo`
|
||||
--> $DIR/inert-attr-macro.rs:15:34
|
||||
--> $DIR/inert-attr-macro.rs:14:34
|
||||
|
|
||||
LL | #[allow(warnings)] #[inline] foo!();
|
||||
| ^^^
|
||||
|
||||
warning: unused attribute `inline`
|
||||
--> $DIR/inert-attr-macro.rs:15:24
|
||||
--> $DIR/inert-attr-macro.rs:14:24
|
||||
|
|
||||
LL | #[allow(warnings)] #[inline] foo!();
|
||||
| ^^^^^^^^^
|
||||
|
|
||||
note: the built-in attribute `inline` will be ignored, since it's applied to the macro invocation `foo`
|
||||
--> $DIR/inert-attr-macro.rs:15:34
|
||||
--> $DIR/inert-attr-macro.rs:14:34
|
||||
|
|
||||
LL | #[allow(warnings)] #[inline] foo!();
|
||||
| ^^^
|
||||
|
|
|
@ -17,7 +17,7 @@ macro_rules! foo2 {
|
|||
() => {};
|
||||
}
|
||||
|
||||
#[cfg(FALSE)]
|
||||
#[cfg(false)]
|
||||
macro_rules! foo {
|
||||
() => {};
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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!()
|
||||
|
|
|
@ -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";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
//@ run-pass
|
||||
|
||||
#[cfg(FALSE)]
|
||||
#[cfg(false)]
|
||||
macro_rules! foo { () => (1) }
|
||||
|
||||
#[cfg(not(FALSE))]
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
fn main() {}
|
||||
|
||||
#[cfg(FALSE)]
|
||||
#[cfg(false)]
|
||||
const _: () = {
|
||||
pub trait A {
|
||||
const _: () = ();
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue