about summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
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-12Change fmt docs for more delegationsElichai Turkel-6/+12
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
2019-12-08Rollup merge of #67101 - rust-lang:ostrich, r=Mark-SimulacrumMazdak Farrokhzad-0/+1
use `#[allow(unused_attributes)]` to paper over incr.comp problem Paper over the problem in #58633. r? @Mark-Simulacrum
2019-12-07Simplify `Layout::extend_packed`Matthew Kraai-2/+1
2019-12-08leave a FIXMEMazdak Farrokhzad-1/+1
2019-12-08use `#[allow(unused_attributes)]` to paper over incr.comp problemMazdak Farrokhzad-0/+1
2019-12-07Auto merge of #65881 - anp:implicit-caller-location, r=eddyb,oli-obkbors-0/+55
Implement #[track_caller] attribute. (RFC 2091 4/N) Implements the `#[track_caller]` attribute in both const and codegen contexts. The const implementation walks up the stack to find the nearest untracked callsite. The codegen implementation adds an implicit argument to tracked function calls, and populates it with either a call to the previously-landed intrinsic or if the caller has `#[track_caller]` with a copy of the location passed to the current function. Also includes a little cleanup and a few comments in the other caller location areas. [Depends on: 65664](https://github.com/rust-lang/rust/pull/65664) [RFC 2091 text](https://github.com/rust-lang/rfcs/blob/master/text/2091-inline-semantic.md) [Tracking issue](https://github.com/rust-lang/rust/issues/47809) [Tracking doc](https://paper.dropbox.com/doc/track_rfc_2091_impl-notes--Anf1NwnIb0xcRv31YLIadyj0Ag-rwCdRc2fi2yvRZ7syGZ9q#:uid=863513134494965680023183&h2=TODO-actually-pass-location-to)
2019-12-07Explicitly refer to operator methods in Pin implsKonrad Borowski-9/+9
2019-12-07fix warnings with cfg(miri)Ralf Jung-5/+14
2019-12-07libcore: ignore tests in Miri instead of removing them entirelyRalf Jung-13/+11
2019-12-06Format libcore with rustfmt (including tests and benches)David Tolnay-1171/+1308
2019-12-06Suppress libcore/ptr/mod.rs filelength lintDavid Tolnay-0/+1
2019-12-06Exclude manually arranged ascii tables from rustfmtDavid Tolnay-0/+2
2019-12-06Rollup merge of #67092 - kraai:us-to-is, r=jonas-schievinkMazdak Farrokhzad-2/+2
Fix comment typos in src/libcore/alloc.rs
2019-12-06Rollup merge of #67090 - kraai:either-to-any, r=jonas-schievinkMazdak Farrokhzad-1/+1
Change "either" to "any" in Layout::from_size_align's docs
2019-12-06Rollup merge of #66841 - SimonSapin:float_round_unchecked_to, r=rkruppeMazdak Farrokhzad-332/+442
Add `{f32,f64}::approx_unchecked_to<Int>` unsafe methods As discussed in https://github.com/rust-lang/rust/issues/10184 Currently, casting a floating point number to an integer with `as` is Undefined Behavior if the value is out of range. `-Z saturating-float-casts` fixes this soundness hole by making `as` “saturate” to the maximum or minimum value of the integer type (or zero for `NaN`), but has measurable negative performance impact in some benchmarks. There is some consensus in that thread for enabling saturation by default anyway, but provide an `unsafe fn` alternative for users who know through some other mean that their values are in range. <del>The “fit” wording is copied from https://llvm.org/docs/LangRef.html#fptoui-to-instruction, but I’m not certain what it means exactly. Presumably this is after rounding towards zero, and the doc-test with `i8::MIN` seems to confirm this.</del> Clang presumably uses those LLVM intrinsics to implement C and C++ casts, whose respective standard specify that the value *after truncating to keep its integral part* must be representable in the target type.
2019-12-06Change "wth" to "with" in `Layout::padding_needed_for` commentMatthew Kraai-1/+1
2019-12-06Change "us" to "is" in Layout::for_value commentMatthew Kraai-1/+1
2019-12-06Change "either" to "any" in Layout::from_size_align's docsMatthew Kraai-1/+1