rust/src
bors 95979dcfb2 Auto merge of #51601 - Emerentius:step_by_range_diet, r=sfackler
Specialize StepBy<Range(Inclusive)>

Part of #51557, related to #43064, #31155

As discussed in the above issues, `step_by` optimizes very badly on ranges which is related to
1. the special casing of the first `StepBy::next()` call
2. the need to do 2 additions of `n - 1` and `1` inside the range's `next()`

This PR eliminates both by overriding `next()` to always produce the current element and also step ahead by `n` elements in one go. The generated code is much better, even identical in the case of a `Range` with constant `start` and `end` where `start+step` can't overflow. Without constant bounds it's a bit longer than the manual loop. `RangeInclusive` doesn't optimize as nicely but is still much better than the original asm.
Unsigned integers optimize better than signed ones for some reason.

See the following two links for a comparison.

[godbolt: specialization for ..](https://godbolt.org/g/haHLJr)
[godbolt: specialization for ..=](https://godbolt.org/g/ewyMu6)

`RangeFrom`, the only other range with an `Iterator` implementation can't be specialized like this without changing behaviour due to overflow. There is no way to save "finished-ness".

The approach can not be used in general, because it would produce side effects of the underlying iterator too early.

May obsolete #51435, haven't checked.
2018-06-21 08:55:13 +00:00
..
bootstrap Auto merge of #51367 - oli-obk:silence!_I_test_you, r=Mark-Simulacrum 2018-06-19 15:05:19 +00:00
build_helper
ci [beta] Prepare 1.28.0 beta release 2018-06-20 07:48:06 -06:00
dlmalloc@c99638dc2e
doc Update books for next release 2018-06-18 10:34:48 -06:00
etc slightly improve rustdoc xml path error 2018-06-04 09:51:41 +02:00
grammar
jemalloc@1f5a28755e
liballoc Rename OOM to allocation error 2018-06-18 21:41:24 +02:00
liballoc_jemalloc Mark alloc_jemalloc as perma-unstable 2018-06-11 13:48:57 -07:00
liballoc_system Move Unstable Book sections for #[global_allocator] and System to std::alloc docs 2018-06-11 13:48:57 -07:00
libarena Make &Slice a thin pointer 2018-05-27 17:28:35 +02:00
libbacktrace@f4d02bbdbf Replace libbacktrace with a submodule 2018-05-30 05:58:23 -07:00
libcompiler_builtins@4cfd7101eb update libcompiler_builtins 2018-05-13 07:14:36 +02:00
libcore Auto merge of #51601 - Emerentius:step_by_range_diet, r=sfackler 2018-06-21 08:55:13 +00:00
libfmt_macros Improve format string errors 2018-05-10 09:09:58 -07:00
libgraphviz
liblibc@a7e78a78e1
libpanic_abort
libpanic_unwind NetBSD on EABI ARM does not use ARM EHABI 2018-05-18 09:29:58 -05:00
libproc_macro Update recursion limits 2018-06-01 14:56:01 +02:00
libprofiler_builtins
librustc Replace tempdir by tempfile in librustc 2018-06-20 19:28:27 +02:00
librustc_allocator Remove alloc::Opaque and use *mut u8 as pointer type for GlobalAlloc 2018-06-11 13:47:23 -07:00
librustc_apfloat Comment typo 2018-04-30 18:18:32 +02:00
librustc_asan Remove some '#[feature]' attributes for stabilized features 2018-06-11 13:48:57 -07:00
librustc_borrowck Parallel code 2018-06-19 03:19:48 +02:00
librustc_codegen_llvm Fix tidy 2018-06-20 19:28:27 +02:00
librustc_codegen_utils rustc: rename ty::maps to ty::query. 2018-06-14 18:05:12 +03:00
librustc_cratesio_shim rustc_target: move in syntax::abi and flip dependency. 2018-04-26 17:49:16 +03:00
librustc_data_structures Add MTRef and a lock_mut function to MTLock 2018-06-19 03:19:50 +02:00
librustc_driver Auto merge of #51383 - Zoxc:parallel-stuff, r=nikomatsakis 2018-06-19 06:51:18 +00:00
librustc_errors Also prevent overflow in debug builds 2018-06-03 11:24:58 +02:00
librustc_incremental Save query results and the dep graph in parallel 2018-06-19 03:19:49 +02:00
librustc_lint Auto merge of #51425 - QuietMisdreavus:thats-def-a-namespace-there, r=petrochenkov 2018-06-17 09:48:10 +00:00
librustc_llvm Rename trans to codegen everywhere. 2018-05-17 15:08:30 +03:00
librustc_lsan Remove some '#[feature]' attributes for stabilized features 2018-06-11 13:48:57 -07:00
librustc_metadata Update the error message for a missing global allocator 2018-06-19 20:16:43 +02:00
librustc_mir Auto merge of #51651 - spastorino:fix_var_name_in_e0502, r=nikomatsakis 2018-06-20 12:46:15 +00:00
librustc_msan Remove some '#[feature]' attributes for stabilized features 2018-06-11 13:48:57 -07:00
librustc_passes rustc: rename ty::maps to ty::query. 2018-06-14 18:05:12 +03:00
librustc_platform_intrinsics
librustc_plugin Pass crate editions to macro expansions, update tests 2018-05-17 23:13:09 +03:00
librustc_privacy Auto merge of #51414 - oli-obk:impl_trait_type_def, r=pnkfelix 2018-06-18 14:34:52 +00:00
librustc_resolve Auto merge of #51414 - oli-obk:impl_trait_type_def, r=pnkfelix 2018-06-18 14:34:52 +00:00
librustc_save_analysis Add existential type definitons 2018-06-07 17:33:53 +02:00
librustc_target musl: don't use the included startfiles with -crt-static 2018-05-31 12:01:50 +02:00
librustc_traits rustc: rename ty::maps to ty::query. 2018-06-14 18:05:12 +03:00
librustc_tsan Remove some '#[feature]' attributes for stabilized features 2018-06-11 13:48:57 -07:00
librustc_typeck Auto merge of #51383 - Zoxc:parallel-stuff, r=nikomatsakis 2018-06-19 06:51:18 +00:00
librustdoc Fix tidy 2018-06-20 19:28:27 +02:00
libserialize
libstd Remove erroneous example of main as a non-Result function. 2018-06-19 18:32:44 -04:00
libstd_unicode
libsyntax Auto merge of #51278 - EPashkin:fix_mod_with_multilevel_paths_on_windows, r=nikomatsakis 2018-06-19 02:17:52 +00:00
libsyntax_ext Add ability to apply custom derive to union types. 2018-06-18 21:34:11 -04:00
libsyntax_pos Auto merge of #51414 - oli-obk:impl_trait_type_def, r=pnkfelix 2018-06-18 14:34:52 +00:00
libterm
libtest Remove leftover tab in libtest outputs 2018-05-02 08:35:33 +02:00
libunwind NetBSD on EABI ARM does not use ARM EHABI 2018-05-18 09:29:58 -05:00
llvm@9ad4b7e8d7 more reverts 2018-05-24 16:22:58 +02:00
llvm-emscripten@2717444753
rtstartup Switch to 1.26 bootstrap compiler 2018-05-17 08:47:25 -06:00
rustc Fix rustc binary metadata overwriting librustc metadata 2018-05-17 08:47:25 -06:00
rustllvm Rollup merge of #50827 - nox:llvmup, r=eddyb 2018-05-20 04:16:01 +08:00
stdsimd@a19ca1cd91 rever tool changes 2018-05-24 16:21:23 +02:00
test Auto merge of #51651 - spastorino:fix_var_name_in_e0502, r=nikomatsakis 2018-06-20 12:46:15 +00:00
tools Auto merge of #51662 - Mark-Simulacrum:beta-next, r=Mark-Simulacrum 2018-06-21 04:02:57 +00:00
Cargo.lock Replace tempdir by tempfile in librustc 2018-06-20 19:28:27 +02:00
Cargo.toml Change the comment on opt-level = 2 to point to https://github.com/rust-lang/rust/issues/50867 2018-05-29 17:38:23 +02:00
README.md rustc: rename ty::maps to ty::query. 2018-06-14 18:05:12 +03:00
stage0.txt [beta] Prepare 1.28.0 beta release 2018-06-20 07:48:06 -06:00

This directory contains the source code of the rust project, including:

  • rustc and its tests
  • libstd
  • Various submodules for tools, like rustdoc, rls, etc.

For more information on how various parts of the compiler work, see the rustc guide.

Their is also useful content in the following READMEs, which are gradually being moved over to the guide: