summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2019-12-16Rollup merge of #67349 - petertodd:2019-unsize-docs, r=CentrilMazdak Farrokhzad-1/+1
Minor: update Unsize docs for dyn syntax
2019-12-16Rollup merge of #67322 - lzutao:nonzero-use-self, r=joshtriplettMazdak Farrokhzad-3/+3
use Self alias in place of macros
2019-12-16Rollup merge of #67249 - ranma42:improve-starts-with-literal-char, r=BurntSushiMazdak Farrokhzad-15/+48
Improve code generated for `starts_with(<literal char>)` This PR includes two minor improvements to the code generated when checking for string prefix/suffix. The first commit simplifies the str/str operation, by taking advantage of the raw UTF-8 representation. The second commit replaces the current str/char matching logic with a char->str encoding and then the previous method. The resulting code should be equivalent in the generic case (one char is being encoded versus one char being decoded), but it becomes easy to optimize in the case of a literal char, which in most cases a developer might expect to be at least as simple as that of a literal string. This PR should fix #41993
2019-12-16Add benchmarks for `start_with` and `ends_with`Andrea Canciani-0/+44
2019-12-16Minor: update Unsize docs for dyn syntaxPeter Todd-1/+1
2019-12-16Rollup merge of #67317 - lcnr:type_name_docs, r=jonas-schievinkMazdak Farrokhzad-1/+1
fix type_name_of_val doc comment .
2019-12-16Rollup merge of #66771 - SimonSapin:panic-stability, r=KodrAusMazdak Farrokhzad-8/+10
Stabilize the `core::panic` module `std::panic` is already stable. `core::panic::PanicInfo` and `core::panic::Location` are stable and can be used through that path because of a bug in stability checking: #15702
2019-12-16Rollup merge of #66735 - SOF3:feature/str_strip, r=KodrAusMazdak Farrokhzad-1/+72
Add str::strip_prefix and str::strip_suffix Introduces a counterpart for `Path::strip_prefix` on `str`. This was also discussed in https://internals.rust-lang.org/t/pre-pr-path-strip-prefix-counterpart-in-str/11364/.
2019-12-16Rollup merge of #66570 - lzutao:stabilize-result-map_or, r=Dylan-DPCMazdak Farrokhzad-2/+1
stabilize Result::map_or r? @SimonSapin Closes #66293
2019-12-15use Self alias in place of macrosLzu Tao-3/+3
2019-12-15fix doc commentlcnr/Bastian Kauschke-1/+1
2019-12-15Set tracking issue for str_stripSOFe-2/+2
2019-12-15Rollup merge of #67305 - kappa:patch-1, r=jonas-schievinkMazdak Farrokhzad-1/+1
Doc typo
2019-12-14Doc typoAlex Kapranoff-1/+1
2019-12-14Auto merge of #67224 - nikomatsakis:revert-stabilization-of-never-type, ↵bors-16/+108
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-10/+10
This reverts commit 15c30ddd69d6cc3fffe6d304c6dc968a5ed046f1.
2019-12-14Revert "Redefine `core::convert::Infallible` as `!`."Niko Matsakis-7/+99
This reverts commit 089229a1935fa9795cfdefa518c8f8c3beb66db8.
2019-12-14Auto merge of #67136 - oli-obk:const_stability, r=Centrilbors-24/+463
Require stable/unstable annotations for the constness of all stable fns with a const modifier r? @RalfJung @Centril Every `#[stable]` const fn now needs either a `#[rustc_const_unstable]` attribute or a `#[rustc_const_stable]` attribute. You can't silently stabilize the constness of a function anymore.
2019-12-13Rollup merge of #67280 - shalzz:patch-1, r=jonas-schievinkMazdak Farrokhzad-1/+1
docs: std::convert::From: Fix typo Fix a minor typo
2019-12-13docs: std::convert::From: Fix typoShaleen Jain-1/+1
Fix a minor typo
2019-12-13The constness of 128 bit atomics will be stabilized together with the atomicsOliver Scherer-2/+2
2019-12-13be explicit that mem::uninitialized is the same as ↵Ralf Jung-1/+5
MaybeUninit::uninit().assume_init()
2019-12-13Address review commentsOliver Scherer-65/+0
2019-12-13Require stable/unstable annotations for the constness of all stable ↵Oliver Scherer-23/+527
functions with a `const` modifier
2019-12-13Reuse the `staged_api` feature for `rustc_const_unstable`Oliver Scherer-1/+1
2019-12-12Minor cleanup in `Pattern::{is_prefix_of,is_suffix_of}` for `char`Andrea Canciani-4/+2
2019-12-12Prefer encoding the char when checking for string prefix/suffixAndrea Canciani-10/+4
This enables constant folding when matching a literal char. Fixes #41993.
2019-12-12Rollup merge of #67237 - llogiq:improve-str, r=Dylan-DPCYuki Okushi-16/+6
Some small readability improvements
2019-12-11Improve `str` prefix/suffix comparisonAndrea Canciani-5/+2
The comparison can be performed on the raw bytes, as the chars can only match if their UTF8 encoding matches. This avoids the `is_char_boundary` checks and translates to a straight `u8` slice comparison which is optimized to a memcmp or inline comparison where appropriate.
2019-12-11Some small readability improvementsAndre Bogus-16/+6
2019-12-11Auto merge of #65345 - ↵bors-0/+2
davidtwco:issue-64130-async-send-sync-error-improvements, r=nikomatsakis async/await: improve not-send errors, part 2 Part of #64130. Fixes #65667. This PR improves the errors introduced in #64895 so that they have specialized messages for `Send` and `Sync`. r? @nikomatsakis
2019-12-11Rollup merge of #67174 - kraai:remove-checked_add, r=rkruppeMazdak Farrokhzad-2/+5
Remove `checked_add` in `Layout::repeat`
2019-12-11Rollup merge of #66881 - ↵Mazdak Farrokhzad-1/+19
krishna-veerareddy:issue-66780-bool-ord-optimization, r=sfackler Optimize Ord trait implementation for bool Casting the booleans to `i8`s and converting their difference into `Ordering` generates better assembly than casting them to `u8`s and comparing them. Fixes #66780 #### Comparison([Godbolt link](https://rust.godbolt.org/z/PjBpvF)) ##### Old assembly: ```asm example::boolean_cmp: mov ecx, edi xor ecx, esi test esi, esi mov eax, 255 cmove eax, ecx test edi, edi cmovne eax, ecx ret ``` ##### New assembly: ```asm example::boolean_cmp: mov eax, edi sub al, sil ret ``` ##### Old LLVM-MCA statistics: ``` Iterations: 100 Instructions: 800 Total Cycles: 234 Total uOps: 1000 Dispatch Width: 6 uOps Per Cycle: 4.27 IPC: 3.42 Block RThroughput: 1.7 ``` ##### New LLVM-MCA statistics: ``` Iterations: 100 Instructions: 300 Total Cycles: 110 Total uOps: 500 Dispatch Width: 6 uOps Per Cycle: 4.55 IPC: 2.73 Block RThroughput: 1.0 ```
2019-12-10Add better documentation for unsafe blockKrishna Sai Veera Reddy-1/+1
2019-12-11Rollup merge of #67154 - kraai:alloc-typos, r=Dylan-DPCYuki Okushi-6/+6
Fix typos in src/libcore/alloc.rs docs
2019-12-10Auto merge of #66277 - peter-wilkins:impl-from-wider-non-zeros, r=SimonSapinbors-85/+177
From<NonZero*> impls for wider NonZero types Closes: https://github.com/rust-lang/rust/issues/66291
2019-12-10Auto merge of #67039 - xfix:manually-implement-pin-traits, r=nikomatsakisbors-17/+41
Use deref target in Pin trait implementations Using deref target instead of pointer itself avoids providing access to `&Rc<T>` for malicious implementations, which would allow calling `Rc::get_mut`. This is a breaking change necessary due to unsoundness, however the impact of it should be minimal. This only fixes the issue with malicious `PartialEq` implementations, other `Pin` soundness issues are still here. See <https://internals.rust-lang.org/t/unsoundness-in-pin/11311/73> for more details.
2019-12-09Rollup merge of #67155 - kraai:move-instead-of-binding-to-reference, r=cramertjTyler Mandry-6/+6
Move `Layout`s instead of binding by reference
2019-12-09Rollup merge of #67138 - kraai:simplify-Layout-extend_packed, r=AmanieuTyler Mandry-2/+1
Simplify `Layout::extend_packed`
2019-12-09Rollup merge of #67119 - RalfJung:miri-test-libstd, r=alexcrichtonTyler Mandry-18/+25
libstd miri tests: avoid warnings Ignore tests in a way that all the code still gets compiled, to get rid of all the "unused" warnings that otherwise show up when running the test suite in Miri.
2019-12-09Rollup merge of #66892 - dtolnay:fmt5, r=KodrAusTyler Mandry-1171/+1311
Format libcore with rustfmt (including tests and benches) Important: two small non-rustfmt changes that will need close review: - I added `#[rustfmt::skip]` to two manually arranged tables in src/libcore/benches/ascii.rs; see first commit in the PR. - I added `// ignore-tidy-filelength` to src/libcore/ptr/mod.rs because rustfmt puts it over tidy's 3000 line limit; see second commit in the PR. I filed #66891 to follow up on breaking up that file. For now though having it be formatted is more important than having it below the line limit. --- As with my previous formatting PRs, I am avoiding causing merge conflicts in other PRs by only touches those files that are not involved in any currently open PR. Files that appear in new PRs between when this PR is opened and when it makes it to the top of the bors queue will be reverted from this PR. The list of files involved in open PRs is determined by querying GitHub's GraphQL API [with this script](https://gist.github.com/dtolnay/aa9c34993dc051a4f344d1b10e4487e8). With the list of files from the script in outstanding_files, the relevant commands were: ``` $ find src/libcore -name '*.rs' \ | xargs rustfmt --edition=2018 --unstable-features --skip-children $ rg libcore outstanding_files | xargs git checkout -- ``` To confirm no funny business: ``` $ git checkout $THIS_COMMIT^ $ git show --pretty= --name-only $THIS_COMMIT \ | xargs rustfmt --edition=2018 --unstable-features --skip-children $ git diff $THIS_COMMIT # there should be no difference ``` r? @Dylan-DPC
2019-12-09Remove `checked_add` in `Layout::repeat`Matthew Kraai-2/+5
2019-12-08move from non zero impls to `libcore/convert/num.rs`Peter-3418/+4230
2019-12-08async/await: more improvements to non-send errorsDavid Wood-0/+2
Signed-off-by: David Wood <david@davidtw.co>
2019-12-08Move `Layout`s instead of binding by referenceMatthew Kraai-6/+6
2019-12-08Change "attributes" to "attribute" in `Alloc`'s docsMatthew Kraai-1/+1
2019-12-08Change "`alloc`/`realloc`" to "`realloc/dealloc`"Matthew Kraai-3/+3
2019-12-08Add "this" to `GlobalAlloc::alloc`'s docsMatthew Kraai-1/+1
2019-12-08Change "though" to "through" in `Alloc`'s docsMatthew Kraai-1/+1
2019-12-08Change "result" to "resulting" in `Layout::extend`'s docsMatthew Kraai-1/+1