From 9568ec6bef514515b14c78c7492186d509048968 Mon Sep 17 00:00:00 2001 From: "Havvy (Ryan Scheel)" Date: Tue, 11 Sep 2018 22:55:26 -0700 Subject: Move conditional configuration related UI tests into their own directory --- src/test/ui/auxiliary/namespaced_enums.rs | 20 -------- src/test/ui/cfg-arg-invalid-1.rs | 3 -- src/test/ui/cfg-arg-invalid-2.rs | 3 -- src/test/ui/cfg-arg-invalid-3.rs | 3 -- src/test/ui/cfg-arg-invalid-4.rs | 3 -- src/test/ui/cfg-arg-invalid-5.rs | 3 -- src/test/ui/cfg-attr-cfg-2.rs | 18 ------- src/test/ui/cfg-attr-cfg-2.stderr | 7 --- src/test/ui/cfg-attr-crate-2.rs | 17 ------ src/test/ui/cfg-attr-crate-2.stderr | 11 ---- src/test/ui/cfg-attr-invalid-predicate.rs | 12 ----- src/test/ui/cfg-attr-invalid-predicate.stderr | 9 ---- src/test/ui/cfg-attr-syntax-validation.rs | 32 ------------ src/test/ui/cfg-attr-syntax-validation.stderr | 60 ---------------------- .../cfg-attr-unknown-attribute-macro-expansion.rs | 20 -------- ...g-attr-unknown-attribute-macro-expansion.stderr | 14 ----- src/test/ui/cfg-empty-codemap.rs | 18 ------- src/test/ui/cfg-in-crate-1.rs | 13 ----- src/test/ui/cfg-in-crate-1.stderr | 7 --- src/test/ui/cfg-non-opt-expr.rs | 21 -------- src/test/ui/cfg-non-opt-expr.stderr | 20 -------- src/test/ui/cfg_attr_path.rs | 24 --------- src/test/ui/cfg_attr_path.stderr | 11 ---- .../auxiliary/namespaced_enums.rs | 20 ++++++++ .../conditional-compilation/cfg-arg-invalid-1.rs | 3 ++ .../conditional-compilation/cfg-arg-invalid-2.rs | 3 ++ .../conditional-compilation/cfg-arg-invalid-3.rs | 3 ++ .../conditional-compilation/cfg-arg-invalid-4.rs | 3 ++ .../conditional-compilation/cfg-arg-invalid-5.rs | 3 ++ .../ui/conditional-compilation/cfg-attr-cfg-2.rs | 18 +++++++ .../conditional-compilation/cfg-attr-cfg-2.stderr | 7 +++ .../ui/conditional-compilation/cfg-attr-crate-2.rs | 17 ++++++ .../cfg-attr-crate-2.stderr | 11 ++++ .../cfg-attr-invalid-predicate.rs | 12 +++++ .../cfg-attr-invalid-predicate.stderr | 9 ++++ .../cfg-attr-syntax-validation.rs | 32 ++++++++++++ .../cfg-attr-syntax-validation.stderr | 60 ++++++++++++++++++++++ .../cfg-attr-unknown-attribute-macro-expansion.rs | 20 ++++++++ ...g-attr-unknown-attribute-macro-expansion.stderr | 14 +++++ .../conditional-compilation/cfg-empty-codemap.rs | 18 +++++++ .../ui/conditional-compilation/cfg-in-crate-1.rs | 13 +++++ .../conditional-compilation/cfg-in-crate-1.stderr | 7 +++ .../ui/conditional-compilation/cfg-non-opt-expr.rs | 21 ++++++++ .../cfg-non-opt-expr.stderr | 20 ++++++++ .../ui/conditional-compilation/cfg_attr_path.rs | 24 +++++++++ .../conditional-compilation/cfg_attr_path.stderr | 11 ++++ 46 files changed, 349 insertions(+), 349 deletions(-) delete mode 100644 src/test/ui/auxiliary/namespaced_enums.rs delete mode 100644 src/test/ui/cfg-arg-invalid-1.rs delete mode 100644 src/test/ui/cfg-arg-invalid-2.rs delete mode 100644 src/test/ui/cfg-arg-invalid-3.rs delete mode 100644 src/test/ui/cfg-arg-invalid-4.rs delete mode 100644 src/test/ui/cfg-arg-invalid-5.rs delete mode 100644 src/test/ui/cfg-attr-cfg-2.rs delete mode 100644 src/test/ui/cfg-attr-cfg-2.stderr delete mode 100644 src/test/ui/cfg-attr-crate-2.rs delete mode 100644 src/test/ui/cfg-attr-crate-2.stderr delete mode 100644 src/test/ui/cfg-attr-invalid-predicate.rs delete mode 100644 src/test/ui/cfg-attr-invalid-predicate.stderr delete mode 100644 src/test/ui/cfg-attr-syntax-validation.rs delete mode 100644 src/test/ui/cfg-attr-syntax-validation.stderr delete mode 100644 src/test/ui/cfg-attr-unknown-attribute-macro-expansion.rs delete mode 100644 src/test/ui/cfg-attr-unknown-attribute-macro-expansion.stderr delete mode 100644 src/test/ui/cfg-empty-codemap.rs delete mode 100644 src/test/ui/cfg-in-crate-1.rs delete mode 100644 src/test/ui/cfg-in-crate-1.stderr delete mode 100644 src/test/ui/cfg-non-opt-expr.rs delete mode 100644 src/test/ui/cfg-non-opt-expr.stderr delete mode 100644 src/test/ui/cfg_attr_path.rs delete mode 100644 src/test/ui/cfg_attr_path.stderr create mode 100644 src/test/ui/conditional-compilation/auxiliary/namespaced_enums.rs create mode 100644 src/test/ui/conditional-compilation/cfg-arg-invalid-1.rs create mode 100644 src/test/ui/conditional-compilation/cfg-arg-invalid-2.rs create mode 100644 src/test/ui/conditional-compilation/cfg-arg-invalid-3.rs create mode 100644 src/test/ui/conditional-compilation/cfg-arg-invalid-4.rs create mode 100644 src/test/ui/conditional-compilation/cfg-arg-invalid-5.rs create mode 100644 src/test/ui/conditional-compilation/cfg-attr-cfg-2.rs create mode 100644 src/test/ui/conditional-compilation/cfg-attr-cfg-2.stderr create mode 100644 src/test/ui/conditional-compilation/cfg-attr-crate-2.rs create mode 100644 src/test/ui/conditional-compilation/cfg-attr-crate-2.stderr create mode 100644 src/test/ui/conditional-compilation/cfg-attr-invalid-predicate.rs create mode 100644 src/test/ui/conditional-compilation/cfg-attr-invalid-predicate.stderr create mode 100644 src/test/ui/conditional-compilation/cfg-attr-syntax-validation.rs create mode 100644 src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr create mode 100644 src/test/ui/conditional-compilation/cfg-attr-unknown-attribute-macro-expansion.rs create mode 100644 src/test/ui/conditional-compilation/cfg-attr-unknown-attribute-macro-expansion.stderr create mode 100644 src/test/ui/conditional-compilation/cfg-empty-codemap.rs create mode 100644 src/test/ui/conditional-compilation/cfg-in-crate-1.rs create mode 100644 src/test/ui/conditional-compilation/cfg-in-crate-1.stderr create mode 100644 src/test/ui/conditional-compilation/cfg-non-opt-expr.rs create mode 100644 src/test/ui/conditional-compilation/cfg-non-opt-expr.stderr create mode 100644 src/test/ui/conditional-compilation/cfg_attr_path.rs create mode 100644 src/test/ui/conditional-compilation/cfg_attr_path.stderr (limited to 'src/test') diff --git a/src/test/ui/auxiliary/namespaced_enums.rs b/src/test/ui/auxiliary/namespaced_enums.rs deleted file mode 100644 index 3bf39b788db..00000000000 --- a/src/test/ui/auxiliary/namespaced_enums.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub enum Foo { - A, - B(isize), - C { a: isize }, -} - -impl Foo { - pub fn foo() {} - pub fn bar(&self) {} -} diff --git a/src/test/ui/cfg-arg-invalid-1.rs b/src/test/ui/cfg-arg-invalid-1.rs deleted file mode 100644 index 36dd78dd2b1..00000000000 --- a/src/test/ui/cfg-arg-invalid-1.rs +++ /dev/null @@ -1,3 +0,0 @@ -// compile-flags: --cfg a(b=c) -// error-pattern: invalid `--cfg` argument: `a(b=c)` (expected `key` or `key="value"`) -fn main() {} diff --git a/src/test/ui/cfg-arg-invalid-2.rs b/src/test/ui/cfg-arg-invalid-2.rs deleted file mode 100644 index 48d656a4a28..00000000000 --- a/src/test/ui/cfg-arg-invalid-2.rs +++ /dev/null @@ -1,3 +0,0 @@ -// compile-flags: --cfg a{b} -// error-pattern: invalid `--cfg` argument: `a{b}` (expected `key` or `key="value"`) -fn main() {} diff --git a/src/test/ui/cfg-arg-invalid-3.rs b/src/test/ui/cfg-arg-invalid-3.rs deleted file mode 100644 index 96ac7828c5c..00000000000 --- a/src/test/ui/cfg-arg-invalid-3.rs +++ /dev/null @@ -1,3 +0,0 @@ -// compile-flags: --cfg a::b -// error-pattern: invalid `--cfg` argument: `a::b` (argument key must be an identifier) -fn main() {} diff --git a/src/test/ui/cfg-arg-invalid-4.rs b/src/test/ui/cfg-arg-invalid-4.rs deleted file mode 100644 index e7dfa17b4b6..00000000000 --- a/src/test/ui/cfg-arg-invalid-4.rs +++ /dev/null @@ -1,3 +0,0 @@ -// compile-flags: --cfg a(b) -// error-pattern: invalid `--cfg` argument: `a(b)` (expected `key` or `key="value"`) -fn main() {} diff --git a/src/test/ui/cfg-arg-invalid-5.rs b/src/test/ui/cfg-arg-invalid-5.rs deleted file mode 100644 index a939f451038..00000000000 --- a/src/test/ui/cfg-arg-invalid-5.rs +++ /dev/null @@ -1,3 +0,0 @@ -// compile-flags: --cfg a=10 -// error-pattern: invalid `--cfg` argument: `a=10` (argument value must be a string) -fn main() {} diff --git a/src/test/ui/cfg-attr-cfg-2.rs b/src/test/ui/cfg-attr-cfg-2.rs deleted file mode 100644 index 58a62d45ea5..00000000000 --- a/src/test/ui/cfg-attr-cfg-2.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -// -// error-pattern: `main` function not found -// compile-flags: --cfg foo - -// main is conditionally compiled, but the conditional compilation -// is conditional too! - -#[cfg_attr(foo, cfg(bar))] -fn main() { } diff --git a/src/test/ui/cfg-attr-cfg-2.stderr b/src/test/ui/cfg-attr-cfg-2.stderr deleted file mode 100644 index db3c7acff15..00000000000 --- a/src/test/ui/cfg-attr-cfg-2.stderr +++ /dev/null @@ -1,7 +0,0 @@ -error[E0601]: `main` function not found in crate `cfg_attr_cfg_2` - | - = note: consider adding a `main` function to `$DIR/cfg-attr-cfg-2.rs` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0601`. diff --git a/src/test/ui/cfg-attr-crate-2.rs b/src/test/ui/cfg-attr-crate-2.rs deleted file mode 100644 index a79c7663861..00000000000 --- a/src/test/ui/cfg-attr-crate-2.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -// -// compile-flags: --cfg broken - -// https://github.com/rust-lang/rust/issues/21833#issuecomment-72353044 - -#![cfg_attr(broken, no_core)] //~ ERROR no_core is experimental - -fn main() { } diff --git a/src/test/ui/cfg-attr-crate-2.stderr b/src/test/ui/cfg-attr-crate-2.stderr deleted file mode 100644 index 7b66c8f5e40..00000000000 --- a/src/test/ui/cfg-attr-crate-2.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error[E0658]: no_core is experimental (see issue #29639) - --> $DIR/cfg-attr-crate-2.rs:15:21 - | -LL | #![cfg_attr(broken, no_core)] //~ ERROR no_core is experimental - | ^^^^^^^^ - | - = help: add #![feature(no_core)] to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/cfg-attr-invalid-predicate.rs b/src/test/ui/cfg-attr-invalid-predicate.rs deleted file mode 100644 index 09fe6cec49c..00000000000 --- a/src/test/ui/cfg-attr-invalid-predicate.rs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#[cfg(foo(bar))] //~ ERROR invalid predicate `foo` -fn main() {} diff --git a/src/test/ui/cfg-attr-invalid-predicate.stderr b/src/test/ui/cfg-attr-invalid-predicate.stderr deleted file mode 100644 index 5a89f9766d1..00000000000 --- a/src/test/ui/cfg-attr-invalid-predicate.stderr +++ /dev/null @@ -1,9 +0,0 @@ -error[E0537]: invalid predicate `foo` - --> $DIR/cfg-attr-invalid-predicate.rs:11:7 - | -LL | #[cfg(foo(bar))] //~ ERROR invalid predicate `foo` - | ^^^^^^^^ - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0537`. diff --git a/src/test/ui/cfg-attr-syntax-validation.rs b/src/test/ui/cfg-attr-syntax-validation.rs deleted file mode 100644 index 06a22eff25c..00000000000 --- a/src/test/ui/cfg-attr-syntax-validation.rs +++ /dev/null @@ -1,32 +0,0 @@ -#[cfg] //~ ERROR `cfg` is not followed by parentheses -struct S1; - -#[cfg = 10] //~ ERROR `cfg` is not followed by parentheses -struct S2; - -#[cfg()] //~ ERROR `cfg` predicate is not specified -struct S3; - -#[cfg(a, b)] //~ ERROR multiple `cfg` predicates are specified -struct S4; - -#[cfg("str")] //~ ERROR `cfg` predicate key cannot be a literal -struct S5; - -#[cfg(a::b)] //~ ERROR `cfg` predicate key must be an identifier -struct S6; - -#[cfg(a())] //~ ERROR invalid predicate `a` -struct S7; - -#[cfg(a = 10)] //~ ERROR literal in `cfg` predicate value must be a string -struct S8; - -macro_rules! generate_s9 { - ($expr: expr) => { - #[cfg(feature = $expr)] //~ ERROR `cfg` is not a well-formed meta-item - struct S9; - } -} - -generate_s9!(concat!("nonexistent")); diff --git a/src/test/ui/cfg-attr-syntax-validation.stderr b/src/test/ui/cfg-attr-syntax-validation.stderr deleted file mode 100644 index 7773fdb8cf9..00000000000 --- a/src/test/ui/cfg-attr-syntax-validation.stderr +++ /dev/null @@ -1,60 +0,0 @@ -error: `cfg` is not followed by parentheses - --> $DIR/cfg-attr-syntax-validation.rs:1:1 - | -LL | #[cfg] //~ ERROR `cfg` is not followed by parentheses - | ^^^^^^ help: expected syntax is: `cfg(/* predicate */)` - -error: `cfg` is not followed by parentheses - --> $DIR/cfg-attr-syntax-validation.rs:4:1 - | -LL | #[cfg = 10] //~ ERROR `cfg` is not followed by parentheses - | ^^^^^^^^^^^ help: expected syntax is: `cfg(/* predicate */)` - -error: `cfg` predicate is not specified - --> $DIR/cfg-attr-syntax-validation.rs:7:1 - | -LL | #[cfg()] //~ ERROR `cfg` predicate is not specified - | ^^^^^^^^ - -error: multiple `cfg` predicates are specified - --> $DIR/cfg-attr-syntax-validation.rs:10:10 - | -LL | #[cfg(a, b)] //~ ERROR multiple `cfg` predicates are specified - | ^ - -error: `cfg` predicate key cannot be a literal - --> $DIR/cfg-attr-syntax-validation.rs:13:7 - | -LL | #[cfg("str")] //~ ERROR `cfg` predicate key cannot be a literal - | ^^^^^ - -error: `cfg` predicate key must be an identifier - --> $DIR/cfg-attr-syntax-validation.rs:16:7 - | -LL | #[cfg(a::b)] //~ ERROR `cfg` predicate key must be an identifier - | ^^^^ - -error[E0537]: invalid predicate `a` - --> $DIR/cfg-attr-syntax-validation.rs:19:7 - | -LL | #[cfg(a())] //~ ERROR invalid predicate `a` - | ^^^ - -error: literal in `cfg` predicate value must be a string - --> $DIR/cfg-attr-syntax-validation.rs:22:11 - | -LL | #[cfg(a = 10)] //~ ERROR literal in `cfg` predicate value must be a string - | ^^ - -error: `cfg` is not a well-formed meta-item - --> $DIR/cfg-attr-syntax-validation.rs:27:9 - | -LL | #[cfg(feature = $expr)] //~ ERROR `cfg` is not a well-formed meta-item - | ^^^^^^^^^^^^^^^^^^^^^^^ help: expected syntax is: `#[cfg(/* predicate */)]` -... -LL | generate_s9!(concat!("nonexistent")); - | ------------------------------------- in this macro invocation - -error: aborting due to 9 previous errors - -For more information about this error, try `rustc --explain E0537`. diff --git a/src/test/ui/cfg-attr-unknown-attribute-macro-expansion.rs b/src/test/ui/cfg-attr-unknown-attribute-macro-expansion.rs deleted file mode 100644 index afcb896b43c..00000000000 --- a/src/test/ui/cfg-attr-unknown-attribute-macro-expansion.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -macro_rules! foo { - () => { - #[cfg_attr(all(), unknown)] //~ ERROR `unknown` is currently unknown - fn foo() {} - } -} - -foo!(); - -fn main() {} diff --git a/src/test/ui/cfg-attr-unknown-attribute-macro-expansion.stderr b/src/test/ui/cfg-attr-unknown-attribute-macro-expansion.stderr deleted file mode 100644 index 0f51c7d68c6..00000000000 --- a/src/test/ui/cfg-attr-unknown-attribute-macro-expansion.stderr +++ /dev/null @@ -1,14 +0,0 @@ -error[E0658]: The attribute `unknown` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) - --> $DIR/cfg-attr-unknown-attribute-macro-expansion.rs:13:27 - | -LL | #[cfg_attr(all(), unknown)] //~ ERROR `unknown` is currently unknown - | ^^^^^^^ -... -LL | foo!(); - | ------- in this macro invocation - | - = help: add #![feature(custom_attribute)] to the crate attributes to enable - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/cfg-empty-codemap.rs b/src/test/ui/cfg-empty-codemap.rs deleted file mode 100644 index 5cf8135ca6b..00000000000 --- a/src/test/ui/cfg-empty-codemap.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Tests that empty source_maps don't ICE (#23301) - -// compile-flags: --cfg "" - -// error-pattern: invalid `--cfg` argument: `""` (expected `key` or `key="value"`) - -pub fn main() { -} diff --git a/src/test/ui/cfg-in-crate-1.rs b/src/test/ui/cfg-in-crate-1.rs deleted file mode 100644 index bbccf2bcd0f..00000000000 --- a/src/test/ui/cfg-in-crate-1.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// error-pattern: `main` function not found - -#![cfg(bar)] diff --git a/src/test/ui/cfg-in-crate-1.stderr b/src/test/ui/cfg-in-crate-1.stderr deleted file mode 100644 index c6d42c732c9..00000000000 --- a/src/test/ui/cfg-in-crate-1.stderr +++ /dev/null @@ -1,7 +0,0 @@ -error[E0601]: `main` function not found in crate `cfg_in_crate_1` - | - = note: consider adding a `main` function to `$DIR/cfg-in-crate-1.rs` - -error: aborting due to previous error - -For more information about this error, try `rustc --explain E0601`. diff --git a/src/test/ui/cfg-non-opt-expr.rs b/src/test/ui/cfg-non-opt-expr.rs deleted file mode 100644 index 55eca7f45a5..00000000000 --- a/src/test/ui/cfg-non-opt-expr.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(stmt_expr_attributes)] -#![feature(custom_test_frameworks)] - -fn main() { - let _ = #[cfg(unset)] (); - //~^ ERROR removing an expression is not supported in this position - let _ = 1 + 2 + #[cfg(unset)] 3; - //~^ ERROR removing an expression is not supported in this position - let _ = [1, 2, 3][#[cfg(unset)] 1]; - //~^ ERROR removing an expression is not supported in this position -} diff --git a/src/test/ui/cfg-non-opt-expr.stderr b/src/test/ui/cfg-non-opt-expr.stderr deleted file mode 100644 index 1892cee113e..00000000000 --- a/src/test/ui/cfg-non-opt-expr.stderr +++ /dev/null @@ -1,20 +0,0 @@ -error: removing an expression is not supported in this position - --> $DIR/cfg-non-opt-expr.rs:15:13 - | -LL | let _ = #[cfg(unset)] (); - | ^^^^^^^^^^^^^ - -error: removing an expression is not supported in this position - --> $DIR/cfg-non-opt-expr.rs:17:21 - | -LL | let _ = 1 + 2 + #[cfg(unset)] 3; - | ^^^^^^^^^^^^^ - -error: removing an expression is not supported in this position - --> $DIR/cfg-non-opt-expr.rs:19:23 - | -LL | let _ = [1, 2, 3][#[cfg(unset)] 1]; - | ^^^^^^^^^^^^^ - -error: aborting due to 3 previous errors - diff --git a/src/test/ui/cfg_attr_path.rs b/src/test/ui/cfg_attr_path.rs deleted file mode 100644 index 7d799850a65..00000000000 --- a/src/test/ui/cfg_attr_path.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(rustc_attrs)] -#![allow(dead_code)] -#![deny(unused_attributes)] // c.f #35584 - -mod auxiliary { - #[cfg_attr(any(), path = "nonexistent_file.rs")] pub mod namespaced_enums; - #[cfg_attr(all(), path = "namespaced_enums.rs")] pub mod nonexistent_file; -} - -#[rustc_error] -fn main() { //~ ERROR compilation successful - let _ = auxiliary::namespaced_enums::Foo::A; - let _ = auxiliary::nonexistent_file::Foo::A; -} diff --git a/src/test/ui/cfg_attr_path.stderr b/src/test/ui/cfg_attr_path.stderr deleted file mode 100644 index 67e59d054d5..00000000000 --- a/src/test/ui/cfg_attr_path.stderr +++ /dev/null @@ -1,11 +0,0 @@ -error: compilation successful - --> $DIR/cfg_attr_path.rs:21:1 - | -LL | / fn main() { //~ ERROR compilation successful -LL | | let _ = auxiliary::namespaced_enums::Foo::A; -LL | | let _ = auxiliary::nonexistent_file::Foo::A; -LL | | } - | |_^ - -error: aborting due to previous error - diff --git a/src/test/ui/conditional-compilation/auxiliary/namespaced_enums.rs b/src/test/ui/conditional-compilation/auxiliary/namespaced_enums.rs new file mode 100644 index 00000000000..3bf39b788db --- /dev/null +++ b/src/test/ui/conditional-compilation/auxiliary/namespaced_enums.rs @@ -0,0 +1,20 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub enum Foo { + A, + B(isize), + C { a: isize }, +} + +impl Foo { + pub fn foo() {} + pub fn bar(&self) {} +} diff --git a/src/test/ui/conditional-compilation/cfg-arg-invalid-1.rs b/src/test/ui/conditional-compilation/cfg-arg-invalid-1.rs new file mode 100644 index 00000000000..36dd78dd2b1 --- /dev/null +++ b/src/test/ui/conditional-compilation/cfg-arg-invalid-1.rs @@ -0,0 +1,3 @@ +// compile-flags: --cfg a(b=c) +// error-pattern: invalid `--cfg` argument: `a(b=c)` (expected `key` or `key="value"`) +fn main() {} diff --git a/src/test/ui/conditional-compilation/cfg-arg-invalid-2.rs b/src/test/ui/conditional-compilation/cfg-arg-invalid-2.rs new file mode 100644 index 00000000000..48d656a4a28 --- /dev/null +++ b/src/test/ui/conditional-compilation/cfg-arg-invalid-2.rs @@ -0,0 +1,3 @@ +// compile-flags: --cfg a{b} +// error-pattern: invalid `--cfg` argument: `a{b}` (expected `key` or `key="value"`) +fn main() {} diff --git a/src/test/ui/conditional-compilation/cfg-arg-invalid-3.rs b/src/test/ui/conditional-compilation/cfg-arg-invalid-3.rs new file mode 100644 index 00000000000..96ac7828c5c --- /dev/null +++ b/src/test/ui/conditional-compilation/cfg-arg-invalid-3.rs @@ -0,0 +1,3 @@ +// compile-flags: --cfg a::b +// error-pattern: invalid `--cfg` argument: `a::b` (argument key must be an identifier) +fn main() {} diff --git a/src/test/ui/conditional-compilation/cfg-arg-invalid-4.rs b/src/test/ui/conditional-compilation/cfg-arg-invalid-4.rs new file mode 100644 index 00000000000..e7dfa17b4b6 --- /dev/null +++ b/src/test/ui/conditional-compilation/cfg-arg-invalid-4.rs @@ -0,0 +1,3 @@ +// compile-flags: --cfg a(b) +// error-pattern: invalid `--cfg` argument: `a(b)` (expected `key` or `key="value"`) +fn main() {} diff --git a/src/test/ui/conditional-compilation/cfg-arg-invalid-5.rs b/src/test/ui/conditional-compilation/cfg-arg-invalid-5.rs new file mode 100644 index 00000000000..a939f451038 --- /dev/null +++ b/src/test/ui/conditional-compilation/cfg-arg-invalid-5.rs @@ -0,0 +1,3 @@ +// compile-flags: --cfg a=10 +// error-pattern: invalid `--cfg` argument: `a=10` (argument value must be a string) +fn main() {} diff --git a/src/test/ui/conditional-compilation/cfg-attr-cfg-2.rs b/src/test/ui/conditional-compilation/cfg-attr-cfg-2.rs new file mode 100644 index 00000000000..58a62d45ea5 --- /dev/null +++ b/src/test/ui/conditional-compilation/cfg-attr-cfg-2.rs @@ -0,0 +1,18 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +// +// error-pattern: `main` function not found +// compile-flags: --cfg foo + +// main is conditionally compiled, but the conditional compilation +// is conditional too! + +#[cfg_attr(foo, cfg(bar))] +fn main() { } diff --git a/src/test/ui/conditional-compilation/cfg-attr-cfg-2.stderr b/src/test/ui/conditional-compilation/cfg-attr-cfg-2.stderr new file mode 100644 index 00000000000..db3c7acff15 --- /dev/null +++ b/src/test/ui/conditional-compilation/cfg-attr-cfg-2.stderr @@ -0,0 +1,7 @@ +error[E0601]: `main` function not found in crate `cfg_attr_cfg_2` + | + = note: consider adding a `main` function to `$DIR/cfg-attr-cfg-2.rs` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0601`. diff --git a/src/test/ui/conditional-compilation/cfg-attr-crate-2.rs b/src/test/ui/conditional-compilation/cfg-attr-crate-2.rs new file mode 100644 index 00000000000..a79c7663861 --- /dev/null +++ b/src/test/ui/conditional-compilation/cfg-attr-crate-2.rs @@ -0,0 +1,17 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +// +// compile-flags: --cfg broken + +// https://github.com/rust-lang/rust/issues/21833#issuecomment-72353044 + +#![cfg_attr(broken, no_core)] //~ ERROR no_core is experimental + +fn main() { } diff --git a/src/test/ui/conditional-compilation/cfg-attr-crate-2.stderr b/src/test/ui/conditional-compilation/cfg-attr-crate-2.stderr new file mode 100644 index 00000000000..7b66c8f5e40 --- /dev/null +++ b/src/test/ui/conditional-compilation/cfg-attr-crate-2.stderr @@ -0,0 +1,11 @@ +error[E0658]: no_core is experimental (see issue #29639) + --> $DIR/cfg-attr-crate-2.rs:15:21 + | +LL | #![cfg_attr(broken, no_core)] //~ ERROR no_core is experimental + | ^^^^^^^^ + | + = help: add #![feature(no_core)] to the crate attributes to enable + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/conditional-compilation/cfg-attr-invalid-predicate.rs b/src/test/ui/conditional-compilation/cfg-attr-invalid-predicate.rs new file mode 100644 index 00000000000..09fe6cec49c --- /dev/null +++ b/src/test/ui/conditional-compilation/cfg-attr-invalid-predicate.rs @@ -0,0 +1,12 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[cfg(foo(bar))] //~ ERROR invalid predicate `foo` +fn main() {} diff --git a/src/test/ui/conditional-compilation/cfg-attr-invalid-predicate.stderr b/src/test/ui/conditional-compilation/cfg-attr-invalid-predicate.stderr new file mode 100644 index 00000000000..5a89f9766d1 --- /dev/null +++ b/src/test/ui/conditional-compilation/cfg-attr-invalid-predicate.stderr @@ -0,0 +1,9 @@ +error[E0537]: invalid predicate `foo` + --> $DIR/cfg-attr-invalid-predicate.rs:11:7 + | +LL | #[cfg(foo(bar))] //~ ERROR invalid predicate `foo` + | ^^^^^^^^ + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0537`. diff --git a/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.rs b/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.rs new file mode 100644 index 00000000000..06a22eff25c --- /dev/null +++ b/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.rs @@ -0,0 +1,32 @@ +#[cfg] //~ ERROR `cfg` is not followed by parentheses +struct S1; + +#[cfg = 10] //~ ERROR `cfg` is not followed by parentheses +struct S2; + +#[cfg()] //~ ERROR `cfg` predicate is not specified +struct S3; + +#[cfg(a, b)] //~ ERROR multiple `cfg` predicates are specified +struct S4; + +#[cfg("str")] //~ ERROR `cfg` predicate key cannot be a literal +struct S5; + +#[cfg(a::b)] //~ ERROR `cfg` predicate key must be an identifier +struct S6; + +#[cfg(a())] //~ ERROR invalid predicate `a` +struct S7; + +#[cfg(a = 10)] //~ ERROR literal in `cfg` predicate value must be a string +struct S8; + +macro_rules! generate_s9 { + ($expr: expr) => { + #[cfg(feature = $expr)] //~ ERROR `cfg` is not a well-formed meta-item + struct S9; + } +} + +generate_s9!(concat!("nonexistent")); diff --git a/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr b/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr new file mode 100644 index 00000000000..7773fdb8cf9 --- /dev/null +++ b/src/test/ui/conditional-compilation/cfg-attr-syntax-validation.stderr @@ -0,0 +1,60 @@ +error: `cfg` is not followed by parentheses + --> $DIR/cfg-attr-syntax-validation.rs:1:1 + | +LL | #[cfg] //~ ERROR `cfg` is not followed by parentheses + | ^^^^^^ help: expected syntax is: `cfg(/* predicate */)` + +error: `cfg` is not followed by parentheses + --> $DIR/cfg-attr-syntax-validation.rs:4:1 + | +LL | #[cfg = 10] //~ ERROR `cfg` is not followed by parentheses + | ^^^^^^^^^^^ help: expected syntax is: `cfg(/* predicate */)` + +error: `cfg` predicate is not specified + --> $DIR/cfg-attr-syntax-validation.rs:7:1 + | +LL | #[cfg()] //~ ERROR `cfg` predicate is not specified + | ^^^^^^^^ + +error: multiple `cfg` predicates are specified + --> $DIR/cfg-attr-syntax-validation.rs:10:10 + | +LL | #[cfg(a, b)] //~ ERROR multiple `cfg` predicates are specified + | ^ + +error: `cfg` predicate key cannot be a literal + --> $DIR/cfg-attr-syntax-validation.rs:13:7 + | +LL | #[cfg("str")] //~ ERROR `cfg` predicate key cannot be a literal + | ^^^^^ + +error: `cfg` predicate key must be an identifier + --> $DIR/cfg-attr-syntax-validation.rs:16:7 + | +LL | #[cfg(a::b)] //~ ERROR `cfg` predicate key must be an identifier + | ^^^^ + +error[E0537]: invalid predicate `a` + --> $DIR/cfg-attr-syntax-validation.rs:19:7 + | +LL | #[cfg(a())] //~ ERROR invalid predicate `a` + | ^^^ + +error: literal in `cfg` predicate value must be a string + --> $DIR/cfg-attr-syntax-validation.rs:22:11 + | +LL | #[cfg(a = 10)] //~ ERROR literal in `cfg` predicate value must be a string + | ^^ + +error: `cfg` is not a well-formed meta-item + --> $DIR/cfg-attr-syntax-validation.rs:27:9 + | +LL | #[cfg(feature = $expr)] //~ ERROR `cfg` is not a well-formed meta-item + | ^^^^^^^^^^^^^^^^^^^^^^^ help: expected syntax is: `#[cfg(/* predicate */)]` +... +LL | generate_s9!(concat!("nonexistent")); + | ------------------------------------- in this macro invocation + +error: aborting due to 9 previous errors + +For more information about this error, try `rustc --explain E0537`. diff --git a/src/test/ui/conditional-compilation/cfg-attr-unknown-attribute-macro-expansion.rs b/src/test/ui/conditional-compilation/cfg-attr-unknown-attribute-macro-expansion.rs new file mode 100644 index 00000000000..afcb896b43c --- /dev/null +++ b/src/test/ui/conditional-compilation/cfg-attr-unknown-attribute-macro-expansion.rs @@ -0,0 +1,20 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +macro_rules! foo { + () => { + #[cfg_attr(all(), unknown)] //~ ERROR `unknown` is currently unknown + fn foo() {} + } +} + +foo!(); + +fn main() {} diff --git a/src/test/ui/conditional-compilation/cfg-attr-unknown-attribute-macro-expansion.stderr b/src/test/ui/conditional-compilation/cfg-attr-unknown-attribute-macro-expansion.stderr new file mode 100644 index 00000000000..0f51c7d68c6 --- /dev/null +++ b/src/test/ui/conditional-compilation/cfg-attr-unknown-attribute-macro-expansion.stderr @@ -0,0 +1,14 @@ +error[E0658]: The attribute `unknown` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642) + --> $DIR/cfg-attr-unknown-attribute-macro-expansion.rs:13:27 + | +LL | #[cfg_attr(all(), unknown)] //~ ERROR `unknown` is currently unknown + | ^^^^^^^ +... +LL | foo!(); + | ------- in this macro invocation + | + = help: add #![feature(custom_attribute)] to the crate attributes to enable + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0658`. diff --git a/src/test/ui/conditional-compilation/cfg-empty-codemap.rs b/src/test/ui/conditional-compilation/cfg-empty-codemap.rs new file mode 100644 index 00000000000..5cf8135ca6b --- /dev/null +++ b/src/test/ui/conditional-compilation/cfg-empty-codemap.rs @@ -0,0 +1,18 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Tests that empty source_maps don't ICE (#23301) + +// compile-flags: --cfg "" + +// error-pattern: invalid `--cfg` argument: `""` (expected `key` or `key="value"`) + +pub fn main() { +} diff --git a/src/test/ui/conditional-compilation/cfg-in-crate-1.rs b/src/test/ui/conditional-compilation/cfg-in-crate-1.rs new file mode 100644 index 00000000000..bbccf2bcd0f --- /dev/null +++ b/src/test/ui/conditional-compilation/cfg-in-crate-1.rs @@ -0,0 +1,13 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// error-pattern: `main` function not found + +#![cfg(bar)] diff --git a/src/test/ui/conditional-compilation/cfg-in-crate-1.stderr b/src/test/ui/conditional-compilation/cfg-in-crate-1.stderr new file mode 100644 index 00000000000..c6d42c732c9 --- /dev/null +++ b/src/test/ui/conditional-compilation/cfg-in-crate-1.stderr @@ -0,0 +1,7 @@ +error[E0601]: `main` function not found in crate `cfg_in_crate_1` + | + = note: consider adding a `main` function to `$DIR/cfg-in-crate-1.rs` + +error: aborting due to previous error + +For more information about this error, try `rustc --explain E0601`. diff --git a/src/test/ui/conditional-compilation/cfg-non-opt-expr.rs b/src/test/ui/conditional-compilation/cfg-non-opt-expr.rs new file mode 100644 index 00000000000..55eca7f45a5 --- /dev/null +++ b/src/test/ui/conditional-compilation/cfg-non-opt-expr.rs @@ -0,0 +1,21 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(stmt_expr_attributes)] +#![feature(custom_test_frameworks)] + +fn main() { + let _ = #[cfg(unset)] (); + //~^ ERROR removing an expression is not supported in this position + let _ = 1 + 2 + #[cfg(unset)] 3; + //~^ ERROR removing an expression is not supported in this position + let _ = [1, 2, 3][#[cfg(unset)] 1]; + //~^ ERROR removing an expression is not supported in this position +} diff --git a/src/test/ui/conditional-compilation/cfg-non-opt-expr.stderr b/src/test/ui/conditional-compilation/cfg-non-opt-expr.stderr new file mode 100644 index 00000000000..1892cee113e --- /dev/null +++ b/src/test/ui/conditional-compilation/cfg-non-opt-expr.stderr @@ -0,0 +1,20 @@ +error: removing an expression is not supported in this position + --> $DIR/cfg-non-opt-expr.rs:15:13 + | +LL | let _ = #[cfg(unset)] (); + | ^^^^^^^^^^^^^ + +error: removing an expression is not supported in this position + --> $DIR/cfg-non-opt-expr.rs:17:21 + | +LL | let _ = 1 + 2 + #[cfg(unset)] 3; + | ^^^^^^^^^^^^^ + +error: removing an expression is not supported in this position + --> $DIR/cfg-non-opt-expr.rs:19:23 + | +LL | let _ = [1, 2, 3][#[cfg(unset)] 1]; + | ^^^^^^^^^^^^^ + +error: aborting due to 3 previous errors + diff --git a/src/test/ui/conditional-compilation/cfg_attr_path.rs b/src/test/ui/conditional-compilation/cfg_attr_path.rs new file mode 100644 index 00000000000..7d799850a65 --- /dev/null +++ b/src/test/ui/conditional-compilation/cfg_attr_path.rs @@ -0,0 +1,24 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(rustc_attrs)] +#![allow(dead_code)] +#![deny(unused_attributes)] // c.f #35584 + +mod auxiliary { + #[cfg_attr(any(), path = "nonexistent_file.rs")] pub mod namespaced_enums; + #[cfg_attr(all(), path = "namespaced_enums.rs")] pub mod nonexistent_file; +} + +#[rustc_error] +fn main() { //~ ERROR compilation successful + let _ = auxiliary::namespaced_enums::Foo::A; + let _ = auxiliary::nonexistent_file::Foo::A; +} diff --git a/src/test/ui/conditional-compilation/cfg_attr_path.stderr b/src/test/ui/conditional-compilation/cfg_attr_path.stderr new file mode 100644 index 00000000000..67e59d054d5 --- /dev/null +++ b/src/test/ui/conditional-compilation/cfg_attr_path.stderr @@ -0,0 +1,11 @@ +error: compilation successful + --> $DIR/cfg_attr_path.rs:21:1 + | +LL | / fn main() { //~ ERROR compilation successful +LL | | let _ = auxiliary::namespaced_enums::Foo::A; +LL | | let _ = auxiliary::nonexistent_file::Foo::A; +LL | | } + | |_^ + +error: aborting due to previous error + -- cgit 1.4.1-3-g733a5