rust/src
bors 81601cd3a3 Auto merge of #37306 - bluss:trusted-len, r=alexcrichton
Add Iterator trait TrustedLen to enable better FromIterator / Extend

This trait attempts to improve FromIterator / Extend code by enabling it to trust the iterator to produce an exact number of elements, which means that reallocation needs to happen only once and is moved out of the loop.

`TrustedLen` differs from `ExactSizeIterator` in that it attempts to include _more_ iterators by allowing for the case that the iterator's len does not fit in `usize`. Consumers must check for this case (for example they could panic, since they can't allocate a collection of that size).

For example, chain can be TrustedLen and all numerical ranges can be TrustedLen. All they need to do is to report an exact size if it fits in `usize`, and `None` as the upper bound otherwise.

The trait describes its contract like this:

```
An iterator that reports an accurate length using size_hint.

The iterator reports a size hint where it is either exact
(lower bound is equal to upper bound), or the upper bound is `None`.
The upper bound must only be `None` if the actual iterator length is
larger than `usize::MAX`.

The iterator must produce exactly the number of elements it reported.

This trait must only be implemented when the contract is upheld.
Consumers of this trait must inspect `.size_hint()`’s upper bound.
```

Fixes #37232
2016-11-04 10:40:30 -07:00
..
bootstrap Use quieter test output when running tests on Travis CI. 2016-10-30 17:31:17 -04:00
build_helper run rustfmt on various folders 2016-10-16 15:41:01 +05:30
compiler-rt@f03ba5a4e8 Update src/compiler-rt to incoporate fix for UB in floatsidf. Fix #36518. 2016-09-29 13:54:06 +02:00
doc Rollup merge of #37495 - buntine:master, r=steveklabnik 2016-11-01 16:15:52 +01:00
driver
etc Add libproc_macro from local rust to stage0 2016-10-19 00:12:42 -07:00
grammar
jemalloc@e058ca6616
liballoc run rustfmt on various folders 2016-10-16 15:41:01 +05:30
liballoc_jemalloc Add Fuchsia support 2016-10-22 07:08:06 -07:00
liballoc_system Print out the error when HeapFree failures do occur 2016-10-25 10:00:16 -04:00
libarena Auto merge of #37270 - Mark-Simulacrum:smallvec-optimized-arenas, r=eddyb 2016-10-26 03:47:55 -07:00
libbacktrace
libcollections Auto merge of #37306 - bluss:trusted-len, r=alexcrichton 2016-11-04 10:40:30 -07:00
libcollectionstest Auto merge of #37212 - srinivasreddy:libcollectionstest, r=nrc 2016-10-27 22:02:31 -07:00
libcompiler_builtins Don't build any native compiler-builtin components for emscripten 2016-09-30 14:04:09 -07:00
libcore Auto merge of #37306 - bluss:trusted-len, r=alexcrichton 2016-11-04 10:40:30 -07:00
libcoretest Merge branch 'master' of https://github.com/rust-lang/rust 2016-11-01 15:26:22 +01:00
libflate Use fast decompression in deflate_bytes. 2016-10-20 15:08:01 +11:00
libfmt_macros
libgetopts Changed most vec! invocations to use square braces 2016-10-31 22:51:40 +00:00
libgraphviz Changed most vec! invocations to use square braces 2016-10-31 22:51:40 +00:00
liblibc@7d9b71f097 Support for aarch64 architecture on Fuchsia 2016-10-24 16:58:35 -07:00
liblog run rustfmt on liblog 2016-10-12 23:45:03 +05:30
libpanic_abort
libpanic_unwind run rustfmt on libpanic_unwind 2016-10-18 23:09:47 +05:30
libproc_macro Move CrateConfig from Crate to ParseSess. 2016-10-29 07:52:58 +00:00
libproc_macro_plugin Split up libproc_macro_plugin 2016-10-28 12:17:17 +13:00
libproc_macro_tokens Split up libproc_macro_plugin 2016-10-28 12:17:17 +13:00
librand Changed most vec! invocations to use square braces 2016-10-31 22:51:40 +00:00
librustc Auto merge of #37167 - nikomatsakis:jroesch-issue-18937, r=pnkfelix 2016-11-04 07:20:44 -07:00
librustc_back Changed most vec! invocations to use square braces 2016-10-31 22:51:40 +00:00
librustc_bitflags std: Stabilize and deprecate APIs for 1.13 2016-10-03 10:34:34 -07:00
librustc_borrowck Rollup merge of #37498 - sanxiyn:unused-type-alias, r=eddyb 2016-11-02 15:09:42 -04:00
librustc_const_eval Changed most vec! invocations to use square braces 2016-10-31 22:51:40 +00:00
librustc_const_math Stabilise ? 2016-10-12 08:40:22 +13:00
librustc_data_structures Auto merge of #36306 - nagisa:mir-local-cleanup, r=eddyb 2016-11-03 22:58:55 -07:00
librustc_driver Auto merge of #36306 - nagisa:mir-local-cleanup, r=eddyb 2016-11-03 22:58:55 -07:00
librustc_errors pacify the mercilous tidy 2016-11-01 14:08:56 -04:00
librustc_incremental Rollup merge of #37513 - michaelwoerister:hash-panic-spans, r=nikomatsakis 2016-11-02 15:09:42 -04:00
librustc_lint Auto merge of #37167 - nikomatsakis:jroesch-issue-18937, r=pnkfelix 2016-11-04 07:20:44 -07:00
librustc_llvm run rustfmt on librustc_llvm folder 2016-10-22 18:37:35 +05:30
librustc_metadata Changed most vec! invocations to use square braces 2016-10-31 22:51:40 +00:00
librustc_mir A way to remove otherwise unused locals from MIR 2016-11-03 06:17:01 +02:00
librustc_passes Auto merge of #37378 - petrochenkov:nopat, r=eddyb 2016-10-29 05:41:05 -07:00
librustc_platform_intrinsics
librustc_plugin Changed most vec! invocations to use square braces 2016-10-31 22:51:40 +00:00
librustc_privacy Remove outdated fixme comment. 2016-10-28 19:35:30 -06:00
librustc_resolve Rollup merge of #37498 - sanxiyn:unused-type-alias, r=eddyb 2016-11-02 15:09:42 -04:00
librustc_save_analysis Changed most vec! invocations to use square braces 2016-10-31 22:51:40 +00:00
librustc_trans Auto merge of #36306 - nagisa:mir-local-cleanup, r=eddyb 2016-11-03 22:58:55 -07:00
librustc_typeck Auto merge of #37167 - nikomatsakis:jroesch-issue-18937, r=pnkfelix 2016-11-04 07:20:44 -07:00
librustc_unicode std: Correct stability attributes for some implementations 2016-10-01 23:58:14 +01:00
librustdoc Changed most vec! invocations to use square braces 2016-10-31 22:51:40 +00:00
libserialize Changed most vec! invocations to use square braces 2016-10-31 22:51:40 +00:00
libstd Auto merge of #37037 - Mark-Simulacrum:stack-error, r=alexcrichton 2016-11-04 03:38:18 -07:00
libsyntax Changed most vec! invocations to use square braces 2016-10-31 22:51:40 +00:00
libsyntax_ext Changed most vec! invocations to use square braces 2016-10-31 22:51:40 +00:00
libsyntax_pos retool EarlyLint to track a Diagnostic 2016-11-01 14:07:45 -04:00
libterm Stabilise ? 2016-10-12 08:40:22 +13:00
libtest Changed most vec! invocations to use square braces 2016-10-31 22:51:40 +00:00
libunwind Add Fuchsia support 2016-10-22 07:08:06 -07:00
llvm@c1d962263b LLVM: Update submodule to rust-llvm-2016-10-29 branch. 2016-10-29 18:56:20 +03:00
rt Address comments and add requested tests 2016-09-03 13:39:35 +03:00
rtstartup Rename static mut to upper case 2016-10-14 17:21:11 +03:00
rust-installer@4f99485080 Update rust-installer. Fixes #36451 2016-10-05 00:17:30 +00:00
rustc Use workspaces and switch to a single Cargo.lock. 2016-10-07 12:04:32 -07:00
rustllvm LLVM: Update submodule to rust-llvm-2016-10-29 branch. 2016-10-29 18:56:20 +03:00
test Auto merge of #37167 - nikomatsakis:jroesch-issue-18937, r=pnkfelix 2016-11-04 07:20:44 -07:00
tools std: Flatten the num directory to reflect the module layout 2016-11-01 17:08:24 +00:00
Cargo.lock Add rustc_data_structures to rustc_driver dependencies. 2016-10-30 19:14:18 -04:00
Cargo.toml Use workspaces and switch to a single Cargo.lock. 2016-10-07 12:04:32 -07:00
stage0.txt Allow bootstrapping without a key. Fixes #36548 2016-10-19 01:23:01 +00:00