formatting_options: Make all methods const#145863
Merged
bors merged 1 commit intorust-lang:masterfrom Aug 26, 2025
Merged
Conversation
This comment has been minimized.
This comment has been minimized.
jieyouxu
reviewed
Aug 26, 2025
Having `const fn`s that take a `mut &` was unstable until Rust 1.83. Because of this, not all methods on `FormattingOptions` were implemented as `const`. As this has been stabilized now, there is no reason not to have all methods `const`. Thanks to Ternvein for bringing this to my attention (see [1]). [1]: rust-lang#118117 (comment)
89c3389 to
575a90e
Compare
Contributor
Author
|
@jieyouxu Done (also removed the mentioned PR ID). Sorry, didn't check this PR after creating it because I thought the CI would take a while anyway. |
Member
|
No worries, that's completely fine. This is why there's an automated warning message 😁 |
Member
|
@bors r+ rollup |
Collaborator
bors
added a commit
that referenced
this pull request
Aug 26, 2025
Rollup of 11 pull requests Successful merges: - #144373 (remove deprecated Error::description in impls) - #144551 (Add aarch64_be-unknown-linux-musl target) - #145076 (Add new Tier-3 target: riscv64a23-unknown-linux-gnu) - #145481 (Add parentheses for closure when suggesting calling closure) - #145596 (Losslessly optimize PNG files) - #145615 (Fix doc of `std::os::windows::io::BorrowedSocket::borrow_raw`) - #145841 (Always build miri for the host in `x run miri`) - #145861 (bootstrap: vendor `clippy_test_deps` too) - #145863 (formatting_options: Make all methods `const`) - #145867 (cg_llvm: Assert that LLVM range-attribute values don't exceed 128 bits) - #145875 (Make bootstrap command caching opt-in) r? `@ghost` `@rustbot` modify labels: rollup
rust-timer
added a commit
that referenced
this pull request
Aug 26, 2025
Rollup merge of #145863 - EliasHolzmann:formatting_options_20250825, r=m-ou-se formatting_options: Make all methods `const` Related to #118117. Having `const fn`s that take a `mut &` was unstable until Rust 1.83 (see #129195). Because of this, not all methods on `FormattingOptions` were implemented as `const`. As this has been stabilized now, there is no reason not to have all methods `const`. Thanks to `@Ternvein` for bringing this to my attention (see [1]). r? `@m-ou-se` (As you were the reviewer for the original implementation – feel free to reroll if you are busy or if you aren't interested) [1]: #118117 (comment)
github-actions bot
pushed a commit
to model-checking/verify-rust-std
that referenced
this pull request
Sep 9, 2025
…0250825, r=m-ou-se formatting_options: Make all methods `const` Related to rust-lang#118117. Having `const fn`s that take a `mut &` was unstable until Rust 1.83 (see rust-lang#129195). Because of this, not all methods on `FormattingOptions` were implemented as `const`. As this has been stabilized now, there is no reason not to have all methods `const`. Thanks to `@Ternvein` for bringing this to my attention (see [1]). r? `@m-ou-se` (As you were the reviewer for the original implementation – feel free to reroll if you are busy or if you aren't interested) [1]: rust-lang#118117 (comment)
This file contains hidden or 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
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.
Related to #118117.
Having
const fns that take amut &was unstable until Rust 1.83 (see #129195). Because of this, not all methods onFormattingOptionswere implemented asconst. As this has been stabilized now, there is no reason not to have all methodsconst.Thanks to @Ternvein for bringing this to my attention (see 1).
r? @m-ou-se (As you were the reviewer for the original implementation – feel free to reroll if you are busy or if you aren't interested)