about summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2018-01-08Auto merge of #47208 - Manishearth:double-ended-searcher, r=pnkfelixbors-6/+48
Make double ended searchers use dependent fingers (fixes #47175) r? @burntsushi @alexcrichton needs uplift to beta
2018-01-08Add missing linksGuillaume Gomez-1/+4
2018-01-06Use `next` and `next_back`varkor-16/+8
2018-01-07Rollup merge of #46947 - tspiteri:checked-div-rem-none, r=frewsxcvkennytm-4/+4
doc: improve None condition doc for `checked_div` and `checked_rem` This commit improves the condition mentioned in the docs for which `checked_div` and `checked_rem` return `None`. For signed division, the commit changes "the operation results in overflow" to "the division results in overflow", otherwise there is room for misinterpretation for `checked_rem`: Without considering overflow, `MIN % -1` would be simply zero, allowing the misinterpretation that "the operation" does not result in overflow in this case. This ambiguity is removed using "when the division results in overflow". For unsigned division, the condition for `None` should be simply when `rhs == 0`, as no other overflow is possible.
2018-01-06Auto merge of #47141 - alexcrichton:bump-bootstrap, r=alexcrichtonbors-1/+0
Bump to 1.25.0 * Bump the release version to 1.25 * Bump the bootstrap compiler to the recent beta * Allow using unstable rustdoc features on beta - this fix has been applied to the beta branch but needed to go to the master branch as well.
2018-01-06Regression tests for #47175Manish Goregaokar-0/+38
2018-01-06Make double ended string searchers use dependent fingers (fixes #47175)Manish Goregaokar-6/+10
2018-01-05Fix behaviour after iterator exhaustionvarkor-5/+20
2018-01-05Auto merge of #47142 - sdroege:trusted-random-access-chunks, r=kennytmbors-0/+73
Implement TrustedRandomAccess for slice::{Chunks, ChunksMut, Windows} As suggested by @bluss in https://github.com/rust-lang/rust/issues/47115#issuecomment-354888334
2018-01-05Rollup merge of #47182 - aheart:master, r=steveklabnikkennytm-0/+1
Equivalent example for ? operator The example with the ? operator in the documentation for try! macro was missing file.write_all. Now all three examples are consistent.
2018-01-05Rollup merge of #47030 - ollie27:stab, r=alexcrichtonkennytm-10/+25
Correct a few stability attributes * The extra impls for `ManuallyDrop` were added in #44310 which was only stabilised in 1.22.0. * The impls for `SliceIndex` were stabilised in #43373 but as `RangeInclusive` and `RangeToInclusive` are still unstable the impls should remain unstable. * The `From` impls for atomic integers were added in #45610 but most atomic integers are still unstable. * The `shared_from_slice2` impls were added in #45990 but they won't be stable until 1.24.0. * The `Mutex` and `RwLock` impls were added in #46082 but won't be stable until 1.24.0.
2018-01-05Make UnsafeCell::into_inner safevarkor-12/+7
This fixes #35067. It will require a Crater run as discussed in that issue.
2018-01-04Bump to 1.25.0Alex Crichton-1/+0
* Bump the release version to 1.25 * Bump the bootstrap compiler to the recent beta * Allow using unstable rustdoc features on beta - this fix has been applied to the beta branch but needed to go to the master branch as well.
2018-01-04Remove min from RangeFromvarkor-12/+0
2018-01-04Make examples equivalentaheart-0/+1
The example with the ? operator was missing file.write_all
2018-01-04Add tests for specialised Range iter methodsvarkor-0/+32
2018-01-04Remove RangeInclusive::sumvarkor-18/+1
2018-01-04Fix potential overflow in TrustedRandomAccess impl for slice::{Chunks,ChunksMut}Sebastian Dröge-2/+8
2018-01-04Add max and sum specialisations for Rangevarkor-1/+25
2018-01-04Add min specialisation for RangeFrom and last for RangeInclusivevarkor-0/+10
2018-01-04Add min and max specialisations for RangeInclusivevarkor-0/+10
2018-01-03Fix compilation of TrustedRandomAccess impl for slice::ChunksSebastian Dröge-2/+2
https://github.com/rust-lang/rust/pull/47113 renamed the private size field to chunk_size for consistency.
2018-01-03Add unit test for zipping slice::{Chunks, ChunksMut, Windows} iteratorsSebastian Dröge-0/+39
For testing if the TrustedRandomAccess implementation works.
2018-01-03Implement TrustedRandomAccess for slice::{Chunks, ChunksMut, Windows}Sebastian Dröge-0/+28
2018-01-03Rollup merge of #47118 - hdhoang:patch-2, r=BurntSushikennytm-2/+2
memchr: fix variable name in docstrings upstream BurntSushi/rust-memchr#24 r=BurntSushi
2018-01-02Use assert!(chunk_size != 0) instead of > 0 for usize valueSebastian Dröge-1/+1
2018-01-02Consistently use chunk_size as the field name for Chunks and ChunksMutSebastian Dröge-15/+15
Previously Chunks used size and ChunksMut used chunk_size
2018-01-01Auto merge of #46735 - Manishearth:memchr-find, r=burntsushibors-84/+519
Use memchr for str::find(char) This is a 10x improvement for searching for characters. This also contains the patches from https://github.com/rust-lang/rust/pull/46713 . Feel free to land both separately or together. cc @mystor @alexcrichton r? @bluss fixes #46693
2018-01-01handle overflow/underflow in index offsetsManish Goregaokar-10/+15
2018-01-01memchr: fix variable name in docstringsHoàng Đức Hiếu-2/+2
2018-01-01Auto merge of #47064 - kennytm:force-trailing-newlines, r=estebankbors-1/+1
Add a tidy check for missing or too many trailing newlines. I've noticed recently there are lots of review comments requesting to fix trailing newlines. If this is going to be an official style here, it's better to let the CI do this repetitive check.
2017-12-31Auto merge of #46713 - Manishearth:memchr, r=blussbors-1/+260
Use memchr to speed up [u8]::contains 3x None
2017-12-31Use memchr for [i8]::contains as wellManish Goregaokar-0/+8
2017-12-30Optimise min/maxvarkor-4/+4
Swapping the conditions generates more efficient x86 assembly. See https://github.com/rust-lang/rust/pull/46926#issuecomment-354567412.
2017-12-30Add trailing newlines to files which have no trailing newlines.kennytm-1/+1
2017-12-27Correct a few stability attributesOliver Middleton-10/+25
2017-12-26Rollup merge of #46986 - nvzqz:basic-usage, r=steveklabnikkennytm-0/+8
Add "Basic Usage" to int min_value and max_value docs This adds "Basic Usage:" to the docs of `min_value` and `max_value`, which makes it consistent with docs of other integer methods.
2017-12-26Rollup merge of #46933 - clarcharr:float_docs, r=steveklabnikkennytm-2/+12
Make core::f32/f64 docs match std. For some reason these weren't in sync.
2017-12-25Pass tidy for testsManish Goregaokar-2/+14
2017-12-24Deprecate [T]::rotate in favor of [T]::rotate_{left,right}.Corey Farwell-5/+33
Background ========== Slices currently have an unstable [`rotate`] method which rotates elements in the slice to the _left_ N positions. [Here][tracking] is the tracking issue for this unstable feature. ```rust let mut a = ['a', 'b' ,'c', 'd', 'e', 'f']; a.rotate(2); assert_eq!(a, ['c', 'd', 'e', 'f', 'a', 'b']); ``` Proposal ======== Deprecate the [`rotate`] method and introduce `rotate_left` and `rotate_right` methods. ```rust let mut a = ['a', 'b' ,'c', 'd', 'e', 'f']; a.rotate_left(2); assert_eq!(a, ['c', 'd', 'e', 'f', 'a', 'b']); ``` ```rust let mut a = ['a', 'b' ,'c', 'd', 'e', 'f']; a.rotate_right(2); assert_eq!(a, ['e', 'f', 'a', 'b', 'c', 'd']); ``` Justification ============= I used this method today for my first time and (probably because I’m a naive westerner who reads LTR) was surprised when the docs mentioned that elements get rotated in a left-ward direction. I was in a situation where I needed to shift elements in a right-ward direction and had to context switch from the main problem I was working on and think how much to rotate left in order to accomplish the right-ward rotation I needed. Ruby’s `Array.rotate` shifts left-ward, Python’s `deque.rotate` shifts right-ward. Both of their implementations allow passing negative numbers to shift in the opposite direction respectively. Introducing `rotate_left` and `rotate_right` would: - remove ambiguity about direction (alleviating need to read docs 😉) - make it easier for people who need to rotate right [`rotate`]: https://doc.rust-lang.org/std/primitive.slice.html#method.rotate [tracking]: https://github.com/rust-lang/rust/issues/41891
2017-12-25Auto merge of #46914 - mikeyhew:raw_pointer_self, r=arielb1bors-2/+2
Convert warning about `*const _` to a future-compat lint #46664 was merged before I could convert the soft warning about method lookup on `*const _` into a future-compatibility lint. This PR makes that change. fixes #46837 tracking issue for the future-compatibility lint: #46906 r? @arielb1
2017-12-24Add "Basic Usage" to int min_value, max_value docsNikolai Vazquez-0/+8
2017-12-23Move Bits constraints to RawFloat::RawBitsClar Charr-5/+20
2017-12-23fix doctests in libcoreMichael Hewson-2/+2
2017-12-22Expose float from_bits and to_bits in libcore.Clar Charr-47/+51
2017-12-22doc: improve None condition doc for `checked_div` and `checked_rem`Trevor Spiteri-4/+4
2017-12-21Make core::f32/f64 docs match std.Clar Charr-2/+12
2017-12-22Rollup merge of #46898 - tspiteri:int-overflow-not-underflow, r=steveklabnikkennytm-17/+13
docs: do not call integer overflows as underflows In the API docs, integer overflow is sometimes called underflow. Underflow is really when the magnitude of a floating-point number is too small so the number underflows to subnormal or zero. With integers it is always overflow, even if the expected result is less than the minimum number that can be represented.
2017-12-22Rollup merge of #46820 - nodakai:simplify-int-impl, r=alexcrichtonkennytm-151/+52
libcore/num/mod.rs: simplify the int_impl! macro. We can simply use generic intrinsics since cd1848a1a6 by @alexcrichton Also, minimize unsafe blocks.
2017-12-21docs: do not call integer overflows as underflowsTrevor Spiteri-17/+13