-
Notifications
You must be signed in to change notification settings - Fork 13.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add From<{integer}>
for f16
/f128
impls
#138363
Conversation
This comment has been minimized.
This comment has been minimized.
8767c41
to
7c07265
Compare
Obligatory crater run since we've had trouble with f16/f128 stdlib impls in the past :) edit: oh i just read that you also asked for a crater run; yep, agreed lol @bors try |
…=<try> Add `From<{integer}>` for `f16`/`f128` impls This PR adds `impl From<{bool,i8,u8}> for f16` and `impl From<{bool,i8,u8,i16,u16,i32,u32}> for f128`. The `From<{i64,u64}> for f128` impls are left commented out as adding them would allow using `f128` on stable before it is stabilised like in the following example: ```rust fn f<T: From<u64>>(x: T) -> T { x } fn main() { let x = f(1.0); // the type of the literal is inferred to be `f128` } ``` None of the impls added in this PR have this issue as they are all, at minimum, also implemented by `f64`. This PR will need a crater run for the `From<{i32,u32}>` impls, as `f64` is no longer the only float type to implement them (similar to the cause of rust-lang#125198). cc `@bjoernager` r? `@tgross35` Tracking issue: rust-lang#116909
☀️ Try build successful - checks-actions |
@craterbot check |
👌 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
This LGTM assuming crater is okay, but somebody from libs-api will need to approve r? @Amanieu |
🚧 Experiment ℹ️ Crater is a tool to run experiments across parts of the Rust ecosystem. Learn more |
🎉 Experiment
|
All regressions are spurious. |
@bors r+ |
This is adding a bunch of new impls as if they were introduced in Rust 1.6.0. Shouldn't they be something like |
|
||
// signed integer -> float | ||
impl_from!(i8 => f16, #[stable(feature = "lossless_float_conv", since = "1.6.0")]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
impl_from!(i8 => f16, #[stable(feature = "lossless_float_conv", since = "1.6.0")]); | |
impl_from!(i8 => f16, #[stable(feature = "lossless_float_conv", since = "CURRENT_RUSTC_VERSION")]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
though in practice these impls aren't actually useful yet, they should probably be updated once f16 is stable
The impls aren't actually being stabilised now, as |
… r=Amanieu Add `From<{integer}>` for `f16`/`f128` impls This PR adds `impl From<{bool,i8,u8}> for f16` and `impl From<{bool,i8,u8,i16,u16,i32,u32}> for f128`. The `From<{i64,u64}> for f128` impls are left commented out as adding them would allow using `f128` on stable before it is stabilised like in the following example: ```rust fn f<T: From<u64>>(x: T) -> T { x } fn main() { let x = f(1.0); // the type of the literal is inferred to be `f128` } ``` None of the impls added in this PR have this issue as they are all, at minimum, also implemented by `f64`. This PR will need a crater run for the `From<{i32,u32}>` impls, as `f64` is no longer the only float type to implement them (similar to the cause of rust-lang#125198). cc `@bjoernager` r? `@tgross35` Tracking issue: rust-lang#116909
Rollup of 7 pull requests Successful merges: - rust-lang#136293 (document capacity for ZST as example) - rust-lang#136355 (Add `*_value` methods to proc_macro lib) - rust-lang#136359 (doc all differences of ptr:copy(_nonoverlapping) with memcpy and memmove) - rust-lang#136816 (refactor `notable_traits_button` to use iterator combinators instead of for loop) - rust-lang#138363 (Add `From<{integer}>` for `f16`/`f128` impls) - rust-lang#138552 (Misc print request handling cleanups + a centralized test for print request stability gating) - rust-lang#138573 (Make `_Unwind_Action` a type alias, not enum) r? `@ghost` `@rustbot` modify labels: rollup
☀️ Test successful - checks-actions |
This is an experimental post-merge analysis report. You can ignore it. Post-merge reportComparing 227690a (base) -> c3dd4ee (this PR) Test differences
Additionally, 6 doctest diffs were found. These are ignored, as they are noisy. Job group index
|
This PR adds
impl From<{bool,i8,u8}> for f16
andimpl From<{bool,i8,u8,i16,u16,i32,u32}> for f128
.The
From<{i64,u64}> for f128
impls are left commented out as adding them would allow usingf128
on stable before it is stabilised like in the following example:None of the impls added in this PR have this issue as they are all, at minimum, also implemented by
f64
.This PR will need a crater run for the
From<{i32,u32}>
impls, asf64
is no longer the only float type to implement them (similar to the cause of #125198).cc @bjoernager
r? @tgross35
Tracking issue: #116909