-
-
Notifications
You must be signed in to change notification settings - Fork 14.2k
Add a compiler intrinsic to back bigint_helper_methods
#133663
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
r? @ibraheemdev rustbot has assigned @ibraheemdev. Use |
|
Some changes occurred to the intrinsics. Make sure the CTFE / Miri interpreter cc @rust-lang/miri, @rust-lang/wg-const-eval |
f52a909 to
09a8f68
Compare
|
Will take a look at this later, but I like that you managed to make fallback intrinsics work here when I couldn't quite get them to work for #132195. |
09a8f68 to
acbeaa2
Compare
|
☔ The latest upstream changes (presumably #133728) made this pull request unmergeable. Please resolve the merge conflicts. |
|
Also just to clarify my opinion on where this stands relative to #132195: I think that this PR just adding the intrinsic is okay, although I would like the intrinsic to also handle the signed case, even if it's only used at the moment for the unsigned case. That way, my PR can just update the library methods to use the intrinsic, without having to worry about the slow implementation. Although the signed version of the library methods will likely return an unsigned word always for the least-significant / high-order part, it vastly simplifies the intrinsic to just have the same type for the arguments and return value, so, I would prefer that we do this specifically for the intrinsic. Since it doesn't actually affect the returned bits, I think that it's okay to just cast half of it unsigned on the library side. You can see how I did this here in a previous (closed) PR. Otherwise, LGTM. Also, while the codegen test should suffice, if you want to copy over the library tests I added in my PR to verify that the intrinsic works correctly, feel free. I specifically added a bunch of edge cases with |
acbeaa2 to
c67e5f4
Compare
|
Success! No more "oh my this is hacky", just a couple of
It didn't, actually. Once the fallback was working, the implementation in cg_llvm was super-easy -- after all, at that level the signed and unsigned types are the same anyway. |
This comment has been minimized.
This comment has been minimized.
c67e5f4 to
5d91169
Compare
This comment has been minimized.
This comment has been minimized.
| let high = self.trunc(high, narrow_llty); | ||
|
|
||
| let pair_llty = self.type_struct(&[narrow_llty, narrow_llty], false); | ||
| let pair = self.const_poison(pair_llty); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just comparing to my version, this doesn't really matter that much, but const_undef feels slightly more accurate here just semantically. Not actually sure if this affects codegen though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
poison is always preferred where possible, because it doesn't have the same complications as undef. (undef << 1) & 1 is guaranteed to be 0, but (poison << 1) & 1 is still poison. You'll also see that both what we emit for tuples and what the optimizer does for tuples both use poison for this: https://rust.godbolt.org/z/WTnW4GPE6
ee18903 to
f636b64
Compare
| /// => (2²ⁿ - 2ⁿ⁺¹ + 1) + (2ⁿ⁺¹ - 2) | ||
| /// => 2²ⁿ - 1 | ||
| /// | ||
| /// For `iN`, the upper bound is MIN * MIN + MAX + MAX => 2²ⁿ⁻² + 2ⁿ - 2, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pop Quiz: after a double-width isize::MIN * isize::MIN (which is the largest possible positive result from a multiplication), how many more isize::MAXs can you add to the result before it would need to carry to triple-width?
Answer: isize::MAX + 2 of them!
(The carrying_mul_add really feels so much nicer for unsigned types, since uN::MAX * uN::MAX + uN::MAX + uN::MAX == u2N::MAX -- no more space available after that.)
|
This is outside my territory so I'm going to pass this along. r? libs |
|
☔ The latest upstream changes (presumably #134516) made this pull request unmergeable. Please resolve the merge conflicts. |
f636b64 to
0c1cc9e
Compare
Add a compiler intrinsic to back `bigint_helper_methods` cc rust-lang#85532 This adds a new `carrying_mul_add` intrinsic, to implement `wide_mul` and `carrying_mul`. It has fallback MIR for all types -- including `u128`, which isn't currently supported on nightly -- so that it'll continue to work on all backends, including CTFE. Then it's overridden in `cg_llvm` to use wider intermediate types, including `i256` for `u128::carrying_mul`.
This comment has been minimized.
This comment has been minimized.
|
💔 Test failed - checks-actions |
Including implementing it for `u128`, so it can be defined in `uint_impl!`. This way it works for all backends, including CTFE.
0c1cc9e to
4669c0d
Compare
|
Fix was just changing some @bors r=Amanieu |
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#133663 (Add a compiler intrinsic to back `bigint_helper_methods`) - rust-lang#134798 (Make `ty::Error` implement all auto traits) - rust-lang#134808 (compiletest: Remove empty 'expected' files when blessing) - rust-lang#134809 (Add `--no-capture`/`--nocapture` as bootstrap arguments) - rust-lang#134826 (Add spastorino to users_on_vacation) - rust-lang#134828 (Add clubby789 back to bootstrap review rotation) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#133663 - scottmcm:carrying_mul_add, r=Amanieu Add a compiler intrinsic to back `bigint_helper_methods` cc rust-lang#85532 This adds a new `carrying_mul_add` intrinsic, to implement `wide_mul` and `carrying_mul`. It has fallback MIR for all types -- including `u128`, which isn't currently supported on nightly -- so that it'll continue to work on all backends, including CTFE. Then it's overridden in `cg_llvm` to use wider intermediate types, including `i256` for `u128::carrying_mul`.
Add a compiler intrinsic to back `bigint_helper_methods` cc rust-lang#85532 This adds a new `carrying_mul_add` intrinsic, to implement `wide_mul` and `carrying_mul`. It has fallback MIR for all types -- including `u128`, which isn't currently supported on nightly -- so that it'll continue to work on all backends, including CTFE. Then it's overridden in `cg_llvm` to use wider intermediate types, including `i256` for `u128::carrying_mul`.
…iaskrgr Rollup of 6 pull requests Successful merges: - rust-lang#133663 (Add a compiler intrinsic to back `bigint_helper_methods`) - rust-lang#134798 (Make `ty::Error` implement all auto traits) - rust-lang#134808 (compiletest: Remove empty 'expected' files when blessing) - rust-lang#134809 (Add `--no-capture`/`--nocapture` as bootstrap arguments) - rust-lang#134826 (Add spastorino to users_on_vacation) - rust-lang#134828 (Add clubby789 back to bootstrap review rotation) r? `@ghost` `@rustbot` modify labels: rollup
Tidy up bigint multiplication methods This tidies up the library version of the bigint multiplication methods after the addition of the intrinsics in rust-lang#133663. It follows [this summary](rust-lang#85532 (comment)) of what's desired for these methods. Note that, if `2H = N`, then `uH::MAX * uH::MAX + uH::MAX + uH::MAX` is `uN::MAX`, and that we can effectively add two "carry" values without overflowing. For ease of terminology, the "low-order" or "least significant" or "wrapping" half of multiplication will be called the low part, and the "high-order" or "most significant" or "overflowing" half of multiplication will be called the high part. In all cases, the return convention is `(low, high)` and left unchanged by this PR, to be litigated later. ## API Changes The original API: ```rust impl uN { // computes self * rhs pub const fn widening_mul(self, rhs: uN) -> (uN, uN); // computes self * rhs + carry pub const fn carrying_mul(self, rhs: uN, carry: uN) -> (uN, uN); } ``` The added API: ```rust impl uN { // computes self * rhs + carry1 + carry2 pub const fn carrying2_mul(self, rhs: uN, carry: uN, add: uN) -> (uN, uN); } impl iN { // note that the low part is unsigned pub const fn widening_mul(self, rhs: iN) -> (uN, iN); pub const fn carrying_mul(self, rhs: iN, carry: iN) -> (uN, iN); pub const fn carrying_mul_add(self, rhs: iN, carry: iN, add: iN) -> (uN, iN); } ``` Additionally, a naive implementation has been added for `u128` and `i128` since there are no double-wide types for those. Eventually, an intrinsic will be added to make these more efficient, but rather than doing this all at once, the library changes are added first. ## Justifications for API The unsigned parts are done to ensure consistency with overflowing addition: for a two's complement integer, you want to have unsigned overflow semantics for all parts of the integer except the highest one. This is because overflow for unsigned integers happens on the highest bit (from `MAX` to zero), whereas overflow for signed integers happens on the second highest bit (from `MAX` to `MIN`). Since the sign information only matters in the highest part, we use unsigned overflow for everything but that part. There is still discussion on the merits of signed bigint *addition* methods, since getting the behaviour right is very subtle, but at least for signed bigint *multiplication*, the sign of the operands does make a difference. So, it feels appropriate that at least until we've nailed down the final API, there should be an option to do signed versions of these methods. Additionally, while it's unclear whether we need all three versions of bigint multiplication (widening, carrying-1, and carrying-2), since it's possible to have up to two carries without overflow, there should at least be a method to allow that. We could potentially only offer the carry-2 method and expect that adding zero carries afterword will optimise correctly, but again, this can be litigated before stabilisation. ## Note on documentation While a lot of care was put into the documentation for the `widening_mul` and `carrying_mul` methods on unsigned integers, I have not taken this same care for `carrying_mul_add` or the signed versions. While I have updated the doc tests to be more appropriate, there will likely be many documentation changes done before stabilisation. ## Note on tests Alongside this change, I've added several tests to ensure that these methods work as expected. These are alongside the codegen tests for the intrinsics.
b102eb97611 Rollup merge of #135003 - RalfJung:deprecate-allowed-through-unstable, r=davidtwco
09ccac89813 Rollup merge of #132654 - joboet:lazy_main, r=ChrisDenton
9a5f11b6bdc Auto merge of #135525 - jhpratt:rollup-4gu2wpm, r=jhpratt
808a28bb2e5 Rollup merge of #134678 - zachs18:offset-ptr-update, r=tgross35
038b55923da Rollup merge of #134338 - tgross35:overflowing-c-safe-ret, r=bjorn3,antoyo
afb7906d983 Rollup merge of #134143 - nyurik:err-nul, r=dtolnay
09f7f735638 intrinsics: deprecate calling them via the unstable std::intrinsics path
b1bab8efb30 Update ReadDir::next in std::sys::pal::unix::fs to use `&raw const (*ptr).field` instead of `ptr.offset(...).cast()`.
6b3eb0e11bc Update compiler-builtins to 0.1.143
c26fde2487d Rollup merge of #135423 - compiler-errors:enforce-const-trait-syntactical, r=oli-obk,RalfJung
d4e61054fa0 Enforce syntactical stability of const traits in HIR
8cba3108c65 Update compiler-builtins to 0.1.141
72304171451 add comments explaining main thread identification
de1528ca1d5 std: lazily allocate the main thread handle
7d65632251e Revert "Remove the Arc rt::init allocation for thread info"
1938ccffee3 Auto merge of #135473 - matthiaskrgr:rollup-ksnst4l, r=matthiaskrgr
e57af4cc513 Rollup merge of #135381 - cod10129:vec-splice-doc, r=tgross35
4b1f813eb19 Auto merge of #135359 - RalfJung:lang-start-unwind, r=joboet
3a1522edb09 Auto merge of #135465 - jhpratt:rollup-7p93bct, r=jhpratt
d68853badd5 Rollup merge of #135393 - Ayush1325:uefi-helper-path, r=thomcc
2583e5e939e Add another `Vec::splice` example
e53c5c9c5db uefi: helpers: Introduce OwnedDevicePath
f17b1628cec Rollup merge of #135405 - Ayush1325:path-is-absolute, r=tgross35
41ac367ffc7 path: Move is_absolute check to sys::path
44a9def9f39 Auto merge of #135420 - GuillaumeGomez:rollup-93vepka, r=GuillaumeGomez
242154d7a56 Auto merge of #135384 - saethlin:inline-copy-from-slice, r=joboet
d76bc765c20 Update the explanation for why we use box_new in vec!
a8314e3425d Auto merge of #135402 - matthiaskrgr:rollup-cz7hs13, r=matthiaskrgr
736f71506f1 Rollup merge of #135379 - steffahn:uniquerc-invariant, r=Mark-Simulacrum
f1fd86b54fa Add inherent versions of MaybeUninit methods for slices
50cffd12adb Add #[inline] to copy_from_slice
221253c726d Auto merge of #135360 - RalfJung:structural-partial-eq, r=compiler-errors
8853a8d51d2 Make UniqueRc invariant for soundness
5c997f2acdc avoid nesting the user-defined main so deeply on the stack
1f09d97cbf0 use a single large catch_unwind in lang_start
3093827de07 update and clarify StructuralPartialEq docs
e2f8a108b9a Rename `pos` to `position`
c6dff32f287 Convert `struct FromBytesWithNulError` into enum
e47fc56aa4a Rollup merge of #135347 - samueltardieu:push-qvyxtxsqyxyr, r=jhpratt
d8923fc714a Rollup merge of #135324 - Ayush1325:uefi-fs-unsupported, r=joboet
9709d9bad5d Rollup merge of #135236 - scottmcm:more-mcp807-library-updates, r=ChrisDenton
849afc40e34 Improve the safety documentation on new_unchecked
2add857ca03 Use `NonNull::without_provenance` within the standard library
2764b7e14ab alloc: remove unsound `IsZero` for raw pointers
c577821efe2 Rollup merge of #134693 - SpriteOvO:proc-macro-use-to-tokens-in-quote, r=tgross35
7dbc3bcab16 Rollup merge of #132607 - YohDeadfall:pthread-name-fn-with-result, r=tgross35
ab71837c330 Update a bunch of library types for MCP807
4052574937d Initial fs module for uefi
946c19e04cb Rollup merge of #134908 - madsmtm:ptr-from_ref-docs, r=ibraheemdev
01372432cbb Rollup merge of #134619 - hkBst:patch-7, r=jhpratt
c22148b767f Fix `proc_macro::quote!` for raw ident
c421c1a946a Append `TokenTree` with `ToTokens` in `proc_macro::quote!`
c283b86cc76 Used pthread name functions returning result for FreeBSD and DragonFly
668cb10cba5 Auto merge of #135268 - pietroalbini:pa-bump-stage0, r=Mark-Simulacrum
f3f0119335a Rollup merge of #135269 - estebank:unneeded-into, r=compiler-errors
d7dd4a6bc58 Rollup merge of #135242 - RalfJung:nonnull-provenance, r=jhpratt
a34edcbbb60 Remove some unnecessary `.into()` calls
661c077ae5b fmt
9d29620a31a update cfg(bootstrap)
60fa1562951 update version placeholders
c0e33bf31ca add missing provenance APIs on NonNull
830ee4bb4d6 Rollup merge of #135176 - kornelski:env-example, r=cuviper
790735e2a6d Rollup merge of #134389 - rust-wasi-web:condvar-no-threads, r=m-ou-se
b3fa835baa8 Rollup merge of #133057 - tisonkun:into-chars, r=Amanieu
3987eb22905 Avoid naming variables `str`
7c71ffcfa97 Rollup merge of #135139 - c410-f3r:8-years-rfc, r=jhpratt
6536ec2d9b0 Rollup merge of #131830 - hoodmane:emscripten-wasm-eh, r=workingjubilee
e44be94c9eb More compelling env_clear() examples
5db91e58005 Rollup merge of #135153 - crystalstall:master, r=workingjubilee
cb8cf0fa5d0 Add support for wasm exception handling to Emscripten target
a1da07b21df chore: remove redundant words in comment
b2b55f6bdae Rollup merge of #135111 - tgross35:float-doc-aliases, r=Noratrieb
0bd45849186 [generic_assert] Constify methods used by the formatting system
c200a189c66 Rollup merge of #135121 - okaneco:const_slice_reverse, r=jhpratt
e03872bb30a Mark `slice::reverse` unstably const
0e581b92097 Clarified the documentation on core::iter::from_fn and core::iter::successors
320482169fb Rollup merge of #135110 - matthiaskrgr:adler, r=workingjubilee
e7ca1049aa7 Rollup merge of #135104 - the8472:disable-in-place-iter-for-flatten, r=Mark-Simulacrum
8ffc4e84463 Rollup merge of #134996 - bdbai:uwp-support, r=jieyouxu,ChrisDenton
fee42729979 Add doc aliases for `libm` and IEEE names
f4b33a3e46f library: fix adler{-> 2}.debug
2e05379f866 add regression test for unsound Flatten/FlatMap specialization
9467350f844 do not in-place-iterate over flatmap/flatten
6346a915b55 Rollup merge of #135091 - workingjubilee:backtrace-0.3.75, r=workingjubilee
3ef2891d388 Rollup merge of #135070 - klensy:backtrace-deps, r=workingjubilee
24366d36dce Rollup merge of #135046 - RalfJung:rustc_box_intrinsic, r=compiler-errors
307f559c6c4 Rollup merge of #133964 - joboet:select_unpredictable, r=tgross35
0b2fd26bdc8 Bump backtrace to 0.3.75
3d624d66f11 Rollup merge of #133420 - thesummer:rtems-unwind, r=workingjubilee
6137ccc52ac sync to actual dep verions of backtrace
318269a33f4 turn rustc_box into an intrinsic
bd743cec036 Auto merge of #135059 - matthiaskrgr:rollup-0ka9o3h, r=matthiaskrgr
e74ac082b32 Rollup merge of #134241 - liigo:patch-16, r=dtolnay
53e41a6a5a7 Auto merge of #134692 - GrigorenkoPV:sync_poision, r=tgross35
366ac34fa96 Fix UWP build
cd6c49f49b5 Bump backtrace to rust-lang/backtrace-rs@4d7906b
98ee6c8c68c Auto merge of #122565 - Zoxc:atomic-panic-msg, r=the8472
ffaa2184220 path in detail
aa0e6e8bd1a Move some things to `std::sync::poison` and reexport them in `std::sync`
b8087f526a0 fix doc for missing Box allocator consistency
40434b2c26c Auto merge of #135005 - matthiaskrgr:rollup-5ubuitt, r=matthiaskrgr
32614550fb9 Rollup merge of #134985 - mgsloan:remove-unnecessary-qualification-in-Ord-trait-docs, r=Noratrieb
d5f262cc53a Rename the internal simpler `quote` macro to `minimal_quote`
6c8e14169a9 Auto merge of #134080 - kleisauke:avoid-lfs64-emscripten, r=Noratrieb
33b4b03fe6a Try to write the panic message with a single `write_all` call
8795c3547eb std::fs::DirEntry.metadata(): prefer use of lstat() on Emscripten
fb895251bd9 Avoid use of LFS64 symbols on Emscripten
ed5888769c6 Auto merge of #134969 - Marcondiro:master, r=jhpratt,programmerjake
c1b709541e2 Rollup merge of #131439 - mu001999-contrib:cleanup/static-mut, r=estebank
847cd898006 Remove qualification of `std::cmp::Ordering` in `Ord` doc
e38fc1b0843 Auto merge of #132195 - clarfonthey:bigint-mul, r=scottmcm
4f7e5a623be Auto merge of #134966 - matthiaskrgr:rollup-lmhmgsv, r=matthiaskrgr
aff952b674c char to_digit: avoid unnecessary casts to u64
9e0a6b0a3c4 Rollup merge of #134953 - DiuDiu777:unaligned-doc, r=RalfJung
b003e5812c2 Auto merge of #134620 - ChrisDenton:line-writer, r=tgross35
8b8fd2d5855 Rollup merge of #134930 - RalfJung:ptr-docs-valid-access, r=jhpratt
d487d12d362 Rollup merge of #134927 - DaniPopes:const-as_flattened_mut, r=scottmcm
bfe0d0f6000 fix doc for read write unaligned in zst operation
99ca6ca7611 Auto merge of #134757 - RalfJung:const_swap, r=scottmcm
316349488dc ptr docs: make it clear that we are talking only about memory accesses
b7b6a5d0649 Make slice::as_flattened_mut unstably const
0b1d0d95c67 Fix ptr::from_ref documentation example comment
f26cc531ab6 Rollup merge of #134884 - calciumbe:patch1, r=jieyouxu
b7620c7c1d9 Rollup merge of #134870 - geofft:patch-1, r=jhpratt
9adc4a11633 fix: typos
f5e949debed Rollup merge of #134851 - lukas-code:alloc-ffi, r=tgross35
309cb6599b7 Fix sentence fragment in `pin` module docs
d086afd99b8 docs: inline `alloc::ffi::c_str` types to `alloc::ffi`
15137457840 Auto merge of #134547 - SUPERCILEX:unify-copy, r=thomcc
5807d879643 Rollup merge of #134832 - tgross35:update-builtins, r=tgross35
c6c4ae7c842 Tidy up bigint mul methods
a9e94810233 Rollup merge of #134823 - chloefeal:fix, r=tgross35,dtolnay
0e23de8b41d Update library/alloc/tests/sort/tests.rs
c94032f1779 Update `compiler-builtins` to 0.1.140
a41400395c5 Rollup merge of #133663 - scottmcm:carrying_mul_add, r=Amanieu
764af3bad24 Override `carrying_mul_add` in cg_llvm
18ee1da10b9 Move `{widening, carrying}_mul` to an intrinsic with fallback MIR
559fdf03383 Fix typos
acfeed3d3df Auto merge of #134822 - jieyouxu:rollup-5xuaq82, r=jieyouxu
5fb4df97165 Rollup merge of #134819 - ChrisDenton:trunc, r=Mark-Simulacrum
68b148643ac Rollup merge of #134622 - ChrisDenton:write-file-utf8, r=Mark-Simulacrum
6f23131fac2 Rollup merge of #134606 - RalfJung:ptr-copy-docs, r=Mark-Simulacrum
e290e70bdc1 Auto merge of #134786 - ChrisDenton:fix-rename-symlink, r=tgross35
5cf455ff60d Fix renaming symlinks on Windows
0a3943e9496 Fix mistake in windows file open
051ece2a59c Rollup merge of #134791 - notriddle:notriddle/inline-ffi-error-types, r=tgross35
3a2ca84c46f Rollup merge of #134789 - betrusted-io:bump-unwinding-to-0.25.0, r=Mark-Simulacrum
3cbbd43963e Rollup merge of #134782 - wtlin1228:docs/iter-rposition, r=Mark-Simulacrum
1e8a843e7fd Rollup merge of #134728 - deltragon:barrier-doc, r=tgross35
9b632c12457 Rollup merge of #134649 - SUPERCILEX:statx-remember, r=thomcc
a9b12533594 Rollup merge of #134644 - kpreid:duplicates, r=Mark-Simulacrum
7d72bc6894b Rollup merge of #134379 - bjoernager:slice-as-array, r=dtolnay
c988c5c469a docs: inline `core::ffi::c_str` types to `core::ffi`
f3a43e876b3 docs: inline `std::ffi::c_str` types to `std::ffi`
ef9344328ea unwinding: bump version to fix asm
b5a7e1cb2c3 Impl FromIterator for tuples with arity 1-12
97a492b242e Fix formatting
7bb71817d2d docs: update code example for Iterator#rposition
838b01dae5e stabilize const_alloc_layout
7c4bb0b875d rename typed_swap → typed_swap_nonoverlapping
3d7df0fa2cb stabilize const_swap
adefdcb1aaf Auto merge of #134729 - oliveredget:typo, r=jieyouxu
a76414742c2 Auto merge of #134722 - ChrisDenton:trunc, r=Amanieu
7102c61d871 Auto merge of #134333 - daxpedda:stdarch-bump, r=daxpedda
781fb68dbba Fix compilation issues on other unixes
2b6589fec62 Bump `stdarch`
301f4c8ba3f chore: fix typos
b3642490a4a Use scoped threads in `std::sync::Barrier` examples
efbda65a57a Windows: Use FILE_ALLOCATION_INFO for truncation
0429732714d Rollup merge of #134689 - RalfJung:ptr-swap-test, r=oli-obk
f71f75d522a Rollup merge of #134662 - ionicmc-rs:any-safety-docs, r=Amanieu
6fc5a515b01 core: fix const ptr::swap_nonoverlapping when there are pointers at odd offsets in the type
2a7c4107dd3 Rollup merge of #134363 - estebank:derive-default, r=SparrowLii
6a41c5bd0cd Rollup merge of #134672 - Zalathar:revert-coverage-attr, r=wesleywiser
00523c6df55 Use `#[derive(Default)]` instead of manually implementing it
7a6c4cf81d9 Revert "Auto merge of #130766 - clarfonthey:stable-coverage-attribute, r=wesleywiser"
1d47e6a5af8 Auto merge of #134666 - matthiaskrgr:rollup-whe0chp, r=matthiaskrgr
47eacac789d Auto merge of #131311 - rust-lang:cargo_update, r=clubby789
08311d3b105 Rollup merge of #134642 - kpreid:pointerlike-cell, r=compiler-errors
49d33b15720 Rollup merge of #134583 - Enselic:maybe-uninit-transmute, r=workingjubilee
ce16d167b68 Rollup merge of #130289 - intgr-forks:Permissions-readonly-vs-unix-root, r=ChrisDenton
5ec57233686 Fixes safety docs for `dyn Any + Send {+ Sync}`
e31ed41f4ba Implement `PointerLike` for `isize`, `NonNull`, `Cell`, `UnsafeCell`, and `SyncUnsafeCell`.
736e842fc2a Auto merge of #134330 - scottmcm:no-more-rvalue-len, r=matthewjasper
1a45918d751 docs: Permissions.readonly() also ignores root user special permissions
e15ef644395 Improve prose around `as_slice` example of IterMut
d03b67c2429 Specify only that duplicates are discarded, not the order.
e70cbb149f5 Auto merge of #131193 - EFanZh:asserts-vec-len, r=the8472
619365dce13 Delete `Rvalue::Len`
f913021f500 docs: `transmute<&mut T, &mut MaybeUninit<T>>` is unsound when exposed to safe code
0233b4ec888 Impl String::into_chars
56cc86af99f Rollup merge of #134602 - kpreid:pointerlike-doc, r=tgross35
9549c0c5306 Fix forgetting to save statx availability on success
c50706f5f04 Auto merge of #134640 - matthiaskrgr:rollup-xlstm3o, r=matthiaskrgr
42621a94cbe Document collection `From` and `FromIterator` impls that drop duplicate keys.
22c6dcd7b19 Rollup merge of #134630 - fifty-six:master, r=workingjubilee
9c5420a144f Auto merge of #130733 - okaneco:is_ascii, r=scottmcm
a5f05c31739 cargo update
88936d663d5 Eliminate redundant statx syscalls
ae80bcc9736 Rollup merge of #134325 - theemathas:is_null-docs, r=RalfJung
37803ed66ad Rollup merge of #131072 - Fulgen301:windows-rename-posix-semantics, r=ChrisDenton
3edae543ffa Use `&raw` for `ptr` primitive docs
9f89bf55fb2 Unify fs::copy and io::copy
8f6317d2b8a Windows: Use WriteFile to write to a UTF-8 console
dca1911ca13 Avoid short writes in LineWriter
10f58801c5e Document CTFE behavior of methods that call is_null
52c70cefc4e Correctly document is_null CTFE behavior.
8240334bbea ptr::copy: fix docs for the overlapping case
3d7ea928c48 Rollup merge of #134593 - kornelski:less-unwrap, r=jhpratt
8d44917bb2b Rollup merge of #134579 - hkBst:patch-6, r=jhpratt
d1a3570e402 Rollup merge of #134577 - hkBst:patch-5, r=jhpratt
797d88a4f6e Rollup merge of #134576 - hkBst:patch-4, r=jhpratt
0d4f2977e8f Document `PointerLike` implementation restrictions.
39c036dacf9 Less unwrap() in documentation
9eacbacb845 Rollup merge of #123604 - michaelvanstraten:proc_thread_attribute_list, r=ChrisDenton
605e793d35f Rollup merge of #134573 - lukas-code:unimpl-dyn-pointerlike, r=compiler-errors
03b554d4296 Rollup merge of #134570 - hkBst:patch-3, r=joboet
cb9fd5abb2d Rollup merge of #134560 - RalfJung:miri-thread-spawn, r=jhpratt
8ef4e1708c6 Improve prose around into_slice example of IterMut
490893e4337 Improve prose around `as_slice` example of Iter
346bb96231a Improve prose around basic examples of Iter and IterMut
b2c67187209 remove reference to dangling from slice::Iter
8a76ac07549 fix `PointerLike` docs
ea624faa800 unimplement `PointerLike` for trait objects
0348754b8e8 split up `#[rustc_deny_explicit_impl]` attribute
83961772930 mri: add track_caller to thread spawning methods for better backtraces
47c18d11c25 Rollup merge of #134518 - hltj:typo-fix, r=tgross35
a407b54ba53 Rollup merge of #132830 - wr7:substr_range_documentation, r=tgross35
1e42e55ad7f Rollup merge of #126118 - jan-ferdinand:docs_for_vec_set_len, r=the8472
325c2c83a7d fix typos in the example code in the doc comments of `Ipv4Addr::from_bits()`, `Ipv6Addr::from_bits()` & `Ipv6Addr::to_bits()`
2a30c761db7 build: Update libc version
ff8e6c7266c Rollup merge of #134490 - hong9lol:typo, r=jhpratt
1ef2006c9ff Rollup merge of #132056 - weiznich:diagnostic_do_not_recommend_final_tests, r=compiler-errors
36dec866386 fix typo in ptr/mod.rs
ba3898d82f3 Auto merge of #134443 - joshtriplett:use-field-init-shorthand, r=lqd,tgross35,nnethercote
815119ea508 Rollup merge of #134452 - jalil-salame:fix-lazy-cell-docs, r=tgross35
e5a64b47a53 Add 'into_array' conversion destructors for 'Box', 'Rc', and 'Arc';
1e20f65b874 Implement Condvar::wait_timeout for targets without threads
0d4be900a97 Auto merge of #134425 - clubby789:cargo-update, r=jieyouxu
e94636ef1eb fix(LazyCell): documentation of get[_mut] was wrong
9552b94e220 Stabilize `#[diagnostic::do_not_recommend]`
8f6473ca201 Use field init shorthand where possible
4dd1bd84b80 Rollup merge of #134426 - hkBst:patch-3, r=lqd
439ea50e256 Rollup merge of #133265 - the8472:extract-if-ranges, r=cuviper
5b50e4a613b compiler & tools dependencies: Updating allocator-api2 v0.2.20 -> v0.2.21 Updating annotate-snippets v0.11.4 -> v0.11.5 Updating anyhow v1.0.93 -> v1.0.94 Updating bstr v1.11.0 -> v1.11.1 Updating chrono v0.4.38 -> v0.4.39 Updating clap v4.5.21 -> v4.5.23 Updating clap_builder v4.5.21 -> v4.5.23 Updating clap_complete v4.5.38 -> v4.5.39 Updating clap_lex v0.7.3 -> v0.7.4 Updating colored v2.1.0 -> v2.2.0 Updating console v0.15.8 -> v0.15.10 Updating crossbeam-channel v0.5.13 -> v0.5.14 Updating crossbeam-deque v0.8.5 -> v0.8.6 Updating crossbeam-utils v0.8.20 -> v0.8.21 Updating encode_unicode v0.3.6 -> v1.0.0 Updating fastrand v2.2.0 -> v2.3.0 Updating home v0.5.9 -> v0.5.11 Updating js-sys v0.3.74 -> v0.3.76 Updating libc v0.2.167 -> v0.2.168 Updating miniz_oxide v0.8.0 -> v0.8.1 Updating pest v2.7.14 -> v2.7.15 Updating pest_derive v2.7.14 -> v2.7.15 Updating pest_generator v2.7.14 -> v2.7.15 Updating pest_meta v2.7.14 -> v2.7.15 Updating redox_syscall v0.5.7 -> v0.5.8 Updating rustc-stable-hash v0.1.0 -> v0.1.1 Updating rustix v0.38.41 -> v0.38.42 Updating self_cell v1.0.4 -> v1.1.0 Updating semver v1.0.23 -> v1.0.24 Updating serde v1.0.215 -> v1.0.216 Updating serde_derive v1.0.215 -> v1.0.216 Adding thiserror v2.0.7 Adding thiserror-impl v2.0.7 Updating time v0.3.36 -> v0.3.37 Updating time-macros v0.2.18 -> v0.2.19 Updating tokio v1.41.1 -> v1.42.0 Updating wasm-bindgen v0.2.97 -> v0.2.99 Updating wasm-bindgen-backend v0.2.97 -> v0.2.99 Updating wasm-bindgen-macro v0.2.97 -> v0.2.99 Updating wasm-bindgen-macro-support v0.2.97 -> v0.2.99 Updating wasm-bindgen-shared v0.2.97 -> v0.2.99 Updating wasm-encoder v0.221.0 -> v0.221.2 Updating wasmparser v0.221.0 -> v0.221.2 Updating wast v221.0.0 -> v221.0.2 Updating wat v1.221.0 -> v1.221.2
fbac32d2761 Auto merge of #130766 - clarfonthey:stable-coverage-attribute, r=wesleywiser
f8d5f2f5031 Fix typo in uint_macros.rs
773ce8e12e0 Rollup merge of #134202 - nnethercote:rm-existing_doc_keyword, r=GuillaumeGomez
1ea6333e43b Remove `rustc::existing_doc_keyword` lint.
879b904eae9 Move `doc(keyword = "while")`.
d655fd187d6 Stabilize #[coverage] attribute
7adb8ab561b remove obsolete comment and pub(super) visibility
71740c5e592 remove bounds from vec and linkedlist ExtractIf
f5981cec754 Add a range argument to vec.extract_if
f0297f13dde Rollup merge of #134277 - notriddle:notriddle/inline-into, r=GuillaumeGomez
e88df256c16 Auto merge of #134332 - Zalathar:rollup-oe23hkw, r=Zalathar
93329f34b67 Rollup merge of #134310 - tkr-sh:master, r=Noratrieb
ab4f84cae3e Rollup merge of #133406 - EFanZh:lock-value-accessors, r=Noratrieb
69756988c15 Rollup merge of #130361 - devnexen:sock_cloexec_solaris, r=cuviper
114f5e2c405 Auto merge of #133223 - zachs18:uniquerc-impls, r=Noratrieb
cd6542897cb Asserts the maximum value that can be returned from `Vec::len`
9d2ca9a3477 Auto merge of #134258 - bjorn3:no_public_specialization, r=petrochenkov
66b6e751301 Rollup merge of #134022 - shahn:doc_clarify_extend_for_tuple_version, r=tgross35
3aa32597ed9 Rollup merge of #133986 - olishmollie:tracking-issue-127154-documentation, r=tgross35
b35e7babfbf Correct spelling of CURRENT_RUSTC_VERSION
dca96f2d618 Replace i32 by char in `split_at` & `_unchecked`
5c0062fd6ba Add clarity to the "greater" of `VecDeque::insert`
36d2006d1e1 Replace i32 by char to add clarity
f9d5fcf495e Auto merge of #134296 - matthiaskrgr:rollup-o0sxozj, r=matthiaskrgr
5416be5795f Add documentation for anonymous pipe module
bd52a6d6b8d Rollup merge of #133942 - BD103:black-box-docs, r=saethlin
1d8c71769ac Rollup merge of #134255 - bjoernager:master, r=Noratrieb
cd53ef86a04 Rollup merge of #134254 - hermit-os:hermit-c_char, r=workingjubilee
feb218aac4a Rollup merge of #134252 - hermit-os:hermit-is_absolute, r=tgross35
78ef2d597d4 rustdoc-search: let From and Into be unboxed
c1f85483921 Rollup merge of #134229 - purplesyringa:provenance-docs, r=saethlin
d03fb91bd4d Rollup merge of #134140 - compiler-errors:unsafe-binders-ast, r=oli-obk
c90e7e3ca98 Remove support for specializing ToString outside the standard library
1c55c9fbc60 Auto merge of #134047 - saethlin:inline-fmt-rt, r=m-ou-se
12a12d4f161 Update includes in '/library/core/src/error.rs';
5a5d80fb80a Fix building `std` for Hermit after `c_char` change
bfe81248fa4 Fix `Path::is_absolute` on Hermit
5d2388da58b Reword prelude for AsyncFn stabilization
9731c019cbe Stabilize async closures
fd9b9cd330a Fix typos in docs on provenance
7837903093e feat: clarify how to use `black_box()`
0c7c57b9e3c Add unwrap_unsafe_binder and wrap_unsafe_binder macro operators
72e40f07dfe Rollup merge of #134179 - zachs18:align_offset_mut_ptr_doc, r=workingjubilee
67ef22c7127 Rollup merge of #134178 - ehuss:stabilize-2024-prelude, r=amanieu,traviscross,tgross35
0834c1f1db0 Rollup merge of #134155 - sthibaul:unsafe_op_in_unsafe_fn, r=tgross35
09d16d15513 Rollup merge of #133859 - bjorn3:move_tests_to_alloctests, r=tgross35
94ec2233bd0 Rollup merge of #122003 - mati865:gnullvm-build-libunwind, r=petrochenkov
fa1541a5660 Stabilize the Rust 2024 prelude
6942ce52e34 Auto merge of #134177 - matthiaskrgr:rollup-hgp8q60, r=matthiaskrgr
3a1745b09e5 Rollup merge of #133598 - ChayimFriedman2:get-many-mut-detailed-err, r=scottmcm
566ea0f3dd8 Rollup merge of #132975 - arichardson:ffi-c-char, r=tgross35
ed224f8c25a Remove consteval note from <*mut T>::align_offset docs.
197f4744559 Rollup merge of #134079 - tbu-:pr_doc_x8_to_from_xe_bytes, r=jhpratt
ff50c42ded8 Add a note saying that `{u8,i8}::from_{be,le,ne}_bytes` is meaningless
809dc2d9649 Forbid unsafe_op_in_unsafe_fn in hurd-specific os and sys files
420c83c0cd8 Rollup merge of #134116 - RalfJung:const_nonnull_new, r=jhpratt
bb71e111888 Rollup merge of #134100 - eholk:noop-rustc-const-stable, r=dtolnay
d846ee80d9e Add references to the specific ABI documents
faa946af9e7 Remove l4re from the unsigned char operating system list
c589942e7af De-duplicate and improve definition of core::ffi::c_char
f5dfac33df4 stabilize const_nonnull_new
e24f63040e1 Rollup merge of #133472 - rust-wasi-web:master, r=joboet
0c9c5edf2d9 Rollup merge of #133456 - clubby789:cargo-update, r=ChrisDenton
1079f47e289 Rollup merge of #133184 - osiewicz:wasm-fix-infinite-loop-in-remove-dir-all, r=Noratrieb
577c96562be Remove rustc_const_stable attribute on const NOOP
7234c4f09e7 Rollup merge of #134032 - snprajwal:fix-docs, r=joboet
24e395ad1ab core: use public method instead of instrinsic
3a36268f22b core: improve comments
a09c0403f2d Auto merge of #134052 - matthiaskrgr:rollup-puxwqrk, r=matthiaskrgr
a9c38ee0d29 Rollup merge of #134050 - RalfJung:miri-sync, r=RalfJung
6fa0126c89c Rollup merge of #133880 - ChrisDenton:homedir, r=Mark-Simulacrum
0e491a9a3b1 Rollup merge of #133789 - rossmacarthur:then-with-doc-alias, r=Mark-Simulacrum
ed50cd40ea2 Switch inline(always) in core/src/fmt/rt.rs to plain inline
886328011ef Downgrade cc
e9bfb10f867 Rollup merge of #134013 - BLANKatGITHUB:intrinsic, r=saethlin
4e0eec33e6f Adds new intrinsic declaration
c1d57f82a0e Rollup merge of #133987 - Will-Low:DefineTlsAcronym, r=workingjubilee
8f4016eba75 docs: better examples for `std::ops::ControlFlow`
a73f6c64a01 Merge from rustc
fd6e8d7358e Auto merge of #133978 - matthiaskrgr:rollup-6gh1iho, r=matthiaskrgr
069b38123a6 Merge from rustc
5852362e5d1 Define acronym for thread local storage
70e63e17b2c Auto merge of #118159 - EliasHolzmann:formatting_options, r=m-ou-se
3bcad5cb18b Rollup merge of #132187 - shahn:extend_more_tuples, r=dtolnay
f761e9c676f Rollup merge of #130254 - GrigorenkoPV:QuotaExceeded, r=dtolnay
ef4c4ae6b50 Rollup merge of #130209 - GrigorenkoPV:CrossesDevices, r=dtolnay
11e4cd165ae Auto merge of #133089 - eholk:stabilize-noop-waker, r=dtolnay
aa5fc647d04 core: implement `bool::select_unpredictable`
70153836edd Rollup merge of #133790 - HypheX:improve-vec-docs, r=harudagondi,workingjubilee
ca5965a8639 Merge from rustc
706da00d0ff Rollup merge of #133821 - Kobzol:replace-black-with-ruff, r=onur-ozkan
debbad652d9 Stabilize noop_waker
fa414d5787d Access members of `FormattingOptions` directly instead of via getters/setters
02156e9faf6 Removed constness for methods receiving a `&mut` parameter
a0526432656 Added better reason for exposing `flags` and `get_flags` as unstable
9492becae41 Formatted
322c8b766b2 Refactored FormattingOptions to use a bitmask for storing flags
a1b4810cfcf Revert "Turned public+unstable+hidden functions into private functio
cc #85532
This adds a new
carrying_mul_addintrinsic, to implementwide_mulandcarrying_mul.It has fallback MIR for all types -- including
u128, which isn't currently supported on nightly -- so that it'll continue to work on all backends, including CTFE.Then it's overridden in
cg_llvmto use wider intermediate types, includingi256foru128::carrying_mul.