Auto merge of #123085 - tgross35:f16-f128-step4.0-libs-basic-impls, r… · rust-lang/rust@5da1a1b (original) (raw)

Skip to content

Provide feedback

Saved searches

Use saved searches to filter your results more quickly

Sign up

Commit 5da1a1b

Auto merge of #123085 - tgross35:f16-f128-step4.0-libs-basic-impls, r=Amanieu

Add basic trait impls for `f16` and `f128` Split off part of <#122470> so the compiler doesn't ICE because it expects primitives to have some minimal traits. Fixes <#123074>

File tree

7 files changed

lines changed

7 files changed

lines changed

Original file line number Diff line number Diff line change
@@ -227,7 +227,7 @@ mod impls {
227 227 impl_clone! {
228 228 usize u8 u16 u32 u64 u128
229 229 isize i8 i16 i32 i64 i128
230 -f32 f64
230 +f16 f32 f64 f128
231 231 bool char
232 232 }
233 233
Original file line number Diff line number Diff line change
@@ -1493,7 +1493,7 @@ mod impls {
1493 1493 }
1494 1494
1495 1495 partial_eq_impl! {
1496 -bool char usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f32 f64
1496 +bool char usize u8 u16 u32 u64 u128 isize i8 i16 i32 i64 i128 f16 f32 f64 f128
1497 1497 }
1498 1498
1499 1499 macro_rules! eq_impl {
@@ -1546,7 +1546,7 @@ mod impls {
1546 1546 }
1547 1547 }
1548 1548
1549 -partial_ord_impl! { f32 f64 }
1549 +partial_ord_impl! { f16 f32 f64 f128 }
1550 1550
1551 1551 macro_rules! ord_impl {
1552 1552 ($($t:ty)*) => ($(
Original file line number Diff line number Diff line change
@@ -178,5 +178,9 @@ default_impl! { i32, 0, "Returns the default value of `0`" }
178 178 default_impl! { i64, 0, "Returns the default value of `0`" }
179 179 default_impl! { i128, 0, "Returns the default value of `0`" }
180 180
181 +#[cfg(not(bootstrap))]
182 +default_impl! { f16, 0.0f16, "Returns the default value of `0.0`" }
181 183 default_impl! { f32, 0.0f32, "Returns the default value of `0.0`" }
182 184 default_impl! { f64, 0.0f64, "Returns the default value of `0.0`" }
185 +#[cfg(not(bootstrap))]
186 +default_impl! { f128, 0.0f128, "Returns the default value of `0.0`" }
Original file line number Diff line number Diff line change
@@ -229,6 +229,8 @@
229 229 #![feature(doc_notable_trait)]
230 230 #![feature(effects)]
231 231 #![feature(extern_types)]
232 +#![feature(f128)]
233 +#![feature(f16)]
232 234 #![feature(freeze_impls)]
233 235 #![feature(fundamental)]
234 236 #![feature(generic_arg_infer)]
Original file line number Diff line number Diff line change
@@ -422,7 +422,7 @@ marker_impls! {
422 422 Copy for
423 423 usize, u8, u16, u32, u64, u128,
424 424 isize, i8, i16, i32, i64, i128,
425 -f32, f64,
425 +f16, f32, f64, f128,
426 426 bool, char,
427 427 {T: ?Sized} *const T,
428 428 {T: ?Sized} *mut T,
Original file line number Diff line number Diff line change
@@ -247,15 +247,15 @@ LL | _ = &&0 == Foo;
247 247 |
248 248 = help: the trait `PartialEq` is not implemented for `&&{integer}`
249 249 = help: the following other types implement trait `PartialEq`:
250 + f128
251 + f16
250 252 f32
251 253 f64
252 254 i128
253 255 i16
254 256 i32
255 257 i64
256 - i8
257 - isize
258 - and 6 others
258 + and 8 others
259 259
260 260 error[E0369]: binary operation `==` cannot be applied to type `Foo`
261 261 --> $DIR/binary-op-suggest-deref.rs:60:13
Original file line number Diff line number Diff line change
@@ -73,15 +73,15 @@ LL | 5 < String::new();
73 73 |
74 74 = help: the trait `PartialOrd` is not implemented for `{integer}`
75 75 = help: the following other types implement trait `PartialOrd`:
76 + f128
77 + f16
76 78 f32
77 79 f64
78 80 i128
79 81 i16
80 82 i32
81 83 i64
82 - i8
83 - isize
84 - and 6 others
84 + and 8 others
85 85
86 86 error[E0277]: can't compare `{integer}` with `Result<{integer}, _>`
87 87 --> $DIR/binops.rs:7:7
@@ -91,15 +91,15 @@ LL | 6 == Ok(1);
91 91 |
92 92 = help: the trait `PartialEq<Result<{integer}, _>>` is not implemented for `{integer}`
93 93 = help: the following other types implement trait `PartialEq`:
94 + f128
95 + f16
94 96 f32
95 97 f64
96 98 i128
97 99 i16
98 100 i32
99 101 i64
100 - i8
101 - isize
102 - and 6 others
102 + and 8 others
103 103
104 104 error: aborting due to 6 previous errors
105 105