Skip to content

Commit 9a7b176

Browse files
committed
Update f16 and f128 tests to run on both 2015 and 2018 editions
Reproduce the bug from <#123282> that indicates this feature gate hits edition-dependent resolution paths. Resolution changed in edition 2018, so test that as well.
1 parent 029cb1b commit 9a7b176

8 files changed

+146
-10
lines changed

tests/ui/feature-gates/feature-gate-f128.stderr renamed to tests/ui/feature-gates/feature-gate-f128.e2015.stderr

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0658]: the type `f128` is unstable
2-
--> $DIR/feature-gate-f128.rs:3:10
2+
--> $DIR/feature-gate-f128.rs:11:10
33
|
44
LL | const A: f128 = 10.0;
55
| ^^^^
@@ -9,7 +9,7 @@ LL | const A: f128 = 10.0;
99
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
1010

1111
error[E0658]: the type `f128` is unstable
12-
--> $DIR/feature-gate-f128.rs:6:12
12+
--> $DIR/feature-gate-f128.rs:14:12
1313
|
1414
LL | let a: f128 = 100.0;
1515
| ^^^^
@@ -19,7 +19,7 @@ LL | let a: f128 = 100.0;
1919
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
2020

2121
error[E0658]: the type `f128` is unstable
22-
--> $DIR/feature-gate-f128.rs:11:11
22+
--> $DIR/feature-gate-f128.rs:19:11
2323
|
2424
LL | fn foo(a: f128) {}
2525
| ^^^^
@@ -29,7 +29,7 @@ LL | fn foo(a: f128) {}
2929
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
3030

3131
error[E0658]: the type `f128` is unstable
32-
--> $DIR/feature-gate-f128.rs:14:8
32+
--> $DIR/feature-gate-f128.rs:22:8
3333
|
3434
LL | a: f128,
3535
| ^^^^
@@ -39,7 +39,7 @@ LL | a: f128,
3939
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
4040

4141
error[E0658]: the type `f128` is unstable
42-
--> $DIR/feature-gate-f128.rs:7:13
42+
--> $DIR/feature-gate-f128.rs:15:13
4343
|
4444
LL | let b = 0.0f128;
4545
| ^^^^^^^
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
error[E0658]: the type `f128` is unstable
2+
--> $DIR/feature-gate-f128.rs:11:10
3+
|
4+
LL | const A: f128 = 10.0;
5+
| ^^^^
6+
|
7+
= note: see issue #116909 <https://github.com/rust-lang/rust/issues/116909> for more information
8+
= help: add `#![feature(f128)]` to the crate attributes to enable
9+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
10+
11+
error[E0658]: the type `f128` is unstable
12+
--> $DIR/feature-gate-f128.rs:14:12
13+
|
14+
LL | let a: f128 = 100.0;
15+
| ^^^^
16+
|
17+
= note: see issue #116909 <https://github.com/rust-lang/rust/issues/116909> for more information
18+
= help: add `#![feature(f128)]` to the crate attributes to enable
19+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
20+
21+
error[E0658]: the type `f128` is unstable
22+
--> $DIR/feature-gate-f128.rs:19:11
23+
|
24+
LL | fn foo(a: f128) {}
25+
| ^^^^
26+
|
27+
= note: see issue #116909 <https://github.com/rust-lang/rust/issues/116909> for more information
28+
= help: add `#![feature(f128)]` to the crate attributes to enable
29+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
30+
31+
error[E0658]: the type `f128` is unstable
32+
--> $DIR/feature-gate-f128.rs:22:8
33+
|
34+
LL | a: f128,
35+
| ^^^^
36+
|
37+
= note: see issue #116909 <https://github.com/rust-lang/rust/issues/116909> for more information
38+
= help: add `#![feature(f128)]` to the crate attributes to enable
39+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
40+
41+
error[E0658]: the type `f128` is unstable
42+
--> $DIR/feature-gate-f128.rs:15:13
43+
|
44+
LL | let b = 0.0f128;
45+
| ^^^^^^^
46+
|
47+
= note: see issue #116909 <https://github.com/rust-lang/rust/issues/116909> for more information
48+
= help: add `#![feature(f128)]` to the crate attributes to enable
49+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
50+
51+
error: aborting due to 5 previous errors
52+
53+
For more information about this error, try `rustc --explain E0658`.

tests/ui/feature-gates/feature-gate-f128.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
//@ revisions: e2015 e2018
2+
//
3+
//@[e2018] edition:2018
4+
15
#![allow(unused)]
26

37
const A: f128 = 10.0; //~ ERROR the type `f128` is unstable

tests/ui/feature-gates/feature-gate-f16.stderr renamed to tests/ui/feature-gates/feature-gate-f16.e2015.stderr

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error[E0658]: the type `f16` is unstable
2-
--> $DIR/feature-gate-f16.rs:3:10
2+
--> $DIR/feature-gate-f16.rs:11:10
33
|
44
LL | const A: f16 = 10.0;
55
| ^^^
@@ -9,7 +9,7 @@ LL | const A: f16 = 10.0;
99
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
1010

1111
error[E0658]: the type `f16` is unstable
12-
--> $DIR/feature-gate-f16.rs:6:12
12+
--> $DIR/feature-gate-f16.rs:14:12
1313
|
1414
LL | let a: f16 = 100.0;
1515
| ^^^
@@ -19,7 +19,7 @@ LL | let a: f16 = 100.0;
1919
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
2020

2121
error[E0658]: the type `f16` is unstable
22-
--> $DIR/feature-gate-f16.rs:11:11
22+
--> $DIR/feature-gate-f16.rs:19:11
2323
|
2424
LL | fn foo(a: f16) {}
2525
| ^^^
@@ -29,7 +29,7 @@ LL | fn foo(a: f16) {}
2929
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
3030

3131
error[E0658]: the type `f16` is unstable
32-
--> $DIR/feature-gate-f16.rs:14:8
32+
--> $DIR/feature-gate-f16.rs:22:8
3333
|
3434
LL | a: f16,
3535
| ^^^
@@ -39,7 +39,7 @@ LL | a: f16,
3939
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
4040

4141
error[E0658]: the type `f16` is unstable
42-
--> $DIR/feature-gate-f16.rs:7:13
42+
--> $DIR/feature-gate-f16.rs:15:13
4343
|
4444
LL | let b = 0.0f16;
4545
| ^^^^^^
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
error[E0658]: the type `f16` is unstable
2+
--> $DIR/feature-gate-f16.rs:11:10
3+
|
4+
LL | const A: f16 = 10.0;
5+
| ^^^
6+
|
7+
= note: see issue #116909 <https://github.com/rust-lang/rust/issues/116909> for more information
8+
= help: add `#![feature(f16)]` to the crate attributes to enable
9+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
10+
11+
error[E0658]: the type `f16` is unstable
12+
--> $DIR/feature-gate-f16.rs:14:12
13+
|
14+
LL | let a: f16 = 100.0;
15+
| ^^^
16+
|
17+
= note: see issue #116909 <https://github.com/rust-lang/rust/issues/116909> for more information
18+
= help: add `#![feature(f16)]` to the crate attributes to enable
19+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
20+
21+
error[E0658]: the type `f16` is unstable
22+
--> $DIR/feature-gate-f16.rs:19:11
23+
|
24+
LL | fn foo(a: f16) {}
25+
| ^^^
26+
|
27+
= note: see issue #116909 <https://github.com/rust-lang/rust/issues/116909> for more information
28+
= help: add `#![feature(f16)]` to the crate attributes to enable
29+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
30+
31+
error[E0658]: the type `f16` is unstable
32+
--> $DIR/feature-gate-f16.rs:22:8
33+
|
34+
LL | a: f16,
35+
| ^^^
36+
|
37+
= note: see issue #116909 <https://github.com/rust-lang/rust/issues/116909> for more information
38+
= help: add `#![feature(f16)]` to the crate attributes to enable
39+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
40+
41+
error[E0658]: the type `f16` is unstable
42+
--> $DIR/feature-gate-f16.rs:15:13
43+
|
44+
LL | let b = 0.0f16;
45+
| ^^^^^^
46+
|
47+
= note: see issue #116909 <https://github.com/rust-lang/rust/issues/116909> for more information
48+
= help: add `#![feature(f16)]` to the crate attributes to enable
49+
= note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
50+
51+
error: aborting due to 5 previous errors
52+
53+
For more information about this error, try `rustc --explain E0658`.

tests/ui/feature-gates/feature-gate-f16.rs

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
//@ revisions: e2015 e2018
2+
//
3+
//@[e2018] edition:2018
4+
15
#![allow(unused)]
26

37
const A: f16 = 10.0; //~ ERROR the type `f16` is unstable
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//@ compile-flags: --crate-type=lib
2+
//@ check-pass
3+
//@ revisions: e2015 e2018
4+
//
5+
//@[e2018] edition:2018
6+
7+
// Verify that gates for the `f16` and `f128` features do not apply to user modules
8+
// See <https://github.com/rust-lang/rust/issues/123282>
9+
10+
mod f16 {
11+
pub fn a16() {}
12+
}
13+
14+
mod f128 {
15+
pub fn a128() {}
16+
}
17+
18+
pub use f128::a128;
19+
pub use f16::a16;

tests/ui/resolve/primitive-f16-f128-shadowed.rs

+3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
//@ compile-flags: --crate-type=lib
22
//@ check-pass
3+
//@ revisions: e2015 e2018
4+
//
5+
//@[e2018] edition:2018
36

47
// Verify that gates for the `f16` and `f128` features do not apply to user types
58

0 commit comments

Comments
 (0)