about summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2015-07-17Remove confusing 'mutability root' termSteve Klabnik-7/+7
And some other outdated language. @echochamber came asking about these docs on IRC today, and they're a bit weird. I've updated them to be less ambiguous and use contemporary terminology.
2015-07-16Rollup merge of #27039 - bluss:siphash-tests, r=alexcrichtonManish Goregaokar-2/+0
core: Revive SipHash's tests These tests were bitrotting, include them in the crate and bring them up to date and compiling.. and they pass.
2015-07-14core: Revive SipHash's testsUlrik Sverdrup-2/+0
These tests were bitrotting, include them in the crate and bring them up to date and compiling.. and they pass.
2015-07-13Auto merge of #26241 - SimonSapin:derefmut-for-string, r=alexcrichtonbors-0/+79
See https://github.com/rust-lang/rfcs/issues/1157
2015-07-13Add str::split_at_mutSimon Sapin-0/+15
2015-07-13Implement IndexMut for String and str.Simon Sapin-0/+64
... matching the existing Index impls. There is no reason not to if String implement DerefMut. The code removed in `src/librustc/middle/effect.rs` was added in #9750 to prevent things like `s[0] = 0x80` where `s: String`, but I belive became unnecessary when the Index(Mut) traits were introduced.
2015-07-13Auto merge of #26981 - wthrowe:div_docs, r=Gankrobors-6/+26
This resolves #26845. I'm not entirely satisfied with the placement of the rounding discussion in the docs for the `Div` and `Rem` traits, but I couldn't come up with anywhere better to put it. Suggestions are welcome. I didn't add any discussion of rounding to the `checked_div` (or rem) or `wrapping_div` documentation because those seem to make it pretty clear that they do the same thing as `Div`.
2015-07-12Move rounding discussion to integer Div/Rem implsWilliam Throwe-8/+22
2015-07-12Auto merge of #26966 - nagisa:tail-init, r=alexcrichtonbors-4/+32
Fixes #26906
2015-07-12Rollup merge of #26974 - tshepang:trailing-comma, r=GankroManish Goregaokar-15/+15
2015-07-11Correct and clarify integer division rounding docsWilliam Throwe-4/+10
2015-07-11Auto merge of #26913 - sfackler:tuple-debug, r=alexcrichtonbors-7/+12
This does change the Debug output for 1-tuples to `(foo)` instead of `(foo,)` but I don't think it's that big of a deal. r? @alexcrichton
2015-07-12Implement RFC 1058Simonas Kazlauskas-4/+32
2015-07-11Auto merge of #26878 - Esption:master, r=pnkfelixbors-1/+1
I noticed in docs, specifically http://doc.rust-lang.org/std/primitive.u8.html#method.is_power_of_two, that it was like this, and it was apparently in multiple places too. Didn't change any occurrences through the cross-depo things. There's a lot in /src/llvm/ for instance, but I'm not confident on how to go about sending fixes for those, so this is just what's in the base rust depo. r? @steveklabnik
2015-07-10Add trailing , for 1-tuplesSteven Fackler-1/+16
2015-07-09Auto merge of #26909 - rick68:patch-10, r=dotdashbors-5/+5
fix typos
2015-07-09Auto merge of #26885 - mvdnes:wrapping_div, r=alexcrichtonbors-0/+10
Resolves #26867
2015-07-08Change tuple Debug impls to use buildersSteven Fackler-13/+3
2015-07-09Auto merge of #26884 - dotdash:fast, r=alexcrichtonbors-4/+22
Exploiting the fact that getting the length of the slices is known, we can use a counted loop instead of iterators, which means that we only need a single counter, instead of having to increment and check one pointer for each iterator. Benchmarks comparing vectors with 100,000 elements: Before: ``` running 8 tests test eq1_u8 ... bench: 66,757 ns/iter (+/- 113) test eq2_u16 ... bench: 111,267 ns/iter (+/- 149) test eq3_u32 ... bench: 126,282 ns/iter (+/- 111) test eq4_u64 ... bench: 126,418 ns/iter (+/- 155) test ne1_u8 ... bench: 88,990 ns/iter (+/- 161) test ne2_u16 ... bench: 89,126 ns/iter (+/- 265) test ne3_u32 ... bench: 96,901 ns/iter (+/- 92) test ne4_u64 ... bench: 96,750 ns/iter (+/- 137) ``` After: ``` running 8 tests test eq1_u8 ... bench: 46,413 ns/iter (+/- 521) test eq2_u16 ... bench: 46,500 ns/iter (+/- 74) test eq3_u32 ... bench: 50,059 ns/iter (+/- 92) test eq4_u64 ... bench: 54,001 ns/iter (+/- 92) test ne1_u8 ... bench: 47,595 ns/iter (+/- 53) test ne2_u16 ... bench: 47,521 ns/iter (+/- 59) test ne3_u32 ... bench: 44,889 ns/iter (+/- 74) test ne4_u64 ... bench: 47,775 ns/iter (+/- 68) ```
2015-07-09Update intrinsics.rsWei-Ming Yang-5/+5
fix typos
2015-07-08'iff' for docs to 'if and only if'Esption-2/+2
2015-07-08Rollup merge of #26891 - steveklabnik:gh26552, r=huonwSteve Klabnik-0/+4
Added a proper Unsafety header, as well as mentioning that the pointer shouldn't be null. Fixes #26552
2015-07-08Fix up unsafe section of slice::from_raw_partsSteve Klabnik-0/+4
Added a proper Unsafety header, as well as mentioning that the pointer shouldn't be null. Fixes #26552
2015-07-08Make mention of alternate flags in std::fmt traitsSteve Klabnik-0/+43
https://www.reddit.com/r/rust/comments/3ceaui/psa_produces_prettyprinted_debug_output/
2015-07-08Use wrapping_div call and correct the feature nameMathijs van de Nes-2/+2
2015-07-08Implement Div for Wrapping<T>Mathijs van de Nes-0/+10
Resolves #26867
2015-07-08Improve PartialEq for slicesBjörn Steinbrink-4/+22
Exploiting the fact that getting the length of the slices is known, we can use a counted loop instead of iterators, which means that we only need a single counter, instead of having to increment and check one pointer for each iterator. Benchmarks comparing vectors with 100,000 elements: Before: ``` running 8 tests test eq1_u8 ... bench: 66,757 ns/iter (+/- 113) test eq2_u16 ... bench: 111,267 ns/iter (+/- 149) test eq3_u32 ... bench: 126,282 ns/iter (+/- 111) test eq4_u64 ... bench: 126,418 ns/iter (+/- 155) test ne1_u8 ... bench: 88,990 ns/iter (+/- 161) test ne2_u16 ... bench: 89,126 ns/iter (+/- 265) test ne3_u32 ... bench: 96,901 ns/iter (+/- 92) test ne4_u64 ... bench: 96,750 ns/iter (+/- 137) ``` After: ``` running 8 tests test eq1_u8 ... bench: 46,413 ns/iter (+/- 521) test eq2_u16 ... bench: 46,500 ns/iter (+/- 74) test eq3_u32 ... bench: 50,059 ns/iter (+/- 92) test eq4_u64 ... bench: 54,001 ns/iter (+/- 92) test ne1_u8 ... bench: 47,595 ns/iter (+/- 53) test ne2_u16 ... bench: 47,521 ns/iter (+/- 59) test ne3_u32 ... bench: 44,889 ns/iter (+/- 74) test ne4_u64 ... bench: 47,775 ns/iter (+/- 68) ```
2015-07-08Fixed some occurrences of 'if' being spelled 'iff'Esption-2/+2
2015-07-06Significantly improve formatter trait docsSteve Klabnik-11/+300
Each formatting trait now has an example of implementation, as well as a fuller description of what it's supposed to output. It also contains a link to the module-level documentation which Fixes #25765
2015-07-05Auto merge of #26473 - Eljay:missing_docs, r=alexcrichtonbors-0/+35
Fixes #24249 I've tagged all items that were missing docs to allow them to compile for now, the ones in core/num should probably be documented at least. This is also a breaking change for any crates using `#[deny(missing_docs)]` that have undocumented constants, not sure there is any way to avoid this without making it a separate lint?
2015-07-05option: obey idiom of leaving behind a trailing comma in match blocksTshepang Lekhonkhobe-15/+15
2015-07-04Add missing #[inline] to min_value/max_value on integersUlrik Sverdrup-0/+2
Spotted a compiled function call to num::usize::min_value, I'd prefer the 0 to be inlined.
2015-07-04core: Use memcmp in is_prefix_of / is_suffix_ofUlrik Sverdrup-5/+4
The basic str equality in core::str calls memcmp, re-use the same function in StrSearcher's is_prefix_of, is_suffix_of.
2015-07-03Auto merge of #26378 - arielb1:unused-mut, r=pnkfelixbors-2/+2
This makes it somewhat more aggressive, so this is kind-of a [breaking-change] for these compiling with `#[deny(unused_mut)]`. r? @pnkfelix
2015-07-04Update atomic.rsWei-Ming Yang-9/+0
Remove the tagged attribute `stable` from all private functions
2015-07-02Auto merge of #26725 - tshepang:patch-2, r=blussbors-1/+1
2015-07-01doc: add missing spaceTshepang Lekhonkhobe-1/+1
2015-07-01doc: there is just one trait in hereTshepang Lekhonkhobe-2/+0
Also, the info is repeated in the following paragraph
2015-07-01Auto merge of #26698 - alexcrichton:char-fmt, r=huonwbors-1/+8
This recently regressed in #24689, and this updates the `Display` implementation to take formatting flags into account. Closes #26625
2015-06-30std: Fix formatting flags for charsAlex Crichton-1/+8
This recently regressed in #24689, and this updates the `Display` implementation to take formatting flags into account. Closes #26625
2015-07-01Make the unused_mut lint smarter with respect to locals.Ariel Ben-Yehuda-2/+2
Fixes #26332
2015-06-30Rollup merge of #26692 - steveklabnik:gh26620, r=alexcrichtonSteve Klabnik-0/+2
Fixes #26620
2015-06-30Make note of Ord's derive orderingSteve Klabnik-0/+2
Fixes #26620
2015-06-30Rollup merge of #26678 - bluss:doc-fmt, r=steveklabnikSteve Klabnik-1/+4
fmt: Update docs and mention :#? pretty-printing Expose `:#?` well in the docs for fmt and Debug itself. Also update some out of date information and fix formatting in `std::fmt` docs.
2015-06-30Auto merge of #26327 - bluss:two-way, r=aturonbors-440/+579
Update substring search to use the Two Way algorithm To improve our substring search performance, revive the two way searcher and adapt it to the Pattern API. Fixes #25483, a performance bug: that particular case now completes faster in optimized rust than in ruby (but they share the same order of magnitude). Many thanks to @gereeter who helped me understand the reverse case better and wrote the comment explaining `next_back` in the code. I had quickcheck to fuzz test forward and reverse searching thoroughly. The two way searcher implements both forward and reverse search, but not double ended search. The forward and reverse parts of the two way searcher are completely independent. The two way searcher algorithm has very small, constant space overhead, requiring no dynamic allocation. Our implementation is relatively fast, especially due to the `byteset` addition to the algorithm, which speeds up many no-match cases. A bad case for the two way algorithm is: ``` let haystack = (0..10_000).map(|_| "dac").collect::<String>(); let needle = (0..100).map(|_| "bac").collect::<String>()); ``` For this particular case, two way is not much faster than the naive implementation it replaces.
2015-06-30Auto merge of #26664 - steveklabnik:gh26571, r=alexcrichtonbors-2/+39
This was pretty misleading, so let's improve. Fixes #26571
2015-06-30fmt: Update docs and mention :#? pretty-printingUlrik Sverdrup-1/+4
2015-06-29Improve doc for std::mem::dropSteve Klabnik-2/+39
This was pretty misleading, so let's improve. Fixes #26571
2015-06-29Refine Atomic*::compare_and_swap documentationSimonas Kazlauskas-23/+23
Namely: * Change parameter `old` to read `current` so it is clearer what the argument refers to (originally suggested `expected`, but shot down by Steve); * Add some formatting and fix some mistakes like referring to the method as `swap` rather than `compare_and_swap`.
2015-06-27std: Avoid missing fns on i686-pc-windows-msvcAlex Crichton-21/+83
It turns out that the 32-bit toolchain for MSVC has many of these functions as `static inline` functions in header files so there's not actually a symbol for Rust to call. All of the implementations just cast floats to their 64-bit variants and then cast back to 32-bit at the end, so the standard library now takes this strategy.