Skip to content

Commit

Permalink
Migrate even more feature gate tests to ui
Browse files Browse the repository at this point in the history
We also rename some of the files to conform to the
feature-gate-<feat_name>.rs pattern that is most common.
  • Loading branch information
est31 committed Dec 7, 2017
1 parent 38438c6 commit 6dba3e6
Show file tree
Hide file tree
Showing 71 changed files with 1,012 additions and 71 deletions.
15 changes: 0 additions & 15 deletions src/test/compile-fail/no-core-gated.rs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// gate-test-abi_unadjusted

extern "unadjusted" fn foo() {
//~^ ERROR: unadjusted ABI is an implementation detail and perma-unstable
}
Expand Down
12 changes: 12 additions & 0 deletions src/test/ui/feature-gate-abi_unadjusted.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
error: unadjusted ABI is an implementation detail and perma-unstable
--> $DIR/feature-gate-abi_unadjusted.rs:11:1
|
11 | / extern "unadjusted" fn foo() {
12 | | //~^ ERROR: unadjusted ABI is an implementation detail and perma-unstable
13 | | }
| |_^
|
= help: add #![feature(abi_unadjusted)] to the crate attributes to enable

error: aborting due to previous error

Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// gate-test-asm

fn main() {
unsafe {
asm!(""); //~ ERROR inline assembly is not stable enough
Expand Down
10 changes: 10 additions & 0 deletions src/test/ui/feature-gate-asm.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
error: inline assembly is not stable enough for use and is subject to change (see issue #29722)
--> $DIR/feature-gate-asm.rs:13:9
|
13 | asm!(""); //~ ERROR inline assembly is not stable enough
| ^^^^^^^^^
|
= help: add #![feature(asm)] to the crate attributes to enable

error: aborting due to previous error

File renamed without changes.
10 changes: 10 additions & 0 deletions src/test/ui/feature-gate-asm2.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
error: inline assembly is not stable enough for use and is subject to change (see issue #29722)
--> $DIR/feature-gate-asm2.rs:15:24
|
15 | println!("{}", asm!("")); //~ ERROR inline assembly is not stable
| ^^^^^^^^
|
= help: add #![feature(asm)] to the crate attributes to enable

error: aborting due to previous error

Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// gate-test-box_patterns

fn main() {
let box x = Box::new('c'); //~ ERROR box pattern syntax is experimental
println!("x: {}", x);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
error: box pattern syntax is experimental (see issue #29641)
--> $DIR/feature-gate-box-pat.rs:14:9
--> $DIR/feature-gate-box_patterns.rs:12:9
|
14 | let box x = Box::new('c'); //~ ERROR box pattern syntax is experimental
12 | let box x = Box::new('c'); //~ ERROR box pattern syntax is experimental
| ^^^^^
|
= help: add #![feature(box_patterns)] to the crate attributes to enable
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

// Test that the use of the box syntax is gated by `box_syntax` feature gate.

// gate-test-box_syntax

fn main() {
let x = box 3;
//~^ ERROR box expression syntax is experimental; you can call `Box::new` instead.
Expand Down
10 changes: 10 additions & 0 deletions src/test/ui/feature-gate-box_syntax.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
error: box expression syntax is experimental; you can call `Box::new` instead. (see issue #27779)
--> $DIR/feature-gate-box_syntax.rs:14:13
|
14 | let x = box 3;
| ^^^^^
|
= help: add #![feature(box_syntax)] to the crate attributes to enable

error: aborting due to previous error

Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// gate-test-concat_idents

const XY_1: i32 = 10;

fn main() {
Expand Down
18 changes: 18 additions & 0 deletions src/test/ui/feature-gate-concat_idents.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
error: `concat_idents` is not stable enough for use and is subject to change (see issue #29599)
--> $DIR/feature-gate-concat_idents.rs:15:13
|
15 | let a = concat_idents!(X, Y_1); //~ ERROR `concat_idents` is not stable
| ^^^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(concat_idents)] to the crate attributes to enable

error: `concat_idents` is not stable enough for use and is subject to change (see issue #29599)
--> $DIR/feature-gate-concat_idents.rs:16:13
|
16 | let b = concat_idents!(X, Y_2); //~ ERROR `concat_idents` is not stable
| ^^^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(concat_idents)] to the crate attributes to enable

error: aborting due to 2 previous errors

File renamed without changes.
10 changes: 10 additions & 0 deletions src/test/ui/feature-gate-concat_idents2.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
error: `concat_idents` is not stable enough for use and is subject to change (see issue #29599)
--> $DIR/feature-gate-concat_idents2.rs:14:5
|
14 | concat_idents!(a, b); //~ ERROR `concat_idents` is not stable enough
| ^^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(concat_idents)] to the crate attributes to enable

error: aborting due to previous error

File renamed without changes.
18 changes: 18 additions & 0 deletions src/test/ui/feature-gate-concat_idents3.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
error: `concat_idents` is not stable enough for use and is subject to change (see issue #29599)
--> $DIR/feature-gate-concat_idents3.rs:17:20
|
17 | assert_eq!(10, concat_idents!(X, Y_1)); //~ ERROR `concat_idents` is not stable
| ^^^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(concat_idents)] to the crate attributes to enable

error: `concat_idents` is not stable enough for use and is subject to change (see issue #29599)
--> $DIR/feature-gate-concat_idents3.rs:18:20
|
18 | assert_eq!(20, concat_idents!(X, Y_2)); //~ ERROR `concat_idents` is not stable
| ^^^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(concat_idents)] to the crate attributes to enable

error: aborting due to 2 previous errors

Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// gate-test-conservative_impl_trait

fn foo() -> impl Fn() { || {} }
//~^ ERROR `impl Trait` in return position is experimental

Expand Down
10 changes: 10 additions & 0 deletions src/test/ui/feature-gate-conservative_impl_trait.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
error: `impl Trait` in return position is experimental (see issue #34511)
--> $DIR/feature-gate-conservative_impl_trait.rs:11:13
|
11 | fn foo() -> impl Fn() { || {} }
| ^^^^^^^^^
|
= help: add #![feature(conservative_impl_trait)] to the crate attributes to enable

error: aborting due to previous error

Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@
// option. This file may not be copied, modified, or distributed
// except according to those terms.

// gate-test-const_fn

// Test use of const fn without feature gate.

const fn foo() -> usize { 0 } //~ ERROR const fn is unstable
Expand Down
60 changes: 60 additions & 0 deletions src/test/ui/feature-gate-const_fn.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
error[E0379]: trait fns cannot be declared const
--> $DIR/feature-gate-const_fn.rs:16:5
|
16 | const fn foo() -> u32; //~ ERROR const fn is unstable
| ^^^^^ trait fns cannot be const

error[E0379]: trait fns cannot be declared const
--> $DIR/feature-gate-const_fn.rs:18:5
|
18 | const fn bar() -> u32 { 0 } //~ ERROR const fn is unstable
| ^^^^^ trait fns cannot be const

error[E0379]: trait fns cannot be declared const
--> $DIR/feature-gate-const_fn.rs:27:5
|
27 | const fn foo() -> u32 { 0 } //~ ERROR const fn is unstable
| ^^^^^ trait fns cannot be const

error: const fn is unstable (see issue #24111)
--> $DIR/feature-gate-const_fn.rs:13:1
|
13 | const fn foo() -> usize { 0 } //~ ERROR const fn is unstable
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(const_fn)] to the crate attributes to enable

error: const fn is unstable (see issue #24111)
--> $DIR/feature-gate-const_fn.rs:16:5
|
16 | const fn foo() -> u32; //~ ERROR const fn is unstable
| ^^^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(const_fn)] to the crate attributes to enable

error: const fn is unstable (see issue #24111)
--> $DIR/feature-gate-const_fn.rs:18:5
|
18 | const fn bar() -> u32 { 0 } //~ ERROR const fn is unstable
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(const_fn)] to the crate attributes to enable

error: const fn is unstable (see issue #24111)
--> $DIR/feature-gate-const_fn.rs:23:5
|
23 | const fn baz() -> u32 { 0 } //~ ERROR const fn is unstable
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(const_fn)] to the crate attributes to enable

error: const fn is unstable (see issue #24111)
--> $DIR/feature-gate-const_fn.rs:27:5
|
27 | const fn foo() -> u32 { 0 } //~ ERROR const fn is unstable
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(const_fn)] to the crate attributes to enable

error: aborting due to 8 previous errors

Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@

// Check that literals in attributes parse just fine.

// gate-test-custom_attribute

#![feature(rustc_attrs, attr_literals)]
#![allow(dead_code)]
#![allow(unused_variables)]
Expand Down
106 changes: 106 additions & 0 deletions src/test/ui/feature-gate-custom_attribute.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
error: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute.rs:17:1
|
17 | #[fake_attr] //~ ERROR attribute `fake_attr` is currently unknown
| ^^^^^^^^^^^^
|
= help: add #![feature(custom_attribute)] to the crate attributes to enable

error: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute.rs:18:1
|
18 | #[fake_attr(100)] //~ ERROR attribute `fake_attr` is currently unknown
| ^^^^^^^^^^^^^^^^^
|
= help: add #![feature(custom_attribute)] to the crate attributes to enable

error: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute.rs:19:1
|
19 | #[fake_attr(1, 2, 3)] //~ ERROR attribute `fake_attr` is currently unknown
| ^^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(custom_attribute)] to the crate attributes to enable

error: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute.rs:20:1
|
20 | #[fake_attr("hello")] //~ ERROR attribute `fake_attr` is currently unknown
| ^^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(custom_attribute)] to the crate attributes to enable

error: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute.rs:21:1
|
21 | #[fake_attr(name = "hello")] //~ ERROR attribute `fake_attr` is currently unknown
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(custom_attribute)] to the crate attributes to enable

error: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute.rs:22:1
|
22 | #[fake_attr(1, "hi", key = 12, true, false)] //~ ERROR attribute `fake_attr` is currently unknown
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(custom_attribute)] to the crate attributes to enable

error: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute.rs:23:1
|
23 | #[fake_attr(key = "hello", val = 10)] //~ ERROR attribute `fake_attr` is currently unknown
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(custom_attribute)] to the crate attributes to enable

error: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute.rs:24:1
|
24 | #[fake_attr(key("hello"), val(10))] //~ ERROR attribute `fake_attr` is currently unknown
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(custom_attribute)] to the crate attributes to enable

error: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute.rs:25:1
|
25 | #[fake_attr(enabled = true, disabled = false)] //~ ERROR attribute `fake_attr` is currently unknown
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(custom_attribute)] to the crate attributes to enable

error: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute.rs:26:1
|
26 | #[fake_attr(true)] //~ ERROR attribute `fake_attr` is currently unknown
| ^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(custom_attribute)] to the crate attributes to enable

error: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute.rs:27:1
|
27 | #[fake_attr(pi = 3.14159)] //~ ERROR attribute `fake_attr` is currently unknown
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(custom_attribute)] to the crate attributes to enable

error: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute.rs:28:1
|
28 | #[fake_attr(b"hi")] //~ ERROR attribute `fake_attr` is currently unknown
| ^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(custom_attribute)] to the crate attributes to enable

error: The attribute `fake_doc` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
--> $DIR/feature-gate-custom_attribute.rs:29:1
|
29 | #[fake_doc(r"doc")] //~ ERROR attribute `fake_doc` is currently unknown
| ^^^^^^^^^^^^^^^^^^^
|
= help: add #![feature(custom_attribute)] to the crate attributes to enable

error: aborting due to 13 previous errors

Loading

0 comments on commit 6dba3e6

Please sign in to comment.