about summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2019-02-03Apply review suggestions and fix testsMatthias Einwag-34/+31
2019-02-03Apply suggestions from code reviewMazdak Farrokhzad-4/+6
Co-Authored-By: Matthias247 <matthias.einwag@live.com>
2019-02-03Update the future/task APIMatthias Einwag-259/+95
This change updates the future and task API as discussed in the stabilization RFC at https://github.com/rust-lang/rfcs/pull/2592. Changes: - Replacing UnsafeWake with RawWaker and RawWakerVtable - Removal of LocalWaker - Removal of Arc-based Wake trait
2019-02-03make set return a mutable referenceRalf Jung-1/+4
2019-02-03expand as_[mut_]ptr docs a bitRalf Jung-4/+4
2019-02-03some type-level docs for MaybeUninit; rename into_inner -> into_initializedRalf Jung-6/+47
2019-02-03RangeInclusive internal iteration performance improvement.Matthieu M-3/+50
Specialize Iterator::try_fold and DoubleEndedIterator::try_rfold to improve code generation in all internal iteration scenarios. This changes brings the performance of internal iteration with RangeInclusive on par with the performance of iteration with Range: - Single conditional jump in hot loop, - Unrolling and vectorization, - And even Closed Form substitution. Unfortunately, it only applies to internal iteration. Despite various attempts at stream-lining the implementation of next and next_back, LLVM has stubbornly refused to optimize external iteration appropriately, leaving me with a choice between: - The current implementation, for which Closed Form substitution is performed, but which uses 2 conditional jumps in the hot loop when optimization fail. - An implementation using a "is_done" boolean, which uses 1 conditional jump in the hot loop when optimization fail, allowing unrolling and vectorization, but for which Closed Form substitution fails. In the absence of any conclusive evidence as to which usecase matters most, and with no assurance that the lack of Closed Form substitution is not indicative of other optimizations being foiled, there is no way to pick one implementation over the other, and thus I defer to the statu quo as far as next and next_back are concerned.
2019-02-03Auto merge of #57922 - davidtwco:issue-57410, r=petrochenkovbors-0/+3
Update visibility of intermediate use items. Fixes #57410 and fixes #53925 and fixes #47816. Currently, the target of a use statement will be updated with the visibility of the use statement itself (if the use statement was visible). This PR ensures that if the path to the target item is via another use statement then that intermediate use statement will also have the visibility updated like the target. This silences incorrect `unreachable_pub` lints with inactionable suggestions.
2019-02-03Auto merge of #58062 - SimonSapin:iter_from_fn, r=alexcrichtonbors-32/+25
Rename iter::unfold to iter::from_fn and remove explicit state This API is unstable. CC https://github.com/rust-lang/rust/issues/55977#issuecomment-459657195
2019-02-02Update visibility of intermediate use items.David Wood-0/+3
Currently, the target of a use statement will be updated with the visibility of the use statement itself (if the use statement was visible). This commit ensures that if the path to the target item is via another use statement then that intermediate use statement will also have the visibility updated like the target. This silences incorrect `unreachable_pub` lints with inactionable suggestions.
2019-02-01Simplify the overflowing_neg expressionLokathor-1/+1
2019-02-01Rename iter::unfold to iter::from_fn and remove explicit stateSimon Sapin-32/+25
This API is unstable. CC https://github.com/rust-lang/rust/issues/55977#issuecomment-459657195
2019-02-01Stabilize split_ascii_whitespaceSimon Sapin-6/+5
Tracking issue FCP to merge: https://github.com/rust-lang/rust/issues/48656#issuecomment-442372750
2019-02-01Don't know why I wasn't using `self` properly thereLokathor-1/+1
2019-02-01Make overflowing and wrapping negation constLokathor-9/+5
Remember that the signed and unsigned versions are slightly different here, so there's four functions made const instead of just two.
2019-02-01Auto merge of #58002 - oli-obk:deprecated_sugg, r=zackmdavisbors-2/+32
Add suggestions to deprecation lints Clippy used to do this suggestion, but the clippy lints happen after the deprecation lints so we ended up never seeing the structured suggestions.
2019-01-31Auto merge of #58003 - nikic:saturating-add, r=nagisabors-0/+33
Use LLVM intrinsics for saturating add/sub Use the `[su](add|sub).sat` LLVM intrinsics, if we're compiling against LLVM 8, as they should optimize and codegen better than IR based on `[su](add|sub).with.overlow`. For the fallback for LLVM < 8 I'm using the same expansion that target lowering in LLVM uses, which is not the same as Rust currently uses (in particular due to the use of selects rather than branches). Fixes #55286. Fixes #52203. Fixes #44500. r? @nagisa
2019-01-31Rollup merge of #58005 - vitiral:docs_trim_start_matches, r=ManishearthMazdak Farrokhzad-8/+8
update docs for fix_start/end_matches fixes #57686:
2019-01-31Rollup merge of #57106 - matthiaskrgr:trim_must_use, r=sfacklerMazdak Farrokhzad-0/+12
Mark str::trim.* functions as #[must_use]. The functions return a reference to a new object and do not modify in-place as the following code shows: ```` let s = String::from(" hello "); s.trim(); assert_eq!(s, " hello "); ```` The new reference should be bound to a variable as now indicated by #[must_use].
2019-01-30fix #57686: update docs for fix_start/end_matchesRett Berg-8/+8
2019-01-30Add suggestions to deprecation lintsOliver Scherer-2/+32
2019-01-29Use LLVM intrinsics for saturating add/subNikita Popov-0/+33
2019-01-29Auto merge of #57808 - gnzlbg:ustdsimd, r=gnzlbgbors-8/+9
Update stdsimd This is the companion PR to https://github.com/rust-lang-nursery/stdsimd/pull/640 r? @alexcrichton
2019-01-29Update stdsimdgnzlbg-8/+9
2019-01-28Rollup merge of #57045 - RalfJung:kill-more-uninit, r=SimonSapinMazdak Farrokhzad-21/+56
Kill remaining uses of mem::uninitialized in libcore, liballoc Kill remaining uses of mem::uninitialized in libcore and liballoc, and enable a lint that will warn when uses are added again in the future. To avoid casting raw pointers around (which is always very dangerous because it is not typechecked at all -- it doesn't even get the "same size" sanity check that `transmute` gets), I also added two new functions to `MaybeUninit`: ```rust /// Get a pointer to the first contained values. pub fn first_ptr(this: &[MaybeUninit<T>]) -> *const T { this as *const [MaybeUninit<T>] as *const T } /// Get a mutable pointer to the first contained values. pub fn first_mut_ptr(this: &mut [MaybeUninit<T>]) -> *mut T { this as *mut [MaybeUninit<T>] as *mut T } ``` I changed some of the existing code to use array-of-`MaybeUninit` instead of `MaybeUninit`-of-array, successfully removing raw pointer casts there as well.
2019-01-28Auto merge of #55704 - Nemo157:pinned-generators, r=Zoxcbors-14/+25
Use pinning for generators to make trait safe I'm unsure whether there needs to be any changes to the actual generator transform. Tests are passing so the fact that `Pin<&mut T>` is fundamentally the same as `&mut T` seems to allow it to still work, but maybe there's something subtle here that could go wrong. This is specified in [RFC 2349 § Immovable generators](https://github.com/rust-lang/rfcs/blob/master/text/2349-pin.md#immovable-generators) (although, since that RFC it has become safe to create an immovable generator, and instead it's unsafe to resume any generator; with these changes both are now safe and instead the unsafety is moved to creating a `Pin<&mut [static generator]>` which there are safe APIs for). CC #43122
2019-01-28rename first_mut_ptr -> first_ptr_mutRalf Jung-6/+6
2019-01-28fix typos, improve docsRalf Jung-2/+2
2019-01-28Use warn() for extra diagnostics; with -D warnings this leads to errorsRalf Jung-3/+3
This is needed to properly respect "deny_warnings = false" in config.toml
2019-01-28add macro for creating uninitialized arrayRalf Jung-21/+22
2019-01-28avoid mem::uninitialized in BTreeMapRalf Jung-1/+1
2019-01-28libcore: avoid mem::uninitialized and raw ptr castsRalf Jung-13/+49
2019-01-28libcore: remove unneeded allow(deprecated)Ralf Jung-4/+2
2019-01-27Update generator transform and generated function signatureWim Looman-0/+1
2019-01-27Mark static generators as !UnpinWim Looman-0/+1
2019-01-27Change generator trait to use pinningWim Looman-14/+23
2019-01-27Auto merge of #56932 - clarcharr:iter_refactor, r=Centrilbors-3862/+4032
Refactor core::iter module A while back, I refactored `core::ops` in #42523 because the module had become a giant mess and was difficult to modify. Now, I'm doing the same with the `core::iter` module. Like the `core::ops` refactor, things have been split up into multiple commits to make rebasing easier, and so that you can follow changes. Although the diffs are hard to decipher, the only actual code changes I've made in the first few commits are to modify exports and imports. I save all of the actual code refactoring, e.g. modifying what methods are called, for the end.
2019-01-27Auto merge of #57765 - Mark-Simulacrum:bootstrap-bump, r=alexcrichtonbors-153/+10
Bump bootstrap compiler to 1.33 beta r? @alexcrichton or @pietroalbini cc @rust-lang/release
2019-01-27Auto merge of #57826 - danielhenrymantilla:master, r=Centrilbors-1/+1
Fixed Deref coercion explanation for DerefMut using shared references
2019-01-26Replace deprecated ATOMIC_INIT constsMark Rousskov-3/+2
2019-01-26Remove lexical scope examples from std::mem::dropAlex Macleod-28/+1
The example no longer produces an error in the 2018 edition
2019-01-26Tiny improvement to docs for `core::convert`.Simon Heath-1/+4
This is not really significant, accept or reject as you wish. I just want to make sure I understand how the PR process works and I'm doing it right before doing a bigger one for #33417.
2019-01-26Rollup merge of #57825 - RalfJung:zeroed, r=nikomatsakisMazdak Farrokhzad-1/+0
un-deprecate mem::zeroed as per the discussion around <https://github.com/rust-lang/rust/issues/53491#issuecomment-451454793>
2019-01-26Bump bootstrap compiler to 1.33 betaMark Rousskov-150/+8
2019-01-25std: Stabilize fixed-width integer atomicsAlex Crichton-55/+96
This commit stabilizes the `Atomic{I,U}{8,16,32,64}` APIs in the `std::sync::atomic` and `core::sync::atomic` modules. Proposed in #56753 and tracked in #32976 this feature has been unstable for quite some time and is hopefully ready to go over the finish line now! The API is being stabilized as-is. The API of `AtomicU8` and friends mirrors that of `AtomicUsize`. A list of changes made here are: * A portability documentation section has been added to describe the current state of affairs. * Emulation of smaller-size atomics with larger-size atomics has been documented. * As an added bonus, `ATOMIC_*_INIT` is now scheduled for deprecation across the board in 1.34.0 now that `const` functions can be invoked in statics. Note that the 128-bit atomic types are omitted from this stabilization explicitly. They have far less platform support than the other atomic types, and will likely require further discussion about their best location. Closes #32976 Closes #56753
2019-01-25Rollup merge of #56217 - frewsxcv:frewsxcv-float-parse, r=QuietMisdreavusMazdak Farrokhzad-1/+25
Add grammar in docs for {f32,f64}::from_str, mention known bug. - Original bug about documenting grammar - https://github.com/rust-lang/rust/issues/32243 - Known bug with parsing - https://github.com/rust-lang/rust/issues/31407
2019-01-24Instead of adding a paragraph mentioning std::mem::transmute and ↵Johnathan Van Why-4/+1
core::mem::transmute, create documentation pages for them. This renders them discoverable via search. I removed the mention of the exports in the transmute documentation, but can re-add it if desired.
2019-01-24Rollup merge of #57873 - milesand:master, r=CentrilMazdak Farrokhzad-16/+8
Stabilize no_panic_pow This would close #48320. I'm not sure if I've done this right, I've just changed attribute name to stable and set `since` to two minor versions above current stable since that seemed like what others were doing.
2019-01-24Stabilize no_panic_powJewoo Lee-16/+8
2019-01-24Rollup merge of #57834 - SimonSapin:type_id, r=CentrilMazdak Farrokhzad-10/+6
Stabilize Any::get_type_id and rename to type_id FCP: https://github.com/rust-lang/rust/issues/27745#issuecomment-373906749 Closes https://github.com/rust-lang/rust/issues/27745.