about summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2016-11-30Use more specific panic message for &str slicing errorsUlrik Sverdrup-4/+22
Separate out of bounds errors from character boundary errors, and print more details for character boundary errors. Example: &"abcαβγ"[..4] thread 'str::test_slice_fail_boundary_1' panicked at 'byte index 4 is not a char boundary; it is inside `α` (bytes 3..5) of `abcαβγ`'
2016-11-30Add cloned example for OptionGuillaume Gomez-0/+10
2016-11-30Rename 'librustc_unicode' crate to 'libstd_unicode'.Corey Farwell-1/+1
Fixes #26554.
2016-11-28Make core::fmt::Void a non-empty type.Andrew Cann-1/+3
Because we handle artifically-constructed references to it in live code which is a totally broken thing to do.
2016-11-27Add borrow support for slice binary search methods.Christophe Biocca-9/+13
2016-11-26Auto merge of #36340 - sfackler:slice-get-slice, r=alexcrichtonbors-168/+331
Implement RFC 1679 cc #35729 r? @alexcrichton
2016-11-26Auto merge of #38008 - bluss:rustbuild-benches, r=alexcrichtonbors-0/+5
Add rustbuild command `bench` Add command bench to rustbuild, so that `./x.py bench <path>` can compile and run benchmarks. `./x.py bench --stage 1 src/libcollections` and `./x.py bench --stage 1 src/libstd` should both compile well. Just `./x.py bench` runs all benchmarks for the libstd crates. Fixes #37897
2016-11-26Overload get{,_mut}{,_unchecked}Steven Fackler-168/+331
2016-11-26Auto merge of #38015 - sanxiyn:rollup, r=sanxiynbors-4/+4
Rollup of 7 pull requests - Successful merges: #37962, #37963, #37967, #37978, #37985, #38001, #38010 - Failed merges:
2016-11-26Rollup merge of #37963 - bluss:iterator-docs, r=alexcrichtonSeo Sanghyeon-4/+4
Fix two small issues in iterator docs - `collect()` is a regular method, not an adaptor (does not return an Iterator). I just randomly picked `filter` as a third common adaptor to mention instead. - Fix example in `Map`'s docs so that it uses the DoubleEndedIterator implementation
2016-11-25Auto merge of #37961 - samestep:radices, r=frewsxcvbors-1/+1
Use "radices" instead of "radicum" The correct plural of "radix" is "radices" or "radixes", not "radicum".
2016-11-25rustbuild: Point to core and collections's external benchmarks.Ulrik Sverdrup-0/+5
2016-11-24Auto merge of #37944 - bluss:adaptors-are-empty, r=alexcrichtonbors-6/+57
Forward ExactSizeIterator::len and is_empty for important iterator adaptors Forward ExactSizeIterator::len and is_empty for important iterator adaptors Because some iterators will provide improved version of len and/or is_empty, adaptors should forward to those implementations if possible.
2016-11-24core: Unroll the loop in the slice iterator search methodsUlrik Sverdrup-0/+118
Introduce a helper method .search_while() that generalizes internal iteration (Iterator's all, find, position, fold and so on). The compiler does not unroll loops with conditional exits; we can do this manually instead to improve the performance of for example Iterator::find and Iterator::position when used on the slice iterators. The unrolling is patterned on libstdc++'s implementation of std::find_if.
2016-11-24core: Add ptrdistance to slice moduleUlrik Sverdrup-3/+10
2016-11-24core: Convert utility macros for the slice iterator into a traitUlrik Sverdrup-11/+57
Use an extension trait for the slice iterator's pointer manipulations.
2016-11-24Auto merge of #37943 - bluss:exact-is-empty, r=alexcrichtonbors-2/+10
Implement better .is_empty() for slice and vec iterators These iterators can use a pointer comparison instead of computing the length.
2016-11-23Use "radices" instead of "radicum"Sam Estep-1/+1
2016-11-23core: Fix example for .map()Ulrik Sverdrup-1/+1
Make the example use DoubleEndedIterator for map, like it said it would.
2016-11-23core: Iterator docs, collect is not an adaptorUlrik Sverdrup-3/+3
2016-11-23core, collections: Implement better .is_empty() for slice and vec iteratorsUlrik Sverdrup-2/+10
These iterators can use a pointer comparison instead of computing the length.
2016-11-22core: Forward ExactSizeIterator methods for important iterator adaptorsUlrik Sverdrup-6/+57
2016-11-22utf8 validation: Cleanup code by renaming index variableUlrik Sverdrup-15/+15
2016-11-22utf8 validation: Cleanup code in the ascii fast pathUlrik Sverdrup-6/+4
2016-11-22Auto merge of #37834 - bluss:peek-none, r=BurntSushibors-23/+41
Make Peekable remember peeking a None Peekable should remember if a None has been seen in the `.peek()` method. It ensures that `.peek(); .peek();` or `.peek(); .next();` only advances the underlying iterator at most once. This does not by itself make the iterator fused. Thanks to @s3bk for the code in `fn peek()` itself. Fixes #37784
2016-11-21utf8 validation: Compute block end upfrontUlrik Sverdrup-15/+16
Simplify the conditional used for ensuring that the whole word loop is only used if there are at least two whole words left to read. This makes the function slightly smaller and simpler, a 0-5% reduction in runtime for various test cases.
2016-11-20Auto merge of #37888 - bluss:chars-count, r=alexcrichtonbors-0/+16
Improve .chars().count() Use a simpler loop to count the `char` of a string: count the number of non-continuation bytes. Use `count += <conditional>` which the compiler understands well and can apply loop optimizations to. benchmark descriptions and results for two configurations: - ascii: ascii text - cy: cyrillic text - jp: japanese text - words ascii: counting each split_whitespace item from the ascii text - words jp: counting each split_whitespace item from the jp text ``` x86-64 rustc -Copt-level=3 name orig_ ns/iter cmov_ ns/iter diff ns/iter diff % count_ascii 1,453 (1755 MB/s) 1,398 (1824 MB/s) -55 -3.79% count_cy 5,990 (856 MB/s) 2,545 (2016 MB/s) -3,445 -57.51% count_jp 3,075 (1169 MB/s) 1,772 (2029 MB/s) -1,303 -42.37% count_words_ascii 4,157 (521 MB/s) 1,797 (1205 MB/s) -2,360 -56.77% count_words_jp 3,337 (1071 MB/s) 1,772 (2018 MB/s) -1,565 -46.90% x86-64 rustc -Ctarget-feature=+avx -Copt-level=3 name orig_ ns/iter cmov_ ns/iter diff ns/iter diff % count_ascii 1,444 (1766 MB/s) 763 (3343 MB/s) -681 -47.16% count_cy 5,871 (874 MB/s) 1,527 (3360 MB/s) -4,344 -73.99% count_jp 2,874 (1251 MB/s) 1,073 (3351 MB/s) -1,801 -62.67% count_words_ascii 4,131 (524 MB/s) 1,871 (1157 MB/s) -2,260 -54.71% count_words_jp 3,253 (1099 MB/s) 1,331 (2686 MB/s) -1,922 -59.08% ``` I briefly explored a more involved blocked algorithm (looking at 8 or more bytes at a time), but the code in this PR was always winning `count_words_ascii` in particular (counting many small strings); this solution is an improvement without tradeoffs.
2016-11-20Rollup merge of #37882 - ollie27:chars_last, r=blussGuillaume Gomez-0/+12
Optimise Chars::last() The default implementation of last() goes through the entire iterator but that's not needed here.
2016-11-20Optimise CharIndices::last()Oliver Middleton-0/+6
The default implementation of last() goes through the entire iterator but that's not needed here.
2016-11-19str: Improve .chars().count()Ulrik Sverdrup-0/+16
Use a simpler loop to count the `char` of a string: count the number of non-continuation bytes. Use `count += <conditional>` which the compiler understands well and can apply loop optimizations to.
2016-11-19Optimise Chars::last()Oliver Middleton-0/+6
The default implementation of last() goes through the entire iterator but that's not needed here.
2016-11-18Fix `fmt::Debug` for strings, e.g. for Chinese charactersTobias Bucher-97/+230
The problem occured due to lines like ``` 3400;<CJK Ideograph Extension A, First>;Lo;0;L;;;;;N;;;;; 4DB5;<CJK Ideograph Extension A, Last>;Lo;0;L;;;;;N;;;;; ``` in `UnicodeData.txt`, which the script previously interpreted as two characters, although it represents the whole range. Fixes #34318.
2016-11-17core::iter: Peekable should remember peeking a NoneUlrik Sverdrup-23/+41
Peekable must remember if a None has been seen in the `.peek()` method. It ensures that `.peek(); .peek();` or `.peek(); .next();` only advances the underlying iterator at most once. This does not by itself make the iterator fused.
2016-11-12Remove macro work-around.Mark-Simulacrum-8/+3
2016-11-12Rollup merge of #37727 - GuillaumeGomez:invalid_src, r=eddybEduard-Mihai Burtescu-2/+15
Fix invalid src url Fixes #37684. Thanks to @eddyb's help. r? @eddyb
2016-11-12Rollup merge of #37716 - GuillaumeGomez:mem_urls, r=@frewsxcvEduard-Mihai Burtescu-16/+23
Mem urls r? @steveklabnik
2016-11-12Rollup merge of #37698 - GuillaumeGomez:marker_urls, r=brsonEduard-Mihai Burtescu-21/+21
Add missing urls for marker's traits r? @steveklabnik
2016-11-12Rollup merge of #37669 - GuillaumeGomez:always_urls, r=brsonEduard-Mihai Burtescu-7/+15
Add missing urls for FusedIterator and TrustedLen traits r? @steveklabnik
2016-11-12Rollup merge of #37662 - wesleywiser:intrinsics_docs, r=aturonEduard-Mihai Burtescu-0/+418
Add documentation to some of the unstable intrinsics Part of #34338
2016-11-12Fix invalid src urlGuillaume Gomez-2/+15
2016-11-11Add missing urls for mem moduleGuillaume Gomez-16/+23
2016-11-10Add missing urls for marker's traitsGuillaume Gomez-21/+21
2016-11-10Add missing urls for FusedIterator and TrustedLen traitsGuillaume Gomez-7/+15
2016-11-09Rollup merge of #37627 - GuillaumeGomez:missing_urls_bis, r=frewsxcvEduard-Mihai Burtescu-54/+92
Add missing urls and few local rewrites r? @steveklabnik
2016-11-09Rollup merge of #37472 - joshtriplett:doc-fmt-write-io-write, r=brsonEduard-Mihai Burtescu-0/+30
Document convention for using both fmt::Write and io::Write Using a trait's methods (like `Write::write_fmt` as used in `writeln!` and other macros) requires importing that trait directly (not just the module containing it). Both `fmt::Write` and `io::Write` provide compatible `Write::write_fmt` methods, and code can use `writeln!` and other macros on both an object implementing `fmt::Write` (such as a `String`) and an object implementing `io::Write` (such as `Stderr`). However, importing both `Write` traits produces an error due to the name conflict. The convention I've seen renames both of them on import, to `FmtWrite` and `IoWrite` respectively. Document that convention in the Rust documentation for `write!` and `writeln!`, with examples.
2016-11-08Add documentation for some of the add/sub/mul intrinsicsWesley Wiser-0/+18
Part of #34338
2016-11-08Add documentation for the `volatile_read` and `volatile_write` intrinsicsWesley Wiser-0/+4
Part of #34338
2016-11-08Add documentation for many of the atomic_* intrinsicsWesley Wiser-0/+396
Part of #34338
2016-11-08Add missing urls and few local rewritesGuillaume Gomez-54/+92
2016-11-08Add missing urls for Sum and Product traitsGuillaume Gomez-8/+16