rust/library/core/src
Manish Goregaokar 6b09d60f82
Rollup merge of #103378 - nagisa:fix-infinite-offset, r=scottmcm
Fix mod_inv termination for the last iteration

On usize=u64 platforms, the 4th iteration would overflow the `mod_gate` back to 0. Similarly for usize=u32 platforms, the 3rd iteration would overflow much the same way.

I tested various approaches to resolving this, including approaches with `saturating_mul` and `widening_mul` to a double usize. Turns out LLVM likes `mul_with_overflow` the best. In fact now, that LLVM can see the iteration count is limited, it will happily unroll the loop into a nice linear sequence.

You will also notice that the code around the loop got simplified somewhat. Now that LLVM is handling the loop nicely, there isn’t any more reasons to manually unroll the first iteration out of the loop (though looking at the code today I’m not sure all that complexity was necessary in the first place).

Fixes #103361
2022-11-18 17:48:16 -05:00
..
alloc Remove the old ValidAlign name 2022-11-11 21:44:27 -08:00
array document and improve array Guard type 2022-11-08 00:13:26 +01:00
async_iter use consistent terminology 2022-10-29 09:23:12 +02:00
cell Move/rename lazy::{OnceCell, Lazy} to cell::{OnceCell, LazyCell} 2022-06-16 19:53:59 +04:00
char Rollup merge of #102470 - est31:stabilize_const_char_convert, r=joshtriplett 2022-11-14 19:26:15 +01:00
convert Rollup merge of #102628 - H4x5:master, r=scottmcm 2022-10-04 06:14:12 +02:00
ffi Rollup merge of #103680 - RalfJung:cstr-links, r=JohnTitor 2022-11-04 12:18:00 +01:00
fmt Remove unused diagnostic items 2022-11-13 18:49:21 +00:00
future Auto merge of #104219 - bryangarza:async-track-caller-dup, r=eholk 2022-11-17 13:47:03 +00:00
hash Test const Hash, fix nits 2022-11-08 17:39:40 +01:00
intrinsics Add support for custom MIR parsing 2022-11-08 23:13:15 -08:00
iter document and improve array Guard type 2022-11-08 00:13:26 +01:00
macros Readd the matches_macro diag item 2022-11-17 19:32:28 +01:00
mem Auto merge of #104054 - RalfJung:byte-provenance, r=oli-obk 2022-11-15 17:37:15 +00:00
num Auto merge of #102935 - ajtribick:display-float-0.5-fixed-0, r=scottmcm 2022-11-16 07:20:30 +00:00
ops Rollup merge of #104383 - WaffleLapkin:rustc_undiagnostic_item, r=compiler-errors 2022-11-15 01:40:44 +01:00
panic Change tracking issue from #76156 to #102911 2022-10-11 06:40:37 +00:00
prelude Rollup merge of #102049 - fee1-dead-contrib:derive_const, r=oli-obk 2022-11-12 12:02:50 +05:30
ptr Rollup merge of #103378 - nagisa:fix-infinite-offset, r=scottmcm 2022-11-18 17:48:16 -05:00
slice Rollup merge of #102977 - lukas-code:is-sorted-hrtb, r=m-ou-se 2022-11-18 17:48:16 -05:00
str - convert from core::arch to core::simd 2022-11-15 18:30:31 +01:00
sync Remove extra spaces 2022-10-19 23:54:00 +01:00
task Added tracking issue 2022-09-19 15:07:12 +02:00
unicode Bump Unicode to version 15.0.0, regenerate tables 2022-09-14 13:21:19 -07:00
any.rs Add Provider::{would_be_satisfied_by_value_of,would_be_satisfied_by_ref_of} 2022-08-23 10:48:59 -04:00
ascii.rs Inline <EscapeDefault as Iterator>::next 2022-03-10 15:35:22 +01:00
asserting.rs [RFC 2011] Library code 2022-05-22 07:18:32 -03:00
bool.rs Add missing assertion 2022-09-22 02:12:06 -04:00
borrow.rs Add const_traits 2022-09-16 11:48:42 +08:00
cell.rs Rollup merge of #104002 - RalfJung:unsafecell-new, r=JohnTitor 2022-11-06 08:35:27 +01:00
clone.rs update cfg(bootstrap)s 2022-07-01 15:48:23 +02:00
cmp.rs Use derive_const and rm manual StructuralEq impl 2022-11-12 12:57:10 +00:00
const_closure.rs Merge conflicts and rebase onto master 2022-11-05 18:05:44 +00:00
default.rs cfg-step code 2022-11-06 17:21:21 -05:00
error.md Small round of typo fixes 2022-11-04 20:06:18 -07:00
error.rs Bump version placeholders to release 2022-11-06 17:11:02 -05:00
hint.rs Bump version placeholders to release 2022-11-06 17:11:02 -05:00
internal_macros.rs ignore a doctest for the non-exported macro 2022-05-03 18:33:56 +09:00
intrinsics.rs Auto merge of #103858 - Mark-Simulacrum:bump-bootstrap, r=pietroalbini 2022-11-14 00:07:19 +00:00
lib.rs Rollup merge of #102470 - est31:stabilize_const_char_convert, r=joshtriplett 2022-11-14 19:26:15 +01:00
marker.rs Add rustc_deny_explicit_impl 2022-11-14 03:23:41 +00:00
option.rs Bump version placeholders to release 2022-11-06 17:11:02 -05:00
panic.rs Fix clippy and rustdoc 2022-11-13 22:58:20 +00:00
panicking.rs cfg-step code 2022-11-06 17:21:21 -05:00
pin.rs Update tests to match error message changes 2022-10-20 16:43:27 +01:00
primitive_docs.rs array docs - advertise how to get array from slice 2022-09-10 19:37:07 -07:00
primitive.rs mv std libs to library/ 2020-07-27 19:51:13 -05:00
result.rs Auto merge of #98354 - camsteffen:is-some-and-by-value, r=m-ou-se 2022-10-02 12:48:15 +00:00
time.rs Bump version placeholders to release 2022-11-06 17:11:02 -05:00
tuple.rs const Compare Tuples 2022-11-09 09:52:04 +01:00
unit.rs Use implicit capture syntax in format_args 2022-03-10 10:23:40 -05:00