Make more From impls const (libcore)#90009
Merged
bors merged 1 commit intorust-lang:masterfrom Oct 20, 2021
lilasta:const_from_more
Merged
Make more From impls const (libcore)#90009bors merged 1 commit intorust-lang:masterfrom lilasta:const_from_more
From impls const (libcore)#90009bors merged 1 commit intorust-lang:masterfrom
lilasta:const_from_more
Conversation
Contributor
|
r? @dtolnay (rust-highfive has picked a reviewer for you, use r? to override) |
Member
|
@bors r+ |
Collaborator
|
📌 Commit 7936ecf has been approved by |
GuillaumeGomez
added a commit
to GuillaumeGomez/rust
that referenced
this pull request
Oct 19, 2021
Make more `From` impls `const` (libcore) Adding `const` to `From` implementations in the core. `rustc_const_unstable` attribute is not added to unstable implementations. Tracking issue: rust-lang#88674 <details> <summary>Done</summary><div> - `T` from `T` - `T` from `!` - `Option<T>` from `T` - `Option<&T>` from `&Option<T>` - `Option<&mut T>` from `&mut Option<T>` - `Cell<T>` from `T` - `RefCell<T>` from `T` - `UnsafeCell<T>` from `T` - `OnceCell<T>` from `T` - `Poll<T>` from `T` - `u32` from `char` - `u64` from `char` - `u128` from `char` - `char` from `u8` - `AtomicBool` from `bool` - `AtomicPtr<T>` from `*mut T` - `AtomicI(bits)` from `i(bits)` - `AtomicU(bits)` from `u(bits)` - `i(bits)` from `NonZeroI(bits)` - `u(bits)` from `NonZeroU(bits)` - `NonNull<T>` from `Unique<T>` - `NonNull<T>` from `&T` - `NonNull<T>` from `&mut T` - `Unique<T>` from `&mut T` - `Infallible` from `!` - `TryIntError` from `!` - `TryIntError` from `Infallible` - `TryFromSliceError` from `Infallible` - `FromResidual for Option<T>` </div></details> <details> <summary>Remaining</summary><dev> - `NonZero` from `NonZero` These can't be made const at this time because these use Into::into. https://github.com/rust-lang/rust/blob/master/library/core/src/convert/num.rs#L393 - `std`, `alloc` There may still be many implementations that can be made `const`. </div></details>
bors
added a commit
to rust-lang-ci/rust
that referenced
this pull request
Oct 19, 2021
Rollup of 10 pull requests Successful merges: - rust-lang#86479 (Automatic exponential formatting in Debug) - rust-lang#87404 (Add support for artifact size profiling) - rust-lang#87769 (Alloc features cleanup) - rust-lang#88789 (remove unnecessary bound on Zip specialization impl) - rust-lang#88860 (Deduplicate panic_fmt) - rust-lang#90009 (Make more `From` impls `const` (libcore)) - rust-lang#90018 (Fix rustdoc UI for very long type names) - rust-lang#90025 (Revert rust-lang#86011 to fix an incorrect bound check) - rust-lang#90036 (Remove border-bottom from most docblocks.) - rust-lang#90060 (Update RELEASES.md) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adding
consttoFromimplementations in the core.rustc_const_unstableattribute is not added to unstable implementations.Tracking issue: #88674
Done
TfromTTfrom!Option<T>fromTOption<&T>from&Option<T>Option<&mut T>from&mut Option<T>Cell<T>fromTRefCell<T>fromTUnsafeCell<T>fromTOnceCell<T>fromTPoll<T>fromTu32fromcharu64fromcharu128fromcharcharfromu8AtomicBoolfromboolAtomicPtr<T>from*mut TAtomicI(bits)fromi(bits)AtomicU(bits)fromu(bits)i(bits)fromNonZeroI(bits)u(bits)fromNonZeroU(bits)NonNull<T>fromUnique<T>NonNull<T>from&TNonNull<T>from&mut TUnique<T>from&mut TInfalliblefrom!TryIntErrorfrom!TryIntErrorfromInfallibleTryFromSliceErrorfromInfallibleFromResidual for Option<T>Remaining
NonZerofromNonZeroThese can't be made const at this time because these use Into::into.
https://github.com/rust-lang/rust/blob/master/library/core/src/convert/num.rs#L393
std,allocThere may still be many implementations that can be made
const.