Skip to content

Commit 7caf672

Browse files
committed
Auto merge of rust-lang#127496 - tgross35:f16-f128-pattern-fixme, r=Nadrieril
Update `f16`/`f128` FIXMEs that needed `(NEG_)INFINITY` Just a small fix to the pattern matching tests now that we can. Also contains a small unrelated comment tweak.
2 parents 956deab + 96a7916 commit 7caf672

File tree

4 files changed

+53
-40
lines changed

4 files changed

+53
-40
lines changed

compiler/rustc_lint/src/types.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -563,7 +563,8 @@ fn lint_literal<'tcx>(
563563
ty::Float(t) => {
564564
let is_infinite = match lit.node {
565565
ast::LitKind::Float(v, _) => match t {
566-
// FIXME(f16_f128): add this check once we have library support
566+
// FIXME(f16_f128): add this check once `is_infinite` is reliable (ABI
567+
// issues resolved).
567568
ty::FloatTy::F16 => Ok(false),
568569
ty::FloatTy::F32 => v.as_str().parse().map(f32::is_infinite),
569570
ty::FloatTy::F64 => v.as_str().parse().map(f64::is_infinite),

tests/ui/half-open-range-patterns/half-open-range-pats-semantics.rs

+18-24
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,8 @@ fn range_to_inclusive() {
4545
// FIXME(f16_f128): remove gate when ABI issues are resolved
4646
#[cfg(all(target_arch = "aarch64", target_os = "linux"))]
4747
{
48-
// FIXME(f16_f128): enable infinity tests when constants are available
49-
// assert!(yes!(f16::NEG_INFINITY, ..=f16::NEG_INFINITY));
50-
// assert!(yes!(f16::NEG_INFINITY, ..=1.0f16));
48+
assert!(yes!(f16::NEG_INFINITY, ..=f16::NEG_INFINITY));
49+
assert!(yes!(f16::NEG_INFINITY, ..=1.0f16));
5150
assert!(yes!(1.5f16, ..=1.5f16));
5251
assert!(!yes!(1.6f16, ..=-1.5f16));
5352
}
@@ -68,9 +67,8 @@ fn range_to_inclusive() {
6867
// FIXME(f16_f128): remove gate when ABI issues are resolved
6968
#[cfg(all(target_arch = "aarch64", target_os = "linux"))]
7069
{
71-
// FIXME(f16_f128): enable infinity tests when constants are available
72-
// assert!(yes!(f128::NEG_INFINITY, ..=f128::NEG_INFINITY));
73-
// assert!(yes!(f128::NEG_INFINITY, ..=1.0f128));
70+
assert!(yes!(f128::NEG_INFINITY, ..=f128::NEG_INFINITY));
71+
assert!(yes!(f128::NEG_INFINITY, ..=1.0f128));
7472
assert!(yes!(1.5f128, ..=1.5f128));
7573
assert!(!yes!(1.6f128, ..=-1.5f128));
7674
}
@@ -111,8 +109,7 @@ fn range_to() {
111109
// FIXME(f16_f128): remove gate when ABI issues are resolved
112110
#[cfg(all(target_arch = "aarch64", target_os = "linux"))]
113111
{
114-
// FIXME(f16_f128): enable infinity tests when constants are available
115-
// assert!(yes!(f16::NEG_INFINITY, ..1.0f16));
112+
assert!(yes!(f16::NEG_INFINITY, ..1.0f16));
116113
assert!(!yes!(1.5f16, ..1.5f16));
117114
const E16: f16 = 1.5f16 + f16::EPSILON;
118115
assert!(yes!(1.5f16, ..E16));
@@ -137,8 +134,7 @@ fn range_to() {
137134
// FIXME(f16_f128): remove gate when ABI issues are resolved
138135
#[cfg(all(target_arch = "aarch64", target_os = "linux"))]
139136
{
140-
// FIXME(f16_f128): enable infinity tests when constants are available
141-
// assert!(yes!(f128::NEG_INFINITY, ..1.0f128));
137+
assert!(yes!(f128::NEG_INFINITY, ..1.0f128));
142138
assert!(!yes!(1.5f128, ..1.5f128));
143139
const E128: f128 = 1.5f128 + f128::EPSILON;
144140
assert!(yes!(1.5f128, ..E128));
@@ -181,15 +177,14 @@ fn range_from() {
181177
// FIXME(f16_f128): remove gate when ABI issues are resolved
182178
#[cfg(all(target_arch = "aarch64", target_os = "linux"))]
183179
{
184-
// FIXME(f16_f128): enable infinity tests when constants are available
185-
// assert!(yes!(f16::NEG_INFINITY, f16::NEG_INFINITY..));
186-
// assert!(yes!(f16::INFINITY, f16::NEG_INFINITY..));
187-
// assert!(!yes!(f16::NEG_INFINITY, 1.0f16..));
188-
// assert!(yes!(f16::INFINITY, 1.0f16..));
180+
assert!(yes!(f16::NEG_INFINITY, f16::NEG_INFINITY..));
181+
assert!(yes!(f16::INFINITY, f16::NEG_INFINITY..));
182+
assert!(!yes!(f16::NEG_INFINITY, 1.0f16..));
183+
assert!(yes!(f16::INFINITY, 1.0f16..));
189184
assert!(!yes!(1.0f16 - f16::EPSILON, 1.0f16..));
190185
assert!(yes!(1.0f16, 1.0f16..));
191-
// assert!(yes!(f16::INFINITY, 1.0f16..));
192-
// assert!(yes!(f16::INFINITY, f16::INFINITY..));
186+
assert!(yes!(f16::INFINITY, 1.0f16..));
187+
assert!(yes!(f16::INFINITY, f16::INFINITY..));
193188
}
194189

195190
// f32; `X..`
@@ -216,15 +211,14 @@ fn range_from() {
216211
// FIXME(f16_f128): remove gate when ABI issues are resolved
217212
#[cfg(all(target_arch = "aarch64", target_os = "linux"))]
218213
{
219-
// FIXME(f16_f128): enable infinity tests when constants are available
220-
// assert!(yes!(f128::NEG_INFINITY, f128::NEG_INFINITY..));
221-
// assert!(yes!(f128::INFINITY, f128::NEG_INFINITY..));
222-
// assert!(!yes!(f128::NEG_INFINITY, 1.0f128..));
223-
// assert!(yes!(f128::INFINITY, 1.0f128..));
214+
assert!(yes!(f128::NEG_INFINITY, f128::NEG_INFINITY..));
215+
assert!(yes!(f128::INFINITY, f128::NEG_INFINITY..));
216+
assert!(!yes!(f128::NEG_INFINITY, 1.0f128..));
217+
assert!(yes!(f128::INFINITY, 1.0f128..));
224218
assert!(!yes!(1.0f128 - f128::EPSILON, 1.0f128..));
225219
assert!(yes!(1.0f128, 1.0f128..));
226-
// assert!(yes!(f128::INFINITY, 1.0f128..));
227-
// assert!(yes!(f128::INFINITY, f128::INFINITY..));
220+
assert!(yes!(f128::INFINITY, 1.0f128..));
221+
assert!(yes!(f128::INFINITY, f128::INFINITY..));
228222
}
229223
}
230224

tests/ui/half-open-range-patterns/half-open-range-pats-thir-lower-empty.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
#![feature(f128)]
2+
#![feature(f16)]
3+
14
macro_rules! m {
25
($s:expr, $($t:tt)+) => {
36
match $s { $($t)+ => {} }
@@ -27,11 +30,14 @@ fn main() {
2730
m!(0, ..i128::MIN);
2831
//~^ ERROR lower range bound must be less than upper
2932

30-
// FIXME(f16_f128): add tests when NEG_INFINITY is available
33+
m!(0f16, ..f16::NEG_INFINITY);
34+
//~^ ERROR lower range bound must be less than upper
3135
m!(0f32, ..f32::NEG_INFINITY);
3236
//~^ ERROR lower range bound must be less than upper
3337
m!(0f64, ..f64::NEG_INFINITY);
3438
//~^ ERROR lower range bound must be less than upper
39+
m!(0f128, ..f128::NEG_INFINITY);
40+
//~^ ERROR lower range bound must be less than upper
3541

3642
m!('a', ..'\u{0}');
3743
//~^ ERROR lower range bound must be less than upper
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,93 @@
11
error[E0579]: lower range bound must be less than upper
2-
--> $DIR/half-open-range-pats-thir-lower-empty.rs:8:11
2+
--> $DIR/half-open-range-pats-thir-lower-empty.rs:11:11
33
|
44
LL | m!(0, ..u8::MIN);
55
| ^^^^^^^^^
66

77
error[E0579]: lower range bound must be less than upper
8-
--> $DIR/half-open-range-pats-thir-lower-empty.rs:10:11
8+
--> $DIR/half-open-range-pats-thir-lower-empty.rs:13:11
99
|
1010
LL | m!(0, ..u16::MIN);
1111
| ^^^^^^^^^^
1212

1313
error[E0579]: lower range bound must be less than upper
14-
--> $DIR/half-open-range-pats-thir-lower-empty.rs:12:11
14+
--> $DIR/half-open-range-pats-thir-lower-empty.rs:15:11
1515
|
1616
LL | m!(0, ..u32::MIN);
1717
| ^^^^^^^^^^
1818

1919
error[E0579]: lower range bound must be less than upper
20-
--> $DIR/half-open-range-pats-thir-lower-empty.rs:14:11
20+
--> $DIR/half-open-range-pats-thir-lower-empty.rs:17:11
2121
|
2222
LL | m!(0, ..u64::MIN);
2323
| ^^^^^^^^^^
2424

2525
error[E0579]: lower range bound must be less than upper
26-
--> $DIR/half-open-range-pats-thir-lower-empty.rs:16:11
26+
--> $DIR/half-open-range-pats-thir-lower-empty.rs:19:11
2727
|
2828
LL | m!(0, ..u128::MIN);
2929
| ^^^^^^^^^^^
3030

3131
error[E0579]: lower range bound must be less than upper
32-
--> $DIR/half-open-range-pats-thir-lower-empty.rs:19:11
32+
--> $DIR/half-open-range-pats-thir-lower-empty.rs:22:11
3333
|
3434
LL | m!(0, ..i8::MIN);
3535
| ^^^^^^^^^
3636

3737
error[E0579]: lower range bound must be less than upper
38-
--> $DIR/half-open-range-pats-thir-lower-empty.rs:21:11
38+
--> $DIR/half-open-range-pats-thir-lower-empty.rs:24:11
3939
|
4040
LL | m!(0, ..i16::MIN);
4141
| ^^^^^^^^^^
4242

4343
error[E0579]: lower range bound must be less than upper
44-
--> $DIR/half-open-range-pats-thir-lower-empty.rs:23:11
44+
--> $DIR/half-open-range-pats-thir-lower-empty.rs:26:11
4545
|
4646
LL | m!(0, ..i32::MIN);
4747
| ^^^^^^^^^^
4848

4949
error[E0579]: lower range bound must be less than upper
50-
--> $DIR/half-open-range-pats-thir-lower-empty.rs:25:11
50+
--> $DIR/half-open-range-pats-thir-lower-empty.rs:28:11
5151
|
5252
LL | m!(0, ..i64::MIN);
5353
| ^^^^^^^^^^
5454

5555
error[E0579]: lower range bound must be less than upper
56-
--> $DIR/half-open-range-pats-thir-lower-empty.rs:27:11
56+
--> $DIR/half-open-range-pats-thir-lower-empty.rs:30:11
5757
|
5858
LL | m!(0, ..i128::MIN);
5959
| ^^^^^^^^^^^
6060

6161
error[E0579]: lower range bound must be less than upper
62-
--> $DIR/half-open-range-pats-thir-lower-empty.rs:31:14
62+
--> $DIR/half-open-range-pats-thir-lower-empty.rs:33:14
63+
|
64+
LL | m!(0f16, ..f16::NEG_INFINITY);
65+
| ^^^^^^^^^^^^^^^^^^^
66+
67+
error[E0579]: lower range bound must be less than upper
68+
--> $DIR/half-open-range-pats-thir-lower-empty.rs:35:14
6369
|
6470
LL | m!(0f32, ..f32::NEG_INFINITY);
6571
| ^^^^^^^^^^^^^^^^^^^
6672

6773
error[E0579]: lower range bound must be less than upper
68-
--> $DIR/half-open-range-pats-thir-lower-empty.rs:33:14
74+
--> $DIR/half-open-range-pats-thir-lower-empty.rs:37:14
6975
|
7076
LL | m!(0f64, ..f64::NEG_INFINITY);
7177
| ^^^^^^^^^^^^^^^^^^^
7278

7379
error[E0579]: lower range bound must be less than upper
74-
--> $DIR/half-open-range-pats-thir-lower-empty.rs:36:13
80+
--> $DIR/half-open-range-pats-thir-lower-empty.rs:39:15
81+
|
82+
LL | m!(0f128, ..f128::NEG_INFINITY);
83+
| ^^^^^^^^^^^^^^^^^^^^
84+
85+
error[E0579]: lower range bound must be less than upper
86+
--> $DIR/half-open-range-pats-thir-lower-empty.rs:42:13
7587
|
7688
LL | m!('a', ..'\u{0}');
7789
| ^^^^^^^^^
7890

79-
error: aborting due to 13 previous errors
91+
error: aborting due to 15 previous errors
8092

8193
For more information about this error, try `rustc --explain E0579`.

0 commit comments

Comments
 (0)