about summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2020-03-06fix various typosMatthias Krüger-16/+16
2020-03-05Document unsafe blocks in core::fmtPhoebe Bell-6/+45
2020-03-05Simplify the try intrinsic by using a callback in the catch blockAmanieu d'Antras-6/+8
2020-03-05Make link to `std::str` activeLeSeulArtichaut-1/+3
2020-03-04Add unborrow to reset RefCell borrow stateAndreas Molzer-5/+36
This method is complementary for the feature refcell_leak added in an earlier PR. It allows reverting the effects of leaking a borrow guard by statically proving that such a guard could not longer exist. This was not added to the existing `get_mut` out of concern of impacting the complexity of the otherwise pure pointer cast and because the name `get_mut` poorly communicates the intent of resetting remaining borrows.
2020-03-04Use subslice patterns in slice methodsJosh Stone-22/+8
For all of the methods that pick off the first or last element, we can use subslice patterns to implement them directly, rather than relying on deeper indexing function calls. At a minimum, this means the generated code will rely less on inlining for performance, but in some cases it also optimizes better.
2020-03-04Auto merge of #68952 - faern:stabilize-assoc-int-consts, r=dtolnaybors-215/+255
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-03-03Try to ensure usize marker does not get mergedMark Rousskov-1/+11
2020-03-03Rollup merge of #69621 - matthiaskrgr:q, r=petrochenkovDylan DPC-6/+2
use question mark operator in a few places.
2020-03-03use question mark operator in a few places.Matthias Krüger-6/+2
2020-03-03Rollup merge of #69609 - TimDiekmann:excess, r=AmanieuYuki Okushi-224/+80
Remove `usable_size` APIs This removes the usable size APIs: - remove `usable_size` (obv) - change return type of allocating methods to include the allocated size - remove `_excess` API r? @Amanieu closes rust-lang/wg-allocators#17
2020-03-03Rollup merge of #69213 - LeSeulArtichaut:improve-doc-iter, r=steveklabnikYuki Okushi-2/+5
Improve documentation on iterators length Attempts to resolve #66491. @the8472 does this help? r? @steveklabnik
2020-03-03Remove `usable_size` APIsTim Diekmann-224/+80
2020-03-02remove unused mut, restructure the testDodo-6/+6
2020-03-02Apply suggestions from code reviewLeSeulArtichaut-2/+3
2020-03-02An enter as last character pleases tidy it seemsDodo-1/+1
2020-03-02const forget testsDodo-0/+19
2020-03-02Rollup merge of #69617 - DutchGhost:master, r=LukasKalbertodtDylan DPC-1/+2
constify mem::forget implements https://github.com/rust-lang/rust/issues/69616
2020-03-02Rollup merge of #69544 - lqd:unrevert-67174, r=Mark-SimulacrumDylan DPC-7/+5
Unrevert "Remove `checked_add` in `Layout::repeat`" This reapplies @kraai's original `libcore::alloc::Layout::repeat` change from #67174 which was temporarily reverted in #69241. Now that the proper LLVM fix has been cherry-picked, we can unrevert the revert. This change was originally reviewed by @hanna-kruppe on the initial PR. cc @RalfJung
2020-03-02Rollup merge of #68682 - LeSeulArtichaut:stable-intrinsics, r=steveklabnikDylan DPC-9/+473
Add documentation to compiler intrinsics This adds documentation to the compiler intrinsics having stable standard implementations. Relates to #34338 (cc @bstrie) r? @steveklabnik (for reassignment?)
2020-03-02actually mark the function constDutchGhost-1/+1
2020-03-01Implement nth, last, and count for iter::CopiedSteven Allen-0/+12
2020-03-01constify mem::forgetDutchGhost-0/+1
2020-03-01Remove assert that had been replaced by assert_neMichael Mc Donnell-1/+0
2020-02-29Rollup merge of #69582 - RalfJung:vec-parts, r=CentrilDylan DPC-6/+10
improve transmute and Vec::from_raw_parts docs I think this fixes https://github.com/rust-lang/rust/issues/64073. @Shnatsel please let me know if this is less confusing. :)
2020-02-29Rollup merge of #69581 - RalfJung:align_to_mut, r=CentrilDylan DPC-1/+15
fix aliasing violation in align_to_mut Fixes https://github.com/rust-lang/rust/issues/68549 I decided to add the testcase here to make it all one PR, but if you prefer I can also add that test case in the Miri repo instead.
2020-02-29Fix typoRalf Jung-1/+1
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2020-02-29fix aliasing violation in align_to_mutRalf Jung-1/+15
2020-02-29transmute: improve Vec exampleRalf Jung-6/+10
2020-02-29Auto merge of #69570 - Dylan-DPC:rollup-d6boczt, r=Dylan-DPCbors-19/+22
Rollup of 6 pull requests Successful merges: - #69477 (docs: add mention of async blocks in move keyword docs) - #69504 (Use assert_ne in hash tests) - #69546 (use to_vec() instead of .iter().cloned().collect() to convert slices to vecs.) - #69551 (use is_empty() instead of len() == x to determine if structs are empty.) - #69563 (Fix no_std detection for target triples) - #69567 (use .to_string() instead of format!() macro to create strings) Failed merges: r? @ghost
2020-02-29mem::zeroed/uninit: panic on types that do not permit zero-initializationRalf Jung-0/+16
2020-02-29Rollup merge of #69551 - matthiaskrgr:len_zero, r=Mark-SimulacrumDylan DPC-2/+2
use is_empty() instead of len() == x to determine if structs are empty.
2020-02-29Rollup merge of #69504 - MichaelMcDonnell:hash_assert_ne, r=LukasKalbertodtDylan DPC-17/+20
Use assert_ne in hash tests The hash tests were written before the assert_ne macro was added to the standard library. The assert_ne macro provides better output in case of a failure.
2020-02-29Auto merge of #69208 - RalfJung:debug-assert, r=Mark-Simulacrumbors-5/+19
debug_assert a few more raw pointer methods Makes progress for https://github.com/rust-lang/rust/issues/53871
2020-02-28use is_empty() instead of len() == x to determine if structs are empty.Matthias Krüger-2/+2
2020-02-28Unrevert "Remove `checked_add` in `Layout::repeat`"Remy Rakic-7/+5
2020-02-28Rollup merge of #69501 - matthiaskrgr:find_note, r=ecstatic-morseDylan DPC-0/+4
note that find(f) is equivalent to filter(f).next() in the docs. r? @ecstatic-morse
2020-02-28Rollup merge of #69495 - matthiaskrgr:op_ref, r=oli-obkDylan DPC-1/+1
don't take redundant references to operands
2020-02-27docs: note that find(f) is equivalent to filter(f).next() in the iterator docs.Matthias Krüger-0/+4
2020-02-27Remove spotlight usageGuillaume Gomez-3/+0
2020-02-27avoid a negation in is_nonoverlappingRalf Jung-2/+3
2020-02-27disable debug assertion in ptr::write for nowRalf Jung-1/+3
2020-02-27Rollup merge of #69479 - matthiaskrgr:op_pred, r=Dylan-DPCYuki Okushi-1/+1
clarify operator precedence
2020-02-26Use assert_ne in hash testsMichael Mc Donnell-17/+20
The hash tests were written before the assert_ne macro was added to the standard library. The assert_ne macro provides better output in case of a failure.
2020-02-26don't take redundant references to operandsMatthias Krüger-1/+1
2020-02-26Rollup merge of #69209 - Mark-Simulacrum:strip-unsafe, r=dtolnayDylan DPC-280/+265
Miscellaneous cleanup to formatting Each commit stands alone. This pull request will also resolve #58320.
2020-02-26Rollup merge of #68712 - HeroicKatora:finalize-ref-cell, r=dtolnayDylan DPC-0/+63
Add methods to 'leak' RefCell borrows as references with the lifetime of the original reference Usually, references to the interior are only created by the `Deref` and `DerefMut` impl of the guards `Ref` and `RefMut`. Note that `RefCell` already has to cope with leaks of such guards which, when it occurs, effectively makes it impossible to ever acquire a mutable guard or any guard for `Ref` and `RefMut` respectively. It is already safe to use this to create a reference to the inner of the ref cell that lives as long as the reference to the `RefCell` itself, e.g. ```rust fn leak(r: &RefCell<usize>) -> Option<&usize> { let guard = r.try_borrow().ok()?; let leaked = Box::leak(Box::new(guard)); Some(&*leaked) } ``` The newly added methods allow the same reference conversion without an indirection over a leaked allocation. It's placed on the `Ref`/`RefMut` to compose with both borrow and try_borrow directly.
2020-02-26clarify operator precedenceMatthias Krüger-1/+1
2020-02-26use unions instead of transmute and add const safety commentsTrevor Spiteri-8/+36
2020-02-26Rollup merge of #67637 - Mark-Simulacrum:primitive-mod, r=dtolnayDylan DPC-0/+70
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