about summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2020-07-17Add #[inline] to Arguments::as_str().Mara Bos-0/+1
2020-07-17Add Arguments::as_str().Mara Bos-0/+35
2020-07-17Deny intra_doc_link_resolution_failure in libcoreLzu Tao-0/+1
2020-07-17Remove code span for implLzu Tao-3/+3
Because the old one is harder to read and confuse typing checkers.
2020-07-17Link Some(item)Lzu Tao-2/+3
2020-07-17Remove unneeded link for OptionLzu Tao-1/+0
2020-07-17Intra-doc for iter Sum and Product traitsLzu Tao-6/+6
2020-07-17Intra-doc for DoubleEndIteratorLzu Tao-4/+2
2020-07-17Intra doc for iter marker traitsLzu Tao-6/+4
2020-07-17Use intra-doc link on Iterator pageLzu Tao-56/+21
2020-07-17docs: better demonstrate that None values are skipped as many times as neededTshepang Lekhonkhobe-4/+2
2020-07-17Auto merge of #74395 - Mark-Simulacrum:stage0-next, r=pietroalbinibors-43/+5
Bump version to 1.47 This also bumps to a more recent rustfmt version, just to keep us relatively up to date (though almost nothing has changed in rustfmt we use beyond bumps to the parser infra). No formatting changes as a result of this. r? @pietroalbini
2020-07-16apply bootstrap cfgsMark Rousskov-43/+5
2020-07-17integrate Lazy into std layoutAshley Mannix-0/+507
This commit refactors the initial implementation to fit into std and makes some other changes: - use MaybeUninit internally in SyncOnceCell - correctly impl Drop for lazy::Once - port Lazy::take from once_cell from: https://github.com/matklad/once_cell/pull/100 Co-Authored-By: Paul Dicker <pitdicker@users.noreply.github.com>
2020-07-16Rollup merge of #74390 - ColoredCarrot:patch-1, r=lcnrManish Goregaokar-1/+1
Fix typo in std::mem::transmute documentation `u32::from_ge_bytes` function does not exist; replace with `u32::from_be_bytes`. It is clear that `u32::from_le_bytes` is not meant from the context; the latter is used correctly while `from_be_bytes` is misspelled.
2020-07-16Revert "Remove spotlight usage"Manish Goregaokar-0/+3
This reverts commit 13c6d5819aae3c0de6a90e7f17ea967bf4487cbb.
2020-07-16Auto merge of #72481 - marmeladema:duration-consts-2, r=oli-obkbors-19/+29
Constify most non-trait `Duration` methods as described in #72440 The remaining methods could probably be made const once https://github.com/rust-lang/rust/pull/72449 lands with support for `f<32|64>::is_finite()`.
2020-07-16Fix typo in std::mem::transmute documentationColoredCarrot-1/+1
u32::from_ge_bytes method does not exist; replace with u32::from_be_bytes
2020-07-16Rollup merge of #74381 - mbrubeck:docs, r=Mark-SimulacrumManish Goregaokar-4/+7
Update docs for str::as_bytes_mut. * Add "Safety" section describing UTF-8 invariant. * Remove mention of `from_utf8_mut`. It is not necessary to call a function to convert the byte slice back to a string slice. The original string becomes accessible again after the byte slice is no longer used (as shown in the example code).
2020-07-16Rollup merge of #73421 - janikrabe:master, r=joshtriplettManish Goregaokar-4/+7
Clarify effect of orphan rule changes on From/Into Updated documentation for `std::convert` and `std::convert::From` to reflect changes to orphan rule in Rust 1.41. It should no longer be necessary to implement `Into` directly, unless targeting an older version. r? @steveklabnik
2020-07-15Update docs for str::as_bytes_mut.Matt Brubeck-4/+7
* Add "Safety" section describing UTF-8 invariant. * Remove mention of `from_utf8_mut`. It is not necessary to call a function to convert the byte slice back to a string slice. The original string becomes accessible again after the byte slice is no longer used (as shown in the example code).
2020-07-15Constify most non-trait `Duration` methods as described in #72440marmeladema-19/+29
2020-07-15Clarify effect of orphan rule changes on From/IntoJanik Rabe-4/+7
Updated documentation for `std::convert` and `std::convert::From` to reflect changes to orphan rule in Rust 1.41. It should no longer be necessary to implement Into directly, unless targeting an older version.
2020-07-15Rollup merge of #74344 - estebank:stringly-wobbly, r=eddybManish Goregaokar-0/+1
Remove string comparison and use diagnostic item instead r? @eddyb
2020-07-15improve DiscriminantKind handlingBastian Kauschke-0/+1
This now reuses `fn discriminant_ty` in project, removing some code duplication. Doing so made me realize that we previously had a disagreement about the discriminant type of generators, with MIR using `u32` and codegen and trait selection using `i32`. We now always use `u32`.
2020-07-14Remove string comparison and use diagnostic item insteadEsteban Küber-0/+1
2020-07-14Rollup merge of #74228 - estebank:unsized-param, r=davidtwcoManish Goregaokar-4/+1
Provide structured suggestion on unsized fields and fn params * Suggest borrowing or boxing unsized fields * Suggest borrowing fn parameters * Remove some verbosity of unsized errors * Remove `on_unimplemented` note from `trait Sized` Fix #23286, fix #28653. r? @davidtwco
2020-07-14Remove `Sized` `on_unimplemented` noteEsteban Küber-4/+1
2020-07-14Rollup merge of #74296 - Lynoure:rfind-doc-improvement, r=hanna-kruppeManish Goregaokar-5/+6
Clarify the description for rfind Changes the wording in rfind description to be clearer and the example code to illustrate the difference between find and rfind
2020-07-14Rollup merge of #73986 - RalfJung:raw-slice-as-ptr, r=sfacklerManish Goregaokar-131/+287
add (unchecked) indexing methods to raw (and NonNull) slices This complements the existing (unstable) `len` method. Unfortunately, for non-null slices, we cannot call this method `as_ptr` as that overlaps with the existing method of the same name. If this looks reasonable to accept, I propose to reuse the https://github.com/rust-lang/rust/issues/71146 tracking issue and rename the feature get to `slice_ptr_methods` or so. Cc @SimonSapin Fixes https://github.com/rust-lang/rust/issues/60639
2020-07-14Add core::ready! macroYoshua Wuyts-0/+64
2020-07-14Auto merge of #73490 - CAD97:range-unchecked-stepping, r=Amanieubors-12/+12
Use step_unchecked more liberally in range iter impls Without these `_unchecked`, these operations on iterators of `char` fail to optimize out the unreachable panicking condition on overflow. cc @cuviper https://github.com/rayon-rs/rayon/pull/771 where this was discovered.
2020-07-13Clarify the description for rfindLynoure Braakman-5/+6
Changes the example code to illustrate the difference between find and rfind
2020-07-12assign tracking issueRalf Jung-9/+9
2020-07-11Rollup merge of #74066 - thomcc:optimize-is-ascii, r=nagisaManish Goregaokar-2/+242
Optimize is_ascii for str and [u8]. This optimizes the `is_ascii` function for `[u8]` and `str`. I've been surprised this wasn't done for a while, so I just did it. Benchmarks comparing before/after look like: ``` test ascii::long_readonly::is_ascii_slice_iter_all ... bench: 174 ns/iter (+/- 79) = 40172 MB/s test ascii::long_readonly::is_ascii_slice_libcore ... bench: 16 ns/iter (+/- 5) = 436875 MB/s test ascii::medium_readonly::is_ascii_slice_iter_all ... bench: 12 ns/iter (+/- 3) = 2666 MB/s test ascii::medium_readonly::is_ascii_slice_libcore ... bench: 2 ns/iter (+/- 0) = 16000 MB/s test ascii::short_readonly::is_ascii_slice_iter_all ... bench: 3 ns/iter (+/- 0) = 2333 MB/s test ascii::short_readonly::is_ascii_slice_libcore ... bench: 4 ns/iter (+/- 0) = 1750 MB/s ``` (Taken on a x86_64 macbook 2.9 GHz Intel Core i9 with 6 cores) Where `is_ascii_slice_iter_all` is the old version, and `is_ascii_slice_libcore` is the new. I tried to document the code well, so hopefully it's understandable. It has fairly exhaustive tests ensuring size/align doesn't get violated -- because `miri` doesn't really help a lot for this sort of code right now, I tried to `debug_assert` all the safety invariants I'm depending on. (Of course, none of them are required for correctness or soundness -- just allows us to test that this sort of pointer manipulation is sound and such). Anyway, thanks. Let me know if you have questions/desired changes.
2020-07-11Rollup merge of #72920 - oli-obk:const_transmute, r=RalfJungManish Goregaokar-2/+4
Stabilize `transmute` in constants and statics but not const fn cc #53605 (leaving issue open so we can add `transmute` to `const fn` later) Previous attempt: #64011 r? @RalfJung cc @rust-lang/wg-const-eval
2020-07-11Stabilize `transmute` in constants and statics but not const fnOliver Scherer-2/+4
2020-07-10Rollup merge of #74127 - tamird:allowlist, r=oli-obkManish Goregaokar-1/+1
Avoid "whitelist" Other terms are more inclusive and precise.
2020-07-10Rollup merge of #73887 - DutchGhost:master, r=oli-obkManish Goregaokar-2/+1
stabilize const mem::forget Stabilizes const `mem::forget` as implemented in https://github.com/rust-lang/rust/pull/69617 and tracked in https://github.com/rust-lang/rust/issues/69616. Closes https://github.com/rust-lang/rust/issues/69616
2020-07-10Rollup merge of #72303 - yoshuawuyts:future-poll-fn, r=dtolnayManish Goregaokar-0/+70
Add core::future::{poll_fn, PollFn} This is a sibling PR to #70834, adding `future::poll_fn`. This is a small helper function that helps bridge the gap between "poll state machines" and "async/await". It was first introduced in [futures@0.1.7](https://docs.rs/futures/0.1.7/futures/future/fn.poll_fn.html) in December of 2016, and has been tried and tested as part of the ecosystem for the past 3.5 years. ## Implementation Much of the same reasoning from #70834 applies: by returning a concrete struct rather than an `async fn` we get to mark the future as `Unpin`. It also becomes named which allows storing it in structs without boxing. This implementation has been modified from the implementation in `futures-rs`. ## References - [`futures::future::poll_fn`](https://docs.rs/futures/0.3.5/futures/future/fn.poll_fn.html) - [`async_std::future::poll_fn`](https://docs.rs/async-std/1.5.0/async_std/future/fn.poll_fn.html)
2020-07-10Avoid "whitelist"Tamir Duberstein-1/+1
Other terms are more inclusive and precise.
2020-07-10Remove some Default implsCaio-4/+4
2020-07-09Rollup merge of #73292 - poliorcetics:fix-link-in-partialeq, r=Dylan-DPCManish Goregaokar-2/+1
Fixing broken link for the Eq trait Fixes #73233.
2020-07-09libstd/libcore: fix various typosAndy Russell-22/+22
2020-07-06Expand abbreviation in core::ffi descriptionpierwill-1/+1
2020-07-06Remove pointless `black_box` call, add a comment about the `unaligned_` ↵Thom Chiovoloni-4/+5
benches, and clean up stray semicolon
2020-07-05Rollup merge of #74064 - RalfJung:variant-count-bootstrap, r=kennytmManish Goregaokar-7/+2
variant_count: avoid incorrect dummy implementation This also avoids a stage 0 doctest failure.
2020-07-05Add 'unrolled' is_ascii_align_to benchmark, and move is_ascii benchmarks ↵Thom Chiovoloni-76/+83
into own file
2020-07-05Benchmark the unaligned case for is_ascii, and add missing SAFETYThom Chiovoloni-3/+21
2020-07-05Add benchmark for slice is_ascii using align_toThom Chiovoloni-1/+24