about summary refs log tree commit diff
path: root/src/libcore/lib.rs
AgeCommit message (Collapse)AuthorLines
2020-04-25Bump bootstrap compilerMark Rousskov-1/+1
2020-04-16Dogfood or_patterns in the standard libraryJosh Stone-0/+1
2020-03-29Auto merge of #70370 - petrochenkov:nosmatch, r=Centrilbors-1/+0
Remove attribute `#[structural_match]` and any references to it A small remaining part of https://github.com/rust-lang/rust/issues/63438.
2020-03-26Rename asm! to llvm_asm!Amanieu d'Antras-0/+1
asm! is left as a wrapper around llvm_asm! to maintain compatibility.
2020-03-26introduce `negative_impls` feature gate and documentNiko Matsakis-0/+1
They used to be covered by `optin_builtin_traits` but negative impls are now applicable to all traits, not just auto traits. This also adds docs in the unstable book for the current state of auto traits.
2020-03-24Remove attribute `#[structural_match]` and any references to itVadim Petrochenkov-1/+0
2020-03-18add `Option::{zip,zip_with}` methods under "option_zip" gateWaffle-0/+1
This commit introduces 2 methods - `Option::zip` and `Option::zip_with` with respective signatures: - zip: `(Option<T>, Option<U>) -> Option<(T, U)>` - zip_with: `(Option<T>, Option<U>, (T, U) -> R) -> Option<R>` Both are under the feature gate "option_zip". I'm not sure about the name "zip", maybe we can find a better name for this. (I would prefer `union` for example, but this is a keyword :( ) -------------------------------------------------------------------------------- Recently in a russian rust begginers telegram chat a newbie asked (translated): > Are there any methods for these conversions: > > 1. `(Option<A>, Option<B>) -> Option<(A, B)>` > 2. `Vec<Option<T>> -> Option<Vec<T>>` > > ? While second (2.) is clearly `vec.into_iter().collect::<Option<Vec<_>>()`, the first one isn't that clear. I couldn't find anything similar in the `core` and I've come to this solution: ```rust let tuple: (Option<A>, Option<B>) = ...; let res: Option<(A, B)> = tuple.0.and_then(|a| tuple.1.map(|b| (a, b))); ``` However this solution isn't "nice" (same for just `match`/`if let`), so I thought that this functionality should be in `core`.
2020-03-15Bump the bootstrap compilerJonas Schievink-1/+1
2020-03-11Rollup merge of #69825 - lcnr:discriminant, r=oli-obkMazdak Farrokhzad-0/+1
make `mem::discriminant` const implements #69821, which could be used as a tracking issue for `const_discriminant`. Should this be added to the meta tracking issue #57563? @Lokathor
2020-03-11Rollup merge of #69373 - tspiteri:const_int_conversion, r=oli-obkMazdak Farrokhzad-1/+0
Stabilize const for integer {to,from}_{be,le,ne}_bytes methods All of these functions can be implemented simply and naturally as const functions, e.g. `u32::from_le_bytes` can be implemented as ```rust (bytes[0] as u32) | (bytes[1] as u32) << 8 | (bytes[2] as u32) << 16 | (bytes[3] as u32) << 24 ``` So stabilizing the constness will not expose that internally they are implemented using transmute which is not const in stable.
2020-03-10Rollup merge of #69514 - GuillaumeGomez:remove-spotlight, r=kinnisonMazdak Farrokhzad-1/+0
Remove spotlight I had a few comments saying that this feature was at best misunderstood or not even used so I decided to organize a poll about on [twitter](https://twitter.com/imperioworld_/status/1232769353503956994). After 87 votes, the result is very clear: it's not useful. Considering the amount of code we have just to run it, I think it's definitely worth it to remove it. r? @kinnison cc @ollie27
2020-03-08constify `mem::discriminant`Bastian Kauschke-0/+1
2020-03-04Auto merge of #68952 - faern:stabilize-assoc-int-consts, r=dtolnaybors-5/+0
Stabilize assoc_int_consts associated int/float constants The next step in RFC https://github.com/rust-lang/rfcs/pull/2700 (tracking issue #68490). Stabilizing the associated constants that were added in #68325. * Stabilize all constants under the `assoc_int_consts` feature flag. * Update documentation on old constants to say they are soft-deprecated and the new ones should be preferred. * Update documentation examples to use new constants. * Remove `uint_macro` and use `int_macro` for all integer types since the macros were identical anyway. r? @LukasKalbertodt
2020-02-27Remove spotlight usageGuillaume Gomez-1/+0
2020-02-26Rollup merge of #67637 - Mark-Simulacrum:primitive-mod, r=dtolnayDylan DPC-0/+3
Add primitive module to libcore This re-exports the primitive types from libcore at `core::primitive` to allow macro authors to have a reliable location to use them from. Fixes #44865
2020-02-23Bump core::primitive to 1.43David Tolnay-1/+1
2020-02-22Stabilize const for integer {to,from}_{be,le,ne}_bytes methodsTrevor Spiteri-1/+0
All of these functions can be implemented simply and naturally as const functions, e.g. u32::from_le_bytes can be implemented as (bytes[0] as u32) | (bytes[1] as u32) << 8 | (bytes[2] as u32) << 16 | (bytes[3] as u32) << 24 So stabilizing the constness will not expose that internally they are implemented using transmute which is not const in stable.
2020-02-20Rollup merge of #68978 - ecstatic-morse:const-int-pow, r=oli-obkDylan DPC-0/+3
Make integer exponentiation methods unstably const cc #53718 This makes the following inherent methods on integer primitives into unstable `const fn`: - `pow` - `checked_pow` - `wrapping_pow` - `overflowing_pow` - `saturating_pow` - `next_power_of_two` - `checked_next_power_of_two` - `wrapping_next_power_of_two` Only two changes were made to the implementation of these methods. First, I had to switch from the `?` operator, which is not yet implemented in a const context, to a `try_opt` macro. Second, `next_power_of_two` was using `ops::Add::add` (see the first commit) to "get overflow checks", so I switched to `#[rustc_inherit_overflow_checks]`. I'm not quite sure why the attribute wasn't used in the first place.
2020-02-12Remove uint_macros that was identical to int_macrosLinus Färnstrand-4/+0
2020-02-12Stabilize assoc_int_constsLinus Färnstrand-1/+0
2020-02-11Auto merge of #68491 - pnkfelix:hide-niches-under-unsafe-cell, r=olibors-0/+1
Hide niches under UnsafeCell Hide any niche of T from type-construction context of `UnsafeCell<T>`. Fix #68303 Fix #68206
2020-02-10Add `repr(no_niche)` to `UnsafeCell`. Fix #68303.Felix S. Klock II-0/+1
2020-02-08Make the ASCII ctype inherent methods constDylan MacKenzie-0/+1
2020-02-08Make integer power methods constDylan MacKenzie-0/+3
2020-02-06Add primitive module to libcore/stdMark Rousskov-0/+3
This re-exports the primitive types from libcore at `core::primitive` to allow macro authors to have a reliable location to use them from.
2020-02-04Use consistent feature namingDylan MacKenzie-4/+4
2020-02-04Const-stabilize some arithmetic intrinsicsDylan MacKenzie-0/+1
2020-02-04Make `saturating_mul` a `const fn`Dylan MacKenzie-0/+1
Co-Authored-By: 9999years <rbt@sent.as>
2020-02-04Make overflowing arithmetic `const`Dylan MacKenzie-0/+1
Co-Authored-By: 9999years <rbt@sent.as>
2020-02-04Make checked arithmetic besides division `const`Dylan MacKenzie-0/+1
Co-Authored-By: 9999years <rbt@sent.as>
2020-02-04Make euclidean division `const`Dylan MacKenzie-0/+1
Co-Authored-By: 9999years <rbt@sent.as>
2020-02-04Auto merge of #68708 - Mark-Simulacrum:stage0-step, r=pietroalbinibors-1/+0
Step stage0 to bootstrap from 1.42 This also includes a commit which fixes the rustfmt downloading logic to redownload when the rustfmt channel changes, and bumps rustfmt to a more recent version.
2020-02-04Stabilize `core::iter::once_with()`Yuki Okushi-1/+0
2020-01-31Drop cfg(bootstrap) codeMark Rousskov-1/+0
2020-01-23Unlock assoc_int_consts in core+stdLinus Färnstrand-0/+1
2020-01-18slice_patterns: remove internal uses of gateMazdak Farrokhzad-1/+1
2020-01-12Diagnostics should not end with a full stopvarkor-1/+1
2020-01-11Constify alloc::LayoutLukas Lueg-0/+1
Tracking issue #67521, Layout::new in #66254
2020-01-10Remove unnecessary `const_fn` feature gatesDylan MacKenzie-1/+0
This flag opts out of the min-const-fn checks entirely, which is usually not what we want. The few cases where the flag is still necessary have been annotated.
2020-01-02Add Iterator::try_findMOZGIII-0/+1
2019-12-31Constify ResultLukas Lueg-0/+1
2019-12-27Clean up const-hack from #63810jumbatm-0/+2
2019-12-23Minimize unsafety in encode_utf8Mark Rousskov-0/+1
Use slice patterns to avoid having to skip bounds checking
2019-12-23Rollup merge of #67466 - oli-obk:const_intrinsic, r=CentrilMazdak Farrokhzad-0/+2
Require const stability attributes on intrinsics to be able to use them in constant contexts r? @Centril finally fixes #61495 cc @RalfJung
2019-12-22Format the worldMark Rousskov-37/+50
2019-12-20Require const stability attributes on intrinsics to be able to use them in ↵Oliver Scherer-0/+2
constant contexts
2019-12-18Propagate cfg bootstrapMark Rousskov-5/+3
2019-12-14Auto merge of #67224 - nikomatsakis:revert-stabilization-of-never-type, ↵bors-1/+1
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 "Stabilize the `never_type`, written `!`."Niko Matsakis-1/+1
This reverts commit 15c30ddd69d6cc3fffe6d304c6dc968a5ed046f1.
2019-12-13Reuse the `staged_api` feature for `rustc_const_unstable`Oliver Scherer-1/+1