summary refs log tree commit diff
path: root/src/libcore
AgeCommit message (Collapse)AuthorLines
2017-10-08Rollup merge of #45081 - tamird:fmt-cleanup, r=alexcrichtonkennytm-7/+6
fmt: misc cleanup
2017-10-08Rollup merge of #45053 - GuillaumeGomez:atomicbool-doc, r=QuietMisdreavuskennytm-5/+12
Add missing links for AtomicBool r? @rust-lang/docs
2017-10-08Rollup merge of #45042 - brennie:brennie/fmt-trait-summaries, r=steveklabnikkennytm-8/+8
Update trait summaries for std::fmt This patch is part of #29355. r? @steveklabnik
2017-10-07fmt: remove misleading comment fragmentTamir Duberstein-1/+1
2017-10-07fmt: DRYTamir Duberstein-5/+5
2017-10-07fmt: remove unnecessary lint suppressionTamir Duberstein-1/+0
2017-10-05Add missing links for AtomicBoolGuillaume Gomez-5/+12
2017-10-05Auto merge of #44943 - nivkner:fixme_fixup, r=dtolnaybors-80/+10
address some FIXME whose associated issues were marked as closed part of #44366
2017-10-04Update trait summaries for std::fmtBarret Rennie-8/+8
This patch is part of #29355.
2017-10-04seperate and move miscellaneous benchmarks to librustcNiv Kaminer-69/+0
2017-10-02update books for next releasesteveklabnik-3/+3
Also fixes some stdlib links to the reference which have changed.
2017-10-01Auto merge of #44897 - Havvy:doc-size_of, r=steveklabnikbors-0/+78
Docs for size_of::<#[repr(C)]> items. Most of this info comes from camlorn's blog post on optimizing struct layout and the Rustonomicon. I don't really like my wording in the first paragraph. I also cannot find a definition of what `#[repr(C)]` does for enums that have variants with fields. They're allowed, unlike `#[repr(C)] enum`s with no variants.
2017-09-30Auto merge of #44936 - Mark-Simulacrum:rollup, r=Mark-Simulacrumbors-14/+93
Rollup of 15 pull requests - Successful merges: #44124, #44287, #44320, #44694, #44708, #44794, #44797, #44824, #44836, #44840, #44845, #44854, #44889, #44900, #44903 - Failed merges:
2017-09-30address some `FIXME`s whose associated issues were marked as closedNiv Kaminer-11/+10
remove FIXME(#13101) since `assert_receiver_is_total_eq` stays. remove FIXME(#19649) now that stability markers render. remove FIXME(#13642) now the benchmarks were moved. remove FIXME(#6220) now that floating points can be formatted. remove FIXME(#18248) and write tests for `Rc<str>` and `Rc<[u8]>` remove reference to irelevent issues in FIXME(#1697, #2178...) update FIXME(#5516) to point to getopts issue 7 update FIXME(#7771) to point to RFC 628 update FIXME(#19839) to point to issue 26925
2017-09-29Rollup merge of #44900 - Havvy:normalize-lang-attribute-spacing, r=sfacklerMark Simulacrum-3/+3
Normalize spaces in lang attributes. So, like, I grepped for all `lang` attributes for *reasons* and I noticed that they all share the same spacing of `#[lang = "item_name"]` except these five instances. So I decided to fix that. So enjoy this PR of exactly ten spaces.
2017-09-29Rollup merge of #44854 - lucasem:atomic-docs, r=steveklabnikMark Simulacrum-1/+25
docs improvement sync::atomic::Atomic* Addresses the `Atomic*` part of #29377. r? @steveklabnik
2017-09-29Rollup merge of #44840 - steveklabnik:fix-wording, r=BurntSushiMark Simulacrum-1/+1
Improve wording for StepBy No other iterator makes the distinction between an iterator and an iterator adapter in its summary line, so change it to be consistent with all other adapters.
2017-09-29Rollup merge of #44836 - GuillaumeGomez:fmt-missing-links, r=QuietMisdreavusMark Simulacrum-4/+8
Add missing links in fmt module r? @rust-lang/docs
2017-09-29Rollup merge of #44824 - dtolnay:22really21, r=alexcrichtonMark Simulacrum-5/+5
Backport libs stabilizations to 1.21 beta Includes the following stabilizations: - tcpstream_connect_timeout https://github.com/rust-lang/rust/pull/44563 - iterator_for_each https://github.com/rust-lang/rust/pull/44567 - ord_max_min https://github.com/rust-lang/rust/pull/44593 - compiler_fences https://github.com/rust-lang/rust/pull/44595 - needs_drop https://github.com/rust-lang/rust/pull/44639 - vec_splice https://github.com/rust-lang/rust/pull/44640 These have been backported in https://github.com/rust-lang/rust/pull/44823.
2017-09-29Rollup merge of #44287 - Eh2406:master, r=aturonMark Simulacrum-0/+51
Allow T op= &T for built-in numeric types T v2 Manually rebase of @Migi https://github.com/rust-lang/rust/pull/41336
2017-09-29Auto merge of #44174 - jimmycuadra:try-from-infallible, r=sfacklerbors-48/+63
Add blanket TryFrom impl when From is implemented. Adds `impl<T, U> TryFrom<T> for U where U: From<T>`. Removes `impl<'a, T> TryFrom<&'a str> for T where T: FromStr` (originally added in #40281) due to overlapping impls caused by the new blanket impl. This removal is to be discussed further on the tracking issue for TryFrom. Refs #33417. /cc @sfackler, @scottmcm (thank you for the help!), and @aturon
2017-09-29Fix more TryFrom impls for integers.Jimmy Cuadra-4/+4
2017-09-29Simplify implementation of From<Infallible> for TryFromIntError.Jimmy Cuadra-2/+3
2017-09-29Auto merge of #42526 - huntiep:try_opt, r=nikomatsakisbors-1/+84
Impl Try for Option This is part of #31436.
2017-09-29Auto merge of #44856 - cuviper:more-fold, r=dtolnaybors-33/+471
Add more custom folding to `core::iter` adaptors Many of the iterator adaptors will perform faster folds if they forward to their inner iterator's folds, especially for inner types like `Chain` which are optimized too. The following types are newly specialized: | Type | `fold` | `rfold` | | ----------- | ------ | ------- | | `Enumerate` | ✓ | ✓ | | `Filter` | ✓ | ✓ | | `FilterMap` | ✓ | ✓ | | `FlatMap` | exists | ✓ | | `Fuse` | ✓ | ✓ | | `Inspect` | ✓ | ✓ | | `Peekable` | ✓ | N/A¹ | | `Skip` | ✓ | N/A² | | `SkipWhile` | ✓ | N/A¹ | ¹ not a `DoubleEndedIterator` ² `Skip::next_back` doesn't pull skipped items at all, but this couldn't be avoided if `Skip::rfold` were to call its inner iterator's `rfold`. Benchmarks ---------- In the following results, plain `_sum` computes the sum of a million integers -- note that `sum()` is implemented with `fold()`. The `_ref_sum` variants do the same on a `by_ref()` iterator, which is limited to calling `next()` one by one, without specialized `fold`. The `chain` variants perform the same tests on two iterators chained together, to show a greater benefit of forwarding `fold` internally. test iter::bench_enumerate_chain_ref_sum ... bench: 2,216,264 ns/iter (+/- 29,228) test iter::bench_enumerate_chain_sum ... bench: 922,380 ns/iter (+/- 2,676) test iter::bench_enumerate_ref_sum ... bench: 476,094 ns/iter (+/- 7,110) test iter::bench_enumerate_sum ... bench: 476,438 ns/iter (+/- 3,334) test iter::bench_filter_chain_ref_sum ... bench: 2,266,095 ns/iter (+/- 6,051) test iter::bench_filter_chain_sum ... bench: 745,594 ns/iter (+/- 2,013) test iter::bench_filter_ref_sum ... bench: 889,696 ns/iter (+/- 1,188) test iter::bench_filter_sum ... bench: 667,325 ns/iter (+/- 1,894) test iter::bench_filter_map_chain_ref_sum ... bench: 2,259,195 ns/iter (+/- 353,440) test iter::bench_filter_map_chain_sum ... bench: 1,223,280 ns/iter (+/- 1,972) test iter::bench_filter_map_ref_sum ... bench: 611,607 ns/iter (+/- 2,507) test iter::bench_filter_map_sum ... bench: 611,610 ns/iter (+/- 472) test iter::bench_fuse_chain_ref_sum ... bench: 2,246,106 ns/iter (+/- 22,395) test iter::bench_fuse_chain_sum ... bench: 634,887 ns/iter (+/- 1,341) test iter::bench_fuse_ref_sum ... bench: 444,816 ns/iter (+/- 1,748) test iter::bench_fuse_sum ... bench: 316,954 ns/iter (+/- 2,616) test iter::bench_inspect_chain_ref_sum ... bench: 2,245,431 ns/iter (+/- 21,371) test iter::bench_inspect_chain_sum ... bench: 631,645 ns/iter (+/- 4,928) test iter::bench_inspect_ref_sum ... bench: 317,437 ns/iter (+/- 702) test iter::bench_inspect_sum ... bench: 315,942 ns/iter (+/- 4,320) test iter::bench_peekable_chain_ref_sum ... bench: 2,243,585 ns/iter (+/- 12,186) test iter::bench_peekable_chain_sum ... bench: 634,848 ns/iter (+/- 1,712) test iter::bench_peekable_ref_sum ... bench: 444,808 ns/iter (+/- 480) test iter::bench_peekable_sum ... bench: 317,133 ns/iter (+/- 3,309) test iter::bench_skip_chain_ref_sum ... bench: 1,778,734 ns/iter (+/- 2,198) test iter::bench_skip_chain_sum ... bench: 761,850 ns/iter (+/- 1,645) test iter::bench_skip_ref_sum ... bench: 478,207 ns/iter (+/- 119,252) test iter::bench_skip_sum ... bench: 315,614 ns/iter (+/- 3,054) test iter::bench_skip_while_chain_ref_sum ... bench: 2,486,370 ns/iter (+/- 4,845) test iter::bench_skip_while_chain_sum ... bench: 633,915 ns/iter (+/- 5,892) test iter::bench_skip_while_ref_sum ... bench: 666,926 ns/iter (+/- 804) test iter::bench_skip_while_sum ... bench: 444,405 ns/iter (+/- 571)
2017-09-28Remove conflicting TryFrom impls on 32-bit targets.Jimmy Cuadra-2/+2
2017-09-28Remove link duplication.Havvy-3/+3
2017-09-28Auto merge of #44790 - clarcharr:zip_bytes, r=sfacklerbors-2/+26
TrustedRandomAccess specialisation for Iterator::cloned when Item: Copy. This should fix #44424. It also provides a potential fix for more iterators using `Iterator::cloned`.
2017-09-28Normalize spaces in lang attributes.Havvy-3/+3
2017-09-27Backticks.Havvy-1/+1
2017-09-27Docs for size_of::<#[repr(C)]> items.Havvy-0/+78
Most of this info comes from camlorn's blog post on optimizing struct layout and the Rustonomicon.
2017-09-27Rename option::Missing to NoneErrorHunter Praska-10/+13
2017-09-27Add docs for Missing, correct Option's Try testHunter Praska-3/+3
2017-09-27Add tests for Option and Result Try implHunter Praska-0/+57
2017-09-27Impl Try for OptionHunter Praska-1/+24
2017-09-27Auto merge of #44709 - Badel2:inclusive-range-dotdoteq, r=petrochenkovbors-47/+50
Initial support for `..=` syntax #28237 This PR adds `..=` as a synonym for `...` in patterns and expressions. Since `...` in expressions was never stable, we now issue a warning. cc @durka r? @aturon
2017-09-25Add more custom folding to `core::iter` adaptorsJosh Stone-33/+471
Many of the iterator adaptors will perform faster folds if they forward to their inner iterator's folds, especially for inner types like `Chain` which are optimized too. The following types are newly specialized: | Type | `fold` | `rfold` | | ----------- | ------ | ------- | | `Enumerate` | ✓ | ✓ | | `Filter` | ✓ | ✓ | | `FilterMap` | ✓ | ✓ | | `FlatMap` | exists | ✓ | | `Fuse` | ✓ | ✓ | | `Inspect` | ✓ | ✓ | | `Peekable` | ✓ | N/A¹ | | `Skip` | ✓ | N/A² | | `SkipWhile` | ✓ | N/A¹ | ¹ not a `DoubleEndedIterator` ² `Skip::next_back` doesn't pull skipped items at all, but this couldn't be avoided if `Skip::rfold` were to call its inner iterator's `rfold`. Benchmarks ---------- In the following results, plain `_sum` computes the sum of a million integers -- note that `sum()` is implemented with `fold()`. The `_ref_sum` variants do the same on a `by_ref()` iterator, which is limited to calling `next()` one by one, without specialized `fold`. The `chain` variants perform the same tests on two iterators chained together, to show a greater benefit of forwarding `fold` internally. test iter::bench_enumerate_chain_ref_sum ... bench: 2,216,264 ns/iter (+/- 29,228) test iter::bench_enumerate_chain_sum ... bench: 922,380 ns/iter (+/- 2,676) test iter::bench_enumerate_ref_sum ... bench: 476,094 ns/iter (+/- 7,110) test iter::bench_enumerate_sum ... bench: 476,438 ns/iter (+/- 3,334) test iter::bench_filter_chain_ref_sum ... bench: 2,266,095 ns/iter (+/- 6,051) test iter::bench_filter_chain_sum ... bench: 745,594 ns/iter (+/- 2,013) test iter::bench_filter_ref_sum ... bench: 889,696 ns/iter (+/- 1,188) test iter::bench_filter_sum ... bench: 667,325 ns/iter (+/- 1,894) test iter::bench_filter_map_chain_ref_sum ... bench: 2,259,195 ns/iter (+/- 353,440) test iter::bench_filter_map_chain_sum ... bench: 1,223,280 ns/iter (+/- 1,972) test iter::bench_filter_map_ref_sum ... bench: 611,607 ns/iter (+/- 2,507) test iter::bench_filter_map_sum ... bench: 611,610 ns/iter (+/- 472) test iter::bench_fuse_chain_ref_sum ... bench: 2,246,106 ns/iter (+/- 22,395) test iter::bench_fuse_chain_sum ... bench: 634,887 ns/iter (+/- 1,341) test iter::bench_fuse_ref_sum ... bench: 444,816 ns/iter (+/- 1,748) test iter::bench_fuse_sum ... bench: 316,954 ns/iter (+/- 2,616) test iter::bench_inspect_chain_ref_sum ... bench: 2,245,431 ns/iter (+/- 21,371) test iter::bench_inspect_chain_sum ... bench: 631,645 ns/iter (+/- 4,928) test iter::bench_inspect_ref_sum ... bench: 317,437 ns/iter (+/- 702) test iter::bench_inspect_sum ... bench: 315,942 ns/iter (+/- 4,320) test iter::bench_peekable_chain_ref_sum ... bench: 2,243,585 ns/iter (+/- 12,186) test iter::bench_peekable_chain_sum ... bench: 634,848 ns/iter (+/- 1,712) test iter::bench_peekable_ref_sum ... bench: 444,808 ns/iter (+/- 480) test iter::bench_peekable_sum ... bench: 317,133 ns/iter (+/- 3,309) test iter::bench_skip_chain_ref_sum ... bench: 1,778,734 ns/iter (+/- 2,198) test iter::bench_skip_chain_sum ... bench: 761,850 ns/iter (+/- 1,645) test iter::bench_skip_ref_sum ... bench: 478,207 ns/iter (+/- 119,252) test iter::bench_skip_sum ... bench: 315,614 ns/iter (+/- 3,054) test iter::bench_skip_while_chain_ref_sum ... bench: 2,486,370 ns/iter (+/- 4,845) test iter::bench_skip_while_chain_sum ... bench: 633,915 ns/iter (+/- 5,892) test iter::bench_skip_while_ref_sum ... bench: 666,926 ns/iter (+/- 804) test iter::bench_skip_while_sum ... bench: 444,405 ns/iter (+/- 571)
2017-09-25docs improvement sync::atomic::Atomic*Lucas Morales-1/+25
2017-09-25Improve wording for StepBysteveklabnik-1/+1
No other iterator makes the distinction between an iterator and an iterator adapter in its summary line, so change it to be consistent with all other adapters.
2017-09-25Add missing links in fmt moduleGuillaume Gomez-4/+8
2017-09-24Backport libs stabilizations to 1.21 betaDavid Tolnay-5/+5
This includes the following stabilizations: - tcpstream_connect_timeout https://github.com/rust-lang/rust/pull/44563 - iterator_for_each https://github.com/rust-lang/rust/pull/44567 - ord_max_min https://github.com/rust-lang/rust/pull/44593 - compiler_fences https://github.com/rust-lang/rust/pull/44595 - needs_drop https://github.com/rust-lang/rust/pull/44639 - vec_splice https://github.com/rust-lang/rust/pull/44640
2017-09-23Add back mistakenly removed numeric conversions.Jimmy Cuadra-4/+4
2017-09-23Simplify implementation of Display and Error for convert::Infallible.Jimmy Cuadra-2/+3
2017-09-23TrustedRandomAccess specialisation for Cloned.Clar Charr-2/+26
This verifies that TrustedRandomAccess has no side effects when the iterator item implements Copy. This also implements TrustedLen and TrustedRandomAccess for str::Bytes.
2017-09-23Rollup merge of #44770 - dtolnay:borrowed, r=sfacklerCorey Farwell-1/+11
Less confusing placeholder when RefCell is exclusively borrowed Based on ExpHP's comment in [*RefCell.borrow_mut get strange result*](https://users.rust-lang.org/t/refcell-borrow-mut-get-strange-result/12994): > it would perhaps be nicer if it didn't put something that could be misinterpreted as a valid string value The previous Debug implementation would show: RefCell { value: "<borrowed>" } The new one is: RefCell { value: <borrowed> }
2017-09-23Rollup merge of #44658 - leodasvacas:remove-str-eq-lang-item, r=arielb1Corey Farwell-3/+0
Remove str_eq lang item It's not really a lang item. Also remove outdated note. The reference uses this as an example so it has to be updated.
2017-09-23Rollup merge of #44648 - Havvy:doc-size_of, r=dtolnayCorey Farwell-2/+46
Expand size_of docs This PR does 3 things. 1. Adds a description of what pointer size means to the primitive pages for usize and isize. 2. Says the general size of things is not stable from compiler to compiler. 3. Adds a table of sizes of things that we do guarantee. As this is the first table in the libstd docs, I've included a picture of how that looks. ![](https://i.imgur.com/YZ6IChH.png?1)
2017-09-22Substitute `...` with the expanded formBadel2-9/+8
RangeInclusive { start, end }, this way we supress the warnings about `...` in expressions being deprecated until `..=` is available in the compiler
2017-09-22Add support for `..=` syntaxAlex Burka-41/+45
Add ..= to the parser Add ..= to libproc_macro Add ..= to ICH Highlight ..= in rustdoc Update impl Debug for RangeInclusive to ..= Replace `...` to `..=` in range docs Make the dotdoteq warning point to the ... Add warning for ... in expressions Updated more tests to the ..= syntax Updated even more tests to the ..= syntax Updated the inclusive_range entry in unstable book
2017-09-21Less confusing placeholder when RefCell is exclusively borrowedDavid Tolnay-1/+11
Based on ExpHP's comment in https://users.rust-lang.org/t/refcell-borrow-mut-get-strange-result/12994 > it would perhaps be nicer if it didn't put something that could be > misinterpreted as a valid string value The previous Debug implementation would show: RefCell { value: "<borrowed>" } The new one is: RefCell { value: <borrowed> }