Skip to content

Commit 5afe072

Browse files
Fix f16 and f128 feature gates in editions other than 2015
Fixes #123282 Co-authored-by: Vadim Petrochenkov <vadim.petrochenkov@gmail.com>
1 parent 9a7b176 commit 5afe072

File tree

5 files changed

+22
-20
lines changed

5 files changed

+22
-20
lines changed

compiler/rustc_resolve/src/ident.rs

+2
Original file line numberDiff line numberDiff line change
@@ -605,6 +605,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
605605
&& !this.tcx.features().f16
606606
&& !ident.span.allows_unstable(sym::f16)
607607
&& finalize.is_some()
608+
&& innermost_result.is_none()
608609
{
609610
feature_err(
610611
this.tcx.sess,
@@ -618,6 +619,7 @@ impl<'a, 'tcx> Resolver<'a, 'tcx> {
618619
&& !this.tcx.features().f128
619620
&& !ident.span.allows_unstable(sym::f128)
620621
&& finalize.is_some()
622+
&& innermost_result.is_none()
621623
{
622624
feature_err(
623625
this.tcx.sess,

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:11:10
2+
--> $DIR/feature-gate-f128.rs:7: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:14:12
12+
--> $DIR/feature-gate-f128.rs:10: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:19:11
22+
--> $DIR/feature-gate-f128.rs:15: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:22:8
32+
--> $DIR/feature-gate-f128.rs:18: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:15:13
42+
--> $DIR/feature-gate-f128.rs:11:13
4343
|
4444
LL | let b = 0.0f128;
4545
| ^^^^^^^

tests/ui/feature-gates/feature-gate-f128.e2018.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:11:10
2+
--> $DIR/feature-gate-f128.rs:7: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:14:12
12+
--> $DIR/feature-gate-f128.rs:10: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:19:11
22+
--> $DIR/feature-gate-f128.rs:15: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:22:8
32+
--> $DIR/feature-gate-f128.rs:18: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:15:13
42+
--> $DIR/feature-gate-f128.rs:11:13
4343
|
4444
LL | let b = 0.0f128;
4545
| ^^^^^^^

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:11:10
2+
--> $DIR/feature-gate-f16.rs:7: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:14:12
12+
--> $DIR/feature-gate-f16.rs:10: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:19:11
22+
--> $DIR/feature-gate-f16.rs:15: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:22:8
32+
--> $DIR/feature-gate-f16.rs:18: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:15:13
42+
--> $DIR/feature-gate-f16.rs:11:13
4343
|
4444
LL | let b = 0.0f16;
4545
| ^^^^^^

tests/ui/feature-gates/feature-gate-f16.e2018.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:11:10
2+
--> $DIR/feature-gate-f16.rs:7: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:14:12
12+
--> $DIR/feature-gate-f16.rs:10: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:19:11
22+
--> $DIR/feature-gate-f16.rs:15: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:22:8
32+
--> $DIR/feature-gate-f16.rs:18: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:15:13
42+
--> $DIR/feature-gate-f16.rs:11:13
4343
|
4444
LL | let b = 0.0f16;
4545
| ^^^^^^

0 commit comments

Comments
 (0)