rust/library/core/src
Yuki Okushi 9f2ad0a061
Rollup merge of #90009 - woppopo:const_from_more, r=dtolnay
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: #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>
2021-10-20 04:35:15 +09:00
..
alloc Add #[must_use] to non-mutating verb methods 2021-10-11 21:21:32 -04:00
array Make more From impls const 2021-10-18 19:19:28 +09:00
char Make more From impls const 2021-10-18 19:19:28 +09:00
convert Make more From impls const 2021-10-18 19:19:28 +09:00
fmt Rollup merge of #86479 - exphp-forks:float-debug-exponential, r=yaahc 2021-10-20 04:35:10 +09:00
future Fix may not to appropriate might not or must not 2021-07-29 01:15:20 -04:00
hash Rollup merge of #89729 - jkugelman:must-use-core-std-constructors, r=joshtriplett 2021-10-11 14:11:43 +02:00
iter Rollup merge of #88789 - the8472:rm-zip-bound, r=JohnTitor 2021-10-20 04:35:13 +09:00
macros Use correct edition for panic in [debug_]assert!() etc. 2021-10-07 14:27:08 +02:00
mem Auto merge of #89769 - jkugelman:must-use-maybe-uninit-new, r=joshtriplett 2021-10-12 07:02:53 +00:00
num Rollup merge of #90009 - woppopo:const_from_more, r=dtolnay 2021-10-20 04:35:15 +09:00
ops Const Deref 2021-09-15 03:06:53 +00:00
panic Deduplicate panic_fmt 2021-10-19 15:02:21 +01:00
prelude Move asm! and global_asm! to core::arch 2021-07-18 18:30:58 -04:00
ptr Make more From impls const 2021-10-18 19:19:28 +09:00
slice Remove a mention to copy_from_slice from clone_from_slice doc 2021-10-16 17:30:34 +09:00
str Add missing word to FromStr trait docs 2021-10-14 13:47:54 +11:00
stream Apply 16 commits (squashed) 2021-09-25 20:04:35 +02:00
sync Make more From impls const 2021-10-18 19:19:28 +09:00
task Make more From impls const 2021-10-18 19:19:28 +09:00
unicode Regenerate tables for Unicode 14.0.0 2021-10-06 17:49:33 -07:00
any.rs Added diagnostic items to structs and traits for Clippy 2021-07-15 23:57:02 +02:00
ascii.rs EscapeDefault: change range field to Range<u8>, reducing struct size 24 -> 6 bytes 2021-09-18 14:20:00 +03:00
bool.rs Add primitive documentation to libcore 2021-09-12 02:23:08 +00:00
borrow.rs Fix borrow and deref 2021-03-03 11:23:29 +01:00
cell.rs Make more From impls const 2021-10-18 19:19:28 +09:00
clone.rs Ignore automatically derived impls of Clone and Debug in dead code analysis 2021-09-09 19:49:07 +02:00
cmp.rs Add #[repr(i8)] to Ordering 2021-10-03 20:59:54 -07:00
default.rs Constified Default implementations 2021-08-17 07:15:54 +00:00
ffi.rs Replace all fmt.pad with debug_struct 2021-04-21 14:38:24 +02:00
hint.rs Stabilize unreachable_unchecked as const fn 2021-10-04 01:04:17 -04:00
internal_macros.rs Remove unnecessary #[unstable] from internal macro. 2021-08-05 12:55:35 +02:00
intrinsics.rs Rollup merge of #89509 - jhpratt:stabilize-const_unreachable_unchecked, r=oli-obk 2021-10-16 08:02:20 +02:00
lazy.rs Make more From impls const 2021-10-18 19:19:28 +09:00
lib.rs Rollup merge of #89509 - jhpratt:stabilize-const_unreachable_unchecked, r=oli-obk 2021-10-16 08:02:20 +02:00
marker.rs Fix ICE 89775 2021-10-11 20:52:36 +01:00
option.rs Make more From impls const 2021-10-18 19:19:28 +09:00
panic.rs Allow panic!("{}", computed_str) in const fn. 2021-09-15 21:56:43 +01:00
panicking.rs Deduplicate panic_fmt 2021-10-19 15:02:21 +01:00
pin.rs Add #[must_use] to conversions that move self 2021-10-10 19:50:52 -04:00
primitive.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
primitive_docs.rs Add primitive documentation to libcore 2021-09-12 02:23:08 +00:00
result.rs Make Result::as_mut const 2021-10-17 18:39:54 +09:00
time.rs Rollup merge of #89778 - jkugelman:must-use-as_type-conversions, r=joshtriplett 2021-10-12 14:53:08 +02:00
tuple.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
unit.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00