Skip to content

Commit 6dba3e6

Browse files
committed
Migrate even more feature gate tests to ui
We also rename some of the files to conform to the feature-gate-<feat_name>.rs pattern that is most common.
1 parent 38438c6 commit 6dba3e6

File tree

71 files changed

+1012
-71
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+1012
-71
lines changed

src/test/compile-fail/no-core-gated.rs

-15
This file was deleted.

src/test/compile-fail/unadjusted-unstable.rs renamed to src/test/ui/feature-gate-abi_unadjusted.rs

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// gate-test-abi_unadjusted
12-
1311
extern "unadjusted" fn foo() {
1412
//~^ ERROR: unadjusted ABI is an implementation detail and perma-unstable
1513
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
error: unadjusted ABI is an implementation detail and perma-unstable
2+
--> $DIR/feature-gate-abi_unadjusted.rs:11:1
3+
|
4+
11 | / extern "unadjusted" fn foo() {
5+
12 | | //~^ ERROR: unadjusted ABI is an implementation detail and perma-unstable
6+
13 | | }
7+
| |_^
8+
|
9+
= help: add #![feature(abi_unadjusted)] to the crate attributes to enable
10+
11+
error: aborting due to previous error
12+

src/test/compile-fail/asm-gated.rs renamed to src/test/ui/feature-gate-asm.rs

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// gate-test-asm
12-
1311
fn main() {
1412
unsafe {
1513
asm!(""); //~ ERROR inline assembly is not stable enough

src/test/ui/feature-gate-asm.stderr

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: inline assembly is not stable enough for use and is subject to change (see issue #29722)
2+
--> $DIR/feature-gate-asm.rs:13:9
3+
|
4+
13 | asm!(""); //~ ERROR inline assembly is not stable enough
5+
| ^^^^^^^^^
6+
|
7+
= help: add #![feature(asm)] to the crate attributes to enable
8+
9+
error: aborting due to previous error
10+

src/test/ui/feature-gate-asm2.stderr

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: inline assembly is not stable enough for use and is subject to change (see issue #29722)
2+
--> $DIR/feature-gate-asm2.rs:15:24
3+
|
4+
15 | println!("{}", asm!("")); //~ ERROR inline assembly is not stable
5+
| ^^^^^^^^
6+
|
7+
= help: add #![feature(asm)] to the crate attributes to enable
8+
9+
error: aborting due to previous error
10+

src/test/ui/feature-gate-box-pat.rs renamed to src/test/ui/feature-gate-box_patterns.rs

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// gate-test-box_patterns
12-
1311
fn main() {
1412
let box x = Box::new('c'); //~ ERROR box pattern syntax is experimental
1513
println!("x: {}", x);

src/test/ui/feature-gate-box-pat.stderr renamed to src/test/ui/feature-gate-box_patterns.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
error: box pattern syntax is experimental (see issue #29641)
2-
--> $DIR/feature-gate-box-pat.rs:14:9
2+
--> $DIR/feature-gate-box_patterns.rs:12:9
33
|
4-
14 | let box x = Box::new('c'); //~ ERROR box pattern syntax is experimental
4+
12 | let box x = Box::new('c'); //~ ERROR box pattern syntax is experimental
55
| ^^^^^
66
|
77
= help: add #![feature(box_patterns)] to the crate attributes to enable

src/test/compile-fail/gated-box-syntax.rs renamed to src/test/ui/feature-gate-box_syntax.rs

-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

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

13-
// gate-test-box_syntax
14-
1513
fn main() {
1614
let x = box 3;
1715
//~^ ERROR box expression syntax is experimental; you can call `Box::new` instead.
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: box expression syntax is experimental; you can call `Box::new` instead. (see issue #27779)
2+
--> $DIR/feature-gate-box_syntax.rs:14:13
3+
|
4+
14 | let x = box 3;
5+
| ^^^^^
6+
|
7+
= help: add #![feature(box_syntax)] to the crate attributes to enable
8+
9+
error: aborting due to previous error
10+

src/test/compile-fail/concat_idents-gate.rs renamed to src/test/ui/feature-gate-concat_idents.rs

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// gate-test-concat_idents
12-
1311
const XY_1: i32 = 10;
1412

1513
fn main() {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
error: `concat_idents` is not stable enough for use and is subject to change (see issue #29599)
2+
--> $DIR/feature-gate-concat_idents.rs:15:13
3+
|
4+
15 | let a = concat_idents!(X, Y_1); //~ ERROR `concat_idents` is not stable
5+
| ^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= help: add #![feature(concat_idents)] to the crate attributes to enable
8+
9+
error: `concat_idents` is not stable enough for use and is subject to change (see issue #29599)
10+
--> $DIR/feature-gate-concat_idents.rs:16:13
11+
|
12+
16 | let b = concat_idents!(X, Y_2); //~ ERROR `concat_idents` is not stable
13+
| ^^^^^^^^^^^^^^^^^^^^^^
14+
|
15+
= help: add #![feature(concat_idents)] to the crate attributes to enable
16+
17+
error: aborting due to 2 previous errors
18+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: `concat_idents` is not stable enough for use and is subject to change (see issue #29599)
2+
--> $DIR/feature-gate-concat_idents2.rs:14:5
3+
|
4+
14 | concat_idents!(a, b); //~ ERROR `concat_idents` is not stable enough
5+
| ^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= help: add #![feature(concat_idents)] to the crate attributes to enable
8+
9+
error: aborting due to previous error
10+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
error: `concat_idents` is not stable enough for use and is subject to change (see issue #29599)
2+
--> $DIR/feature-gate-concat_idents3.rs:17:20
3+
|
4+
17 | assert_eq!(10, concat_idents!(X, Y_1)); //~ ERROR `concat_idents` is not stable
5+
| ^^^^^^^^^^^^^^^^^^^^^^
6+
|
7+
= help: add #![feature(concat_idents)] to the crate attributes to enable
8+
9+
error: `concat_idents` is not stable enough for use and is subject to change (see issue #29599)
10+
--> $DIR/feature-gate-concat_idents3.rs:18:20
11+
|
12+
18 | assert_eq!(20, concat_idents!(X, Y_2)); //~ ERROR `concat_idents` is not stable
13+
| ^^^^^^^^^^^^^^^^^^^^^^
14+
|
15+
= help: add #![feature(concat_idents)] to the crate attributes to enable
16+
17+
error: aborting due to 2 previous errors
18+

src/test/compile-fail/impl-trait/feature-gate.rs renamed to src/test/ui/feature-gate-conservative_impl_trait.rs

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// gate-test-conservative_impl_trait
12-
1311
fn foo() -> impl Fn() { || {} }
1412
//~^ ERROR `impl Trait` in return position is experimental
1513

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
error: `impl Trait` in return position is experimental (see issue #34511)
2+
--> $DIR/feature-gate-conservative_impl_trait.rs:11:13
3+
|
4+
11 | fn foo() -> impl Fn() { || {} }
5+
| ^^^^^^^^^
6+
|
7+
= help: add #![feature(conservative_impl_trait)] to the crate attributes to enable
8+
9+
error: aborting due to previous error
10+

src/test/compile-fail/const-fn-stability.rs renamed to src/test/ui/feature-gate-const_fn.rs

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// gate-test-const_fn
12-
1311
// Test use of const fn without feature gate.
1412

1513
const fn foo() -> usize { 0 } //~ ERROR const fn is unstable
+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
error[E0379]: trait fns cannot be declared const
2+
--> $DIR/feature-gate-const_fn.rs:16:5
3+
|
4+
16 | const fn foo() -> u32; //~ ERROR const fn is unstable
5+
| ^^^^^ trait fns cannot be const
6+
7+
error[E0379]: trait fns cannot be declared const
8+
--> $DIR/feature-gate-const_fn.rs:18:5
9+
|
10+
18 | const fn bar() -> u32 { 0 } //~ ERROR const fn is unstable
11+
| ^^^^^ trait fns cannot be const
12+
13+
error[E0379]: trait fns cannot be declared const
14+
--> $DIR/feature-gate-const_fn.rs:27:5
15+
|
16+
27 | const fn foo() -> u32 { 0 } //~ ERROR const fn is unstable
17+
| ^^^^^ trait fns cannot be const
18+
19+
error: const fn is unstable (see issue #24111)
20+
--> $DIR/feature-gate-const_fn.rs:13:1
21+
|
22+
13 | const fn foo() -> usize { 0 } //~ ERROR const fn is unstable
23+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
24+
|
25+
= help: add #![feature(const_fn)] to the crate attributes to enable
26+
27+
error: const fn is unstable (see issue #24111)
28+
--> $DIR/feature-gate-const_fn.rs:16:5
29+
|
30+
16 | const fn foo() -> u32; //~ ERROR const fn is unstable
31+
| ^^^^^^^^^^^^^^^^^^^^^^
32+
|
33+
= help: add #![feature(const_fn)] to the crate attributes to enable
34+
35+
error: const fn is unstable (see issue #24111)
36+
--> $DIR/feature-gate-const_fn.rs:18:5
37+
|
38+
18 | const fn bar() -> u32 { 0 } //~ ERROR const fn is unstable
39+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
40+
|
41+
= help: add #![feature(const_fn)] to the crate attributes to enable
42+
43+
error: const fn is unstable (see issue #24111)
44+
--> $DIR/feature-gate-const_fn.rs:23:5
45+
|
46+
23 | const fn baz() -> u32 { 0 } //~ ERROR const fn is unstable
47+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
48+
|
49+
= help: add #![feature(const_fn)] to the crate attributes to enable
50+
51+
error: const fn is unstable (see issue #24111)
52+
--> $DIR/feature-gate-const_fn.rs:27:5
53+
|
54+
27 | const fn foo() -> u32 { 0 } //~ ERROR const fn is unstable
55+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
56+
|
57+
= help: add #![feature(const_fn)] to the crate attributes to enable
58+
59+
error: aborting due to 8 previous errors
60+

src/test/compile-fail/attr-literals.rs renamed to src/test/ui/feature-gate-custom_attribute.rs

-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
// Check that literals in attributes parse just fine.
1212

13-
// gate-test-custom_attribute
14-
1513
#![feature(rustc_attrs, attr_literals)]
1614
#![allow(dead_code)]
1715
#![allow(unused_variables)]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
error: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
2+
--> $DIR/feature-gate-custom_attribute.rs:17:1
3+
|
4+
17 | #[fake_attr] //~ ERROR attribute `fake_attr` is currently unknown
5+
| ^^^^^^^^^^^^
6+
|
7+
= help: add #![feature(custom_attribute)] to the crate attributes to enable
8+
9+
error: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
10+
--> $DIR/feature-gate-custom_attribute.rs:18:1
11+
|
12+
18 | #[fake_attr(100)] //~ ERROR attribute `fake_attr` is currently unknown
13+
| ^^^^^^^^^^^^^^^^^
14+
|
15+
= help: add #![feature(custom_attribute)] to the crate attributes to enable
16+
17+
error: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
18+
--> $DIR/feature-gate-custom_attribute.rs:19:1
19+
|
20+
19 | #[fake_attr(1, 2, 3)] //~ ERROR attribute `fake_attr` is currently unknown
21+
| ^^^^^^^^^^^^^^^^^^^^^
22+
|
23+
= help: add #![feature(custom_attribute)] to the crate attributes to enable
24+
25+
error: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
26+
--> $DIR/feature-gate-custom_attribute.rs:20:1
27+
|
28+
20 | #[fake_attr("hello")] //~ ERROR attribute `fake_attr` is currently unknown
29+
| ^^^^^^^^^^^^^^^^^^^^^
30+
|
31+
= help: add #![feature(custom_attribute)] to the crate attributes to enable
32+
33+
error: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
34+
--> $DIR/feature-gate-custom_attribute.rs:21:1
35+
|
36+
21 | #[fake_attr(name = "hello")] //~ ERROR attribute `fake_attr` is currently unknown
37+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
38+
|
39+
= help: add #![feature(custom_attribute)] to the crate attributes to enable
40+
41+
error: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
42+
--> $DIR/feature-gate-custom_attribute.rs:22:1
43+
|
44+
22 | #[fake_attr(1, "hi", key = 12, true, false)] //~ ERROR attribute `fake_attr` is currently unknown
45+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
46+
|
47+
= help: add #![feature(custom_attribute)] to the crate attributes to enable
48+
49+
error: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
50+
--> $DIR/feature-gate-custom_attribute.rs:23:1
51+
|
52+
23 | #[fake_attr(key = "hello", val = 10)] //~ ERROR attribute `fake_attr` is currently unknown
53+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
54+
|
55+
= help: add #![feature(custom_attribute)] to the crate attributes to enable
56+
57+
error: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
58+
--> $DIR/feature-gate-custom_attribute.rs:24:1
59+
|
60+
24 | #[fake_attr(key("hello"), val(10))] //~ ERROR attribute `fake_attr` is currently unknown
61+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
62+
|
63+
= help: add #![feature(custom_attribute)] to the crate attributes to enable
64+
65+
error: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
66+
--> $DIR/feature-gate-custom_attribute.rs:25:1
67+
|
68+
25 | #[fake_attr(enabled = true, disabled = false)] //~ ERROR attribute `fake_attr` is currently unknown
69+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
70+
|
71+
= help: add #![feature(custom_attribute)] to the crate attributes to enable
72+
73+
error: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
74+
--> $DIR/feature-gate-custom_attribute.rs:26:1
75+
|
76+
26 | #[fake_attr(true)] //~ ERROR attribute `fake_attr` is currently unknown
77+
| ^^^^^^^^^^^^^^^^^^
78+
|
79+
= help: add #![feature(custom_attribute)] to the crate attributes to enable
80+
81+
error: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
82+
--> $DIR/feature-gate-custom_attribute.rs:27:1
83+
|
84+
27 | #[fake_attr(pi = 3.14159)] //~ ERROR attribute `fake_attr` is currently unknown
85+
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
86+
|
87+
= help: add #![feature(custom_attribute)] to the crate attributes to enable
88+
89+
error: The attribute `fake_attr` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
90+
--> $DIR/feature-gate-custom_attribute.rs:28:1
91+
|
92+
28 | #[fake_attr(b"hi")] //~ ERROR attribute `fake_attr` is currently unknown
93+
| ^^^^^^^^^^^^^^^^^^^
94+
|
95+
= help: add #![feature(custom_attribute)] to the crate attributes to enable
96+
97+
error: The attribute `fake_doc` is currently unknown to the compiler and may have meaning added to it in the future (see issue #29642)
98+
--> $DIR/feature-gate-custom_attribute.rs:29:1
99+
|
100+
29 | #[fake_doc(r"doc")] //~ ERROR attribute `fake_doc` is currently unknown
101+
| ^^^^^^^^^^^^^^^^^^^
102+
|
103+
= help: add #![feature(custom_attribute)] to the crate attributes to enable
104+
105+
error: aborting due to 13 previous errors
106+

0 commit comments

Comments
 (0)