-
Notifications
You must be signed in to change notification settings - Fork 356
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
Automatic Rustup #4120
Merged
Merged
Automatic Rustup #4120
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Stabilize `style_edition = "2024"` in-tree This PR stabilizes the `style_edition` flag in rustfmt. **Why am I doing this in-tree?** The beta release cut is imminent (according to forge, on January 3) and this is the most lightweight approach to getting this flag stable on nightly. It's imperative (as far as I can tell -- `@traviscross` can verify or disagree) that we stabilize the `style_edition` flag so that users can control their style edition separately from the edition. I'm happy to move this PR to the rustfmt repo and subsequently prepare a subtree sync if someone on `@rust-lang/rustfmt` believes that we should get this landed on the rustfmt side then synced. If this is the right recourse, I'd like to note that this is still quite time-sensitive. However, I'm happy to dedicate time to get this done if necessary, since I'd really like to un-jeopardize the style edition. Tracking: - rust-lang/rust#123799
Avoid short writes in LineWriter If the bytes written to `LineWriter` contains at least one new line but doesn't end in a new line (e.g. `"abc\ndef"`) then we: - write up to the last new line direct to the underlying `Writer`. - copy as many of the remaining bytes as will fit into our internal buffer. That last step is inefficient if the remaining bytes are larger than our buffer. It will needlessly split the bytes in two, requiring at least two writes to the underlying `Writer` (one to flush the buffer, one more to write the rest). This PR skips the extra buffering if the remaining bytes are larger than the buffer.
Tidy up bigint multiplication methods This tidies up the library version of the bigint multiplication methods after the addition of the intrinsics in #133663. It follows [this summary](rust-lang/rust#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.
Update books ## rust-lang/book 13 commits in ad2011d3bcad9f152d034faf7635c22506839d58..04d06dfe541607e6419f3d028c3f9b245f3be4d9 2024-12-20 22:44:11 UTC to 2024-12-16 18:18:21 UTC - Update section name (rust-lang/book#4175) - Update text to reflect the change from '&str' to 'char' in example (rust-lang/book#4173) - Update figure number in text and file name (rust-lang/book#4172) - Fix chapter number (rust-lang/book#4171) - Delete unused reference (rust-lang/book#4170) - Remove orphaned half-sentence (rust-lang/book#4169) - Fix chapter number (rust-lang/book#4168) - A better phrasing for generic methods. (rust-lang/book#3428) - Fix minor grammatical error (rust-lang/book#4098) - Update appendix-06-translation.md to add another Chinese translation. (rust-lang/book#3608) - Change Korean translation repo to newer (rust-lang/book#3625) - Clarify/improve readability in Ch. 02 discussion of `Result` variants (rust-lang/book#4167) - Ch. 20: conclude §01 with a reference to the Rustonomicon (rust-lang/book#4166) ## rust-lang/nomicon 1 commits in 97e84a38c94bf9362b11284c20b2cb4adaa1e868..7ef05b9777c94836bc92f50f23e6e00981521a89 2024-12-30 10:38:10 UTC to 2024-12-30 10:38:10 UTC - Fix URL fragment to MutexGuard's negative impl of Send (rust-lang/nomicon#472) ## rust-lang/reference 3 commits in 9f41bc11342d46544ae0732caf14ec0bcaf27376..acd6794e712d5e2ef6f5c84fb95688d32a69b816 2024-12-18 23:04:30 +0000 to 2024-12-30 22:12:57 +0000 - Revert "`coverage` attribute" (rust-lang/reference#1706) - Document Rust 2024 match ergonomics reservations (rust-lang/reference#1702) - Add documentation for `#[diagnostic::do_not_recommend]` (rust-lang/reference#1663) ## rust-lang/edition-guide 5 commits in bc4ce51e1d4dacb9350a92e95f6159a42de2f8c6..d56e0f3a0656b7702ca466d4b191e16c28262b82 2024-12-18 05:34:59 +0000 to 2024-12-31 20:04:52 +0000 - 2024: Document rustfmt overflow_delimited_expr (rust-lang/edition-guide#352) - 2024: Document rustfmt fixes (rust-lang/edition-guide#351) - Update the transitioning steps (rust-lang/edition-guide#350) - Revert "2024: Assignment operator RHS indentation" (rust-lang/edition-guide#343) - Revert "2024: Add chapter on single-line `where` clauses" (rust-lang/edition-guide#344) ## rust-lang/rust-by-example 1 commits in 76406337f4131253443aea0ed7e7f451b464117c..093397535b48ae13ec76bc526b7e6eb8c096a85c 2024-12-18 17:29:56 UTC to 2024-12-18 17:29:56 UTC - Mention that you're not allowed to partially move Drop types (rust-lang/rust-by-example#1902) ## rust-lang/rustc-dev-guide 18 commits in 7f7ba48f04abc2ad25e52f30b5e2bffa286b019f..ad93c5f1c49f2aeb45f7a4954017b1e607df9f5e 2024-12-30 09:22:22 UTC to 2024-12-17 17:00:38 UTC - Opt into, rather than out of, linkcheck (rust-lang/rustc-dev-guide#2180) - Remove stale implementation details of coverage instrumentation (rust-lang/rustc-dev-guide#2179) - Remove properly tracked config file from .gitignore & add support for skipping of link-checking (rust-lang/rustc-dev-guide#2023) - Add a couple of linkcheck exceptions: (rust-lang/rustc-dev-guide#2120) - Add missing link for [Node] (rust-lang/rustc-dev-guide#2177) - Fix 403 received for HEAD request (rust-lang/rustc-dev-guide#2176) - Start using mdbook-linkcheck2 (rust-lang/rustc-dev-guide#2103) - Document `x test --no-capture` (rust-lang/rustc-dev-guide#2174) - Remove the `-test` suffix from normalize directives (rust-lang/rustc-dev-guide#2172) - Rework the driver docs (rust-lang/rustc-dev-guide#2162) - Document `forbid-output` for UI tests (rust-lang/rustc-dev-guide#2171) - completions: Zsh is now supported (rust-lang/rustc-dev-guide#2173) - region-outlives propagation (rust-lang/rustc-dev-guide#2169) - compiletest: Document the `--debugger` flag (rust-lang/rustc-dev-guide#2170) - document the public ci dashboard (rust-lang/rustc-dev-guide#2167) - Fix trivial typo of "query-fied" (rust-lang/rustc-dev-guide#2165) - Fix some typos (rust-lang/rustc-dev-guide#2166) - Add suggestion for `--keep-stage 0` (rust-lang/rustc-dev-guide#2164)
Try to write the panic message with a single `write_all` call This writes the panic message to a buffer before writing to stderr. This allows it to be printed with a single `write_all` call, preventing it from being interleaved with other outputs. It also adds newlines before and after the message ensuring that only the panic message will have its own lines. Before: ``` thread 'thread 'thread 'thread 'thread '<unnamed>thread 'thread 'thread 'thread '<unnamed><unnamed>thread '<unnamed>' panicked at ' panicked at <unnamed><unnamed><unnamed><unnamed><unnamed>' panicked at <unnamed>' panicked at src\heap.rssrc\heap.rs' panicked at ' panicked at ' panicked at ' panicked at ' panicked at src\heap.rs' panicked at src\heap.rs::src\heap.rssrc\heap.rssrc\heap.rssrc\heap.rssrc\heap.rs:src\heap.rs:455455:::::455:455::455455455455455:455:99:::::9:9: : 999: 999: assertion failed: size <= (*queue).block_size: : assertion failed: size <= (*queue).block_size: assertion failed: size <= (*queue).block_size: : : assertion failed: size <= (*queue).block_sizeassertion failed: size <= (*queue).block_sizeassertion failed: size <= (*queue).block_size assertion failed: size <= (*queue).block_size assertion failed: size <= (*queue).block_sizeassertion failed: size <= (*queue).block_sizeerror: process didn't exit successfully: `target\debug\direct_test.exe` (exit code: 0xc0000409, STATUS_STACK_BUFFER_OVERRUN) ``` After: ``` thread '<unnamed>' panicked at src\heap.rs:455:9: assertion failed: size <= (*queue).block_size thread '<unnamed>' panicked at src\heap.rs:455:9: assertion failed: size <= (*queue).block_size thread '<unnamed>' panicked at src\heap.rs:455:9: assertion failed: size <= (*queue).block_size error: process didn't exit successfully: `target\debug\direct_test.exe` (exit code: 0xc0000409, STATUS_STACK_BUFFER_OVERRUN) ``` --- try-jobs: x86_64-gnu-llvm-18
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please close and re-open this PR to trigger CI, then enable auto-merge.