about summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2016-07-01Fix up some things which scott mentionedubsan-35/+46
2016-07-01Add more docs - mostly warnings - to std::mem::transmuteubsan-4/+95
2016-06-30Revert "Remove the return_address intrinsic."Eduard Burtescu-0/+6
This reverts commit b30134dbc3c29cf62a4518090e1389ff26918c19.
2016-06-30Correct MIN_EXP docs and improve EPSILONOliver Middleton-4/+4
2016-06-29std: use siphash-1-3 for HashMapSean McArthur-52/+200
2016-06-29Improve code example for try!Jupp Müller-1/+4
This change improves the code example for try!, avoiding to use try! in the example code that shows what code constructs try! can replace.
2016-06-27Remove the return_address intrinsic.Eduard Burtescu-6/+0
2016-06-24Auto merge of #34425 - tbu-:pr_len_instead_of_size_hint, r=alexcrichtonbors-14/+13
Use `len` instead of `size_hint` where appropiate This makes it clearer that we're not just looking for a lower bound but rather know that the iterator is an `ExactSizeIterator`.
2016-06-24Auto merge of #34399 - alexcrichton:issue-audit, r=brsonbors-16/+0
std: Fix up stabilization discrepancies * Remove the deprecated `CharRange` type which was forgotten to be removed awhile back. * Stabilize the `os::$platform::raw::pthread_t` type which was intended to be stabilized as part of #32804
2016-06-23std: Fix up stabilization discrepanciesAlex Crichton-16/+0
* Remove the deprecated `CharRange` type which was forgotten to be removed awhile back. * Stabilize the `os::$platform::raw::pthread_t` type which was intended to be stabilized as part of #32804
2016-06-23Use `len` instead of `size_hint` where appropiateTobias Bucher-14/+13
This makes it clearer that we're not just looking for a lower bound but rather know that the iterator is an `ExactSizeIterator`.
2016-06-22Auto merge of #34408 - Manishearth:rollup, r=Manishearthbors-0/+28
Rollup of 7 pull requests - Successful merges: #34190, #34363, #34367, #34383, #34387, #34394, #34404 - Failed merges:
2016-06-22Rollup merge of #34190 - ollie27:wrapping_fmt, r=alexcrichtonManish Goregaokar-0/+28
Implement Binary, Octal, LowerHex and UpperHex for Wrapping<T> Fixes: #33659
2016-06-22Auto merge of #33976 - komamitsu:assert_eq_with_msg, r=alexcrichtonbors-1/+12
Add custom message parameter to `assert_eq!` `assert!` macro accepts a custom message parameter and it's sometimes useful. But `assert_eq!` doesn't have it and users need to use `assert!` instead of `assert_eq!` when they want to output a custom message even if the assertion just compares two values. This pull request will resolve those cases.
2016-06-21Rollup merge of #34360 - dsprenkels:ops-doc, r=apasel422Guillaume Gomez-0/+1
Markdown formatting fix This pull request fixes some bad markdown formatting in the[ `std::ops::RangeTo` documentation](https://doc.rust-lang.org/std/ops/struct.RangeTo.html): ![screenshot from 2016-06-19 14 29 21](https://cloud.githubusercontent.com/assets/439973/16177354/5439a9bc-362a-11e6-97e5-374fd0bcf5a2.png)
2016-06-21Auto merge of #34155 - ollie27:unzip, r=alexcrichtonbors-15/+0
Remove unzip() SizeHint hack This was using an invalid iterator so is likely to end with buggy behaviour. It also doesn't even benefit many type in std including Vec so removing it shouldn't cause any problems. Fixes: #33468
2016-06-21Add message argument to `assert_eq` macroMitsunori Komatsu-1/+12
2016-06-19Remove first empty line of doc commentTobias Bucher-1/+0
2016-06-19doc: std::ops md formatting fixDaan Sprenkels-0/+1
2016-06-19Add `is_empty` function to `ExactSizeIterator`Tobias Bucher-2/+27
All other types implementing a `len` functions have `is_empty` already.
2016-06-17Auto merge of #33090 - bluss:special-zip-2, r=aturonbors-21/+210
Specialize .zip() for efficient slice and slice iteration The idea is to introduce a private trait TrustedRandomAccess and specialize .zip() for random access iterators into a counted loop. The implementation in the PR is internal and has no visible effect in the API Why a counted loop? To have each slice iterator compile to just a pointer, and both pointers are indexed with the same loop counter value in the generated code. When this succeeds, copying loops are readily recognized and replaced with memcpy and addition loops autovectorize well. The TrustedRandomAccess approach works very well on the surface. Microbenchmarks optimize well, following the ideas above, and that is a dramatic improvement of .zip()'s codegen. ```rust // old zip before this PR: bad, byte-for-byte loop // with specialized zip: memcpy pub fn copy_zip(xs: &[u8], ys: &mut [u8]) { for (a, b) in ys.iter_mut().zip(xs) { *a = *b; } } // old zip before this PR: single addition per iteration // with specialized zip: vectorized pub fn add_zip(xs: &[f32], ys: &mut [f32]) { for (a, b) in ys.iter_mut().zip(xs) { *a += *b; } } // old zip before this PR: single addition per iteration // with specialized zip: vectorized (!!) pub fn add_zip3(xs: &[f32], ys: &[f32], zs: &mut [f32]) { for ((a, b), c) in zs.iter_mut().zip(xs).zip(ys) { *a += *b * *c; } } ``` Yet in more complex situations, the .zip() loop can still fall back to its old behavior where phantom null checks throw in fake premature end of the loop conditionals. Remember that a NULL inside Option<(&T, &T)> makes it a `None` value and a premature (in this case) end of the loop. So even if we have 1) an explicit `Some` in the code and 2) the types of the pointers are `&T` or `&mut T` which are nonnull, we can still get a phantom null check at that point. One example that illustrates the difference is `copy_zip` with slice versus Vec arguments. The involved iterator types are exactly the same, but the Vec version doesn't compile down to memcpy. Investigating into this, the function argument metadata emitted to llvm plays the biggest role. As eddyb summarized, we need nonnull for the loop to autovectorize and noalias for it to replace with memcpy. There was an experiment to use `assume` to add a non-null assumption on each of the two elements in the specialized zip iterator, but this only helped in some of the test cases and regressed others. Instead I think the nonnull/noalias metadata issue is something we need to solve separately anyway. These have conditionally implemented TrustedRandomAccess - Enumerate - Zip These have not implemented it - Map is sideeffectful. The forward case would be workable, but the double ended case is complicated. - Chain, exact length semantics unclear - Filter, FilterMap, FlatMap and many others don't offer random access and/or exact length
2016-06-15Auto merge of #34180 - durka:patch-24, r=brsonbors-6/+6
derive Hash (and not Copy) for ranges Fixes #34170. Also, `RangeInclusive` was `Copy` by mistake -- fix that, which is a [breaking-change] to that unstable type.
2016-06-14Add/improve num const docsOliver Middleton-65/+64
This adds short summaries to all num consts.
2016-06-14specialize zip: Use associated type for specialized zip struct dataUlrik Sverdrup-13/+39
The associated type must be 'static to avoid dropck related errors.
2016-06-14specialize zip: TrustedRandomAccess for EnumerateUlrik Sverdrup-0/+9
2016-06-14specialize zip: TrustedRandomAccess for ZipUlrik Sverdrup-0/+11
2016-06-14specialize zip: Specialize .zip() for TrustedRandomAccess iteratorsUlrik Sverdrup-21/+121
This allows common iterator compositions like a.zip(b) where a, b are slice::{Iter, IterMut} compile to *much* better code.
2016-06-14specialize zip: Implement TrustedRandomAccess for slice iteratorsUlrik Sverdrup-0/+15
2016-06-14specialize zip: Introduce TrustedRandomAccess traitUlrik Sverdrup-0/+28
2016-06-10Rollup merge of #34145 - matklad:any-docs, r=steveklabnikSeo Sanghyeon-1/+1
docs: simplify wording It took me more then a moment to decipher "with no non-`'static`" thing :) "`'static` type" should say the same thing more clearly. r? @steveklabnik
2016-06-09Auto merge of #34046 - Vtec234:fix-atomic-doc, r=steveklabnikbors-3/+3
Fix wrong statement in compare_exchange doc The documentation for `core::sync::atomic::AtomicSomething::compare_exchange` contains a wrong, or imprecise, statement about the return value. It goes: The return value is a result indicating whether the new value was written and containing the previous value. On success this value is guaranteed to be equal to `new`. In the second sentence, `this value` is gramatically understood as referring to `return value` from the first sentence. Due to how CAS works, the returned value is always what was in the atomic variable _before_ the operation occurred, not what was written into it during the operation. Hence, the fixed doc should say: The return value is a result indicating whether the new value was written and containing the previous value. On success this value is guaranteed to be equal to `current`. This version is confirmed by the runnable examples in variants of `AtomicSomething`, e.g. assert_eq!(some_bool.compare_exchange(true, false, Ordering::Acquire, Ordering::Relaxed), Ok(true)); where the returned value is `Ok(current)`. This PR fixes all occurrences of this bug I could find. An alternative solution would be to modify the second sentence so that it refers to the value _written_ into the Atomic rather than what was there before, in which case it would be correct. Example alternative formulation: On success the value written into the `bool`/`usize`/`whatever` is guaranteed to be equal to `new`. r? @steveklabnik
2016-06-09Implement Binary, Octal, LowerHex and UpperHex for Wrapping<T>Oliver Middleton-0/+28
2016-06-09make RangeInclusive Hash and !CopyAlex Burka-1/+1
[breaking-change] due to the removal of Copy which shouldn't have been there in the first place, as per policy set forth in #27186.
2016-06-09derive Hash for rangesAlex Burka-5/+5
Fixes #34170.
2016-06-07Remove unzip() SizeHint hackOliver Middleton-15/+0
This was using an invalid iterator so is likely to end with buggy behaviour. It also doesn't even benefit many type in std including Vec so removing it shouldn't cause any problems.
2016-06-07docs: simplify wordingAleksey Kladov-1/+1
2016-06-06Rollup merge of #34081 - RustOS-Fork-Holding-Ground:no-core-build-script, ↵Eduard-Mihai Burtescu-18/+0
r=alexcrichton No build.rs for libcore I did a grep and there are no longer any mention of "rustbuild" in core, in `cfg`s or otherwise.
2016-06-06Rollup merge of #34059 - reeze:patch-2, r=GuillaumeGomezEduard-Mihai Burtescu-1/+1
Update comment The path has changed
2016-06-05core: mark relevant functions with #[rustc_inherit_overflow_checks].Eduard Burtescu-3/+19
2016-06-04No build.rs for libcoreJohn Ericson-18/+0
2016-06-03Auto merge of #33460 - shepmaster:16-bit-pointers, r=Aatchbors-0/+46
Support 16-bit pointers as well as i/usize I'm opening this pull request to get some feedback from the community. Although Rust doesn't support any platforms with a native 16-bit pointer at the moment, the [AVR-Rust][ar] fork is working towards that goal. Keeping this forked logic up-to-date with the changes in master has been onerous so I'd like to merge these changes so that they get carried along when refactoring happens. I do not believe this should increase the maintenance burden. This is based on the original work of Dylan McKay (@dylanmckay). [ar]: https://github.com/avr-rust/rust
2016-06-03Update commentReeze Xia-1/+1
The path has changed
2016-06-02atomic doc: fix statementWojciech Nawrocki-3/+3
2016-06-01Auto merge of #33853 - alexcrichton:remove-deprecated, r=aturonbors-280/+1
std: Clean out old unstable + deprecated APIs These should all have been deprecated for at least one cycle, so this commit cleans them all out.
2016-06-01Rollup merge of #33896 - strake:next_code_point, r=aturonManish Goregaokar-2/+3
make core::str::next_code_point work on arbitrary iterator
2016-06-01Rollup merge of #33892 - seanmonstar:slice-eq-ptr, r=alexcrichtonManish Goregaokar-0/+3
core: check pointer equality when comparing byte slices If pointer address and length are the same, it should be the same slice. In experiments, I've seen that this doesn't happen as often in debug builds, but release builds seem to optimize to using a single pointer more often.
2016-05-31mk: Prepare for a new stage0 compilerAlex Crichton-46/+14
This commit prepares the source for a new stage0 compiler, the 1.10.0 beta compiler. These artifacts are hot off the bots and should be ready to go.
2016-05-30Auto merge of #33960 - tbu-:pr_ref_clone_overflow, r=Aatchbors-1/+3
Prevent the borrow counter from overflowing in `Ref::clone` Fixes #33880.
2016-05-30std: Clean out old unstable + deprecated APIsAlex Crichton-280/+1
These should all have been deprecated for at least one cycle, so this commit cleans them all out.
2016-05-30Correct grammar; and remove redundant commentSrinivas Reddy Thatiparthy-2/+1