about summary refs log tree commit diff
path: root/src/libcore/convert
AgeCommit message (Collapse)AuthorLines
2020-04-25Bump bootstrap compilerMark Rousskov-8/+1
2020-04-03Rollup merge of #70487 - Mark-Simulacrum:float-unchecked-casts, r=SimonSapinMazdak Farrokhzad-4/+11
Stabilize float::to_int_unchecked This renames and stabilizes unsafe floating point to integer casts, which are intended to be the substitute for the currently unsound `as` behavior, once that changes to safe-but-slower saturating casts. As such, I believe this also likely unblocks #10184 (our oldest I-unsound issue!), as once this rolls out to stable it would be far easier IMO to change the behavior of `as` to be safe by default. This does not stabilize the trait or the associated method, as they are deemed internal implementation details (and consumers should not, generally, want to expose them, as in practice all callers likely know statically/without generics what the return type is). Closes #67058
2020-03-29Stabilize float::to_int_uncheckedMark Rousskov-4/+11
This renames and stabilizes unsafe floating point to integer casts, which are intended to be the substitute for the currently unsound `as` behavior, once that changes to safe-but-slower saturating casts.
2020-03-22Implement Hash for InfallibleKonrad Borowski-0/+8
2020-03-07Correct version that relaxed orphan rulesJonathan Giddy-1/+1
2020-01-06Use Self instead of $typeLzu Tao-14/+14
2019-12-18Propagate cfg bootstrapMark Rousskov-3/+1
2019-12-14Auto merge of #67224 - nikomatsakis:revert-stabilization-of-never-type, ↵bors-7/+88
r=centril Revert stabilization of never type Fixes https://github.com/rust-lang/rust/issues/66757 I decided to keep the separate `never-type-fallback` feature gate, but tried to otherwise revert https://github.com/rust-lang/rust/pull/65355. Seemed pretty clean. ( cc @Centril, author of #65355, you may want to check this over briefly )
2019-12-14Revert "Redefine `core::convert::Infallible` as `!`."Niko Matsakis-7/+88
This reverts commit 089229a1935fa9795cfdefa518c8f8c3beb66db8.
2019-12-14Auto merge of #67136 - oli-obk:const_stability, r=Centrilbors-0/+1
Require stable/unstable annotations for the constness of all stable fns with a const modifier r? @RalfJung @Centril Every `#[stable]` const fn now needs either a `#[rustc_const_unstable]` attribute or a `#[rustc_const_stable]` attribute. You can't silently stabilize the constness of a function anymore.
2019-12-13docs: std::convert::From: Fix typoShaleen Jain-1/+1
Fix a minor typo
2019-12-13Require stable/unstable annotations for the constness of all stable ↵Oliver Scherer-0/+1
functions with a `const` modifier
2019-12-08move from non zero impls to `libcore/convert/num.rs`Peter-0/+1115
2019-12-08leave a FIXMEMazdak Farrokhzad-1/+1
2019-12-08use `#[allow(unused_attributes)]` to paper over incr.comp problemMazdak Farrokhzad-0/+1
2019-12-06Move numeric `From` and `TryFrom` impls to `libcore/convert/num.rs`Simon Sapin-0/+331
This makes `libcore/num/mod.rs` slightly smaller. It’s still 4911 lines and not easy to navigate. This doesn’t change any public API.
2019-12-06Add `{f32,f64}::approx_unchecked_to<Int>` unsafe methodsSimon Sapin-0/+43
As discussed in https://github.com/rust-lang/rust/issues/10184 Currently, casting a floating point number to an integer with `as` is Undefined Behavior if the value is out of range. `-Z saturating-float-casts` fixes this soundness hole by making `as` “saturate” to the maximum or minimum value of the integer type (or zero for `NaN`), but has measurable negative performance impact in some benchmarks. There is some consensus in that thread for enabling saturation by default anyway, but provide an `unsafe fn` alternative for users who know through some other mean that their values are in range.
2019-12-06Make `core::convert` a directory-module with `mod.rs`Simon Sapin-0/+660