Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix FormattingOptions instantiation with Default #135977

Merged
merged 1 commit into from
Jan 25, 2025

Conversation

nyurik
Copy link
Contributor

@nyurik nyurik commented Jan 24, 2025

The fill value by default should be set to ' ' (space), but the current implementation uses #[derive(Default)] which sets it to \0.

Note that FormattingOptions is being released as part of 1.85 (unstable) - so this might warrant a backport to that branch.

Tracking issue: #118117

Follow up from #118159

CC: @EliasHolzmann @programmerjake

r? @m-ou-se

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jan 24, 2025
@rust-log-analyzer

This comment has been minimized.

The `fill` value by default should be set to `' '` (space), but the current implementation uses `#[derive(Default)]` which sets it to `\0`
@programmerjake
Copy link
Member

Note that FormattingOptions is being released as part of 1.85 (unstable) - so this might warrant a backport to that branch.

afaik we generally don't backport changes that only affect unstable APIs, since they're intended to only work on nightly, not beta or stable. If this fixes some stable API then that's a different story.

@joboet
Copy link
Member

joboet commented Jan 24, 2025

FormattingOptions::default isn't yet used internally, so this didn't affect public behaviour and hence doesn't need backporting. Good catch, though!

@bors r+ rollup
r? joboet

@bors
Copy link
Contributor

bors commented Jan 24, 2025

📌 Commit c9ae0bb has been approved by joboet

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 24, 2025
joboet added a commit to joboet/rust that referenced this pull request Jan 24, 2025
Fix `FormattingOptions` instantiation with `Default`

The `fill` value by default should be set to `' '` (space), but the current implementation uses `#[derive(Default)]` which sets it to `\0`.

Note that `FormattingOptions` is being released as part of 1.85 (unstable) - so this might warrant a backport to that branch.

Tracking issue: rust-lang#118117

Follow up from rust-lang#118159

CC: `@EliasHolzmann` `@programmerjake`

r? `@m-ou-se`
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 24, 2025
Rollup of 6 pull requests

Successful merges:

 - rust-lang#135728 (document order of items in iterator from drain)
 - rust-lang#135829 (Rustc dev guide subtree update)
 - rust-lang#135886 (Document purpose of closure in from_fn.rs more clearly)
 - rust-lang#135977 (Fix `FormattingOptions` instantiation with `Default`)
 - rust-lang#135983 (Doc difference between extend and extend_from_slice)
 - rust-lang#135985 (Rename test to `unresolvable-upvar-issue-87987.rs` and add some notes)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 25, 2025
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#135971 (Properly report error when object type param default references self)
 - rust-lang#135977 (Fix `FormattingOptions` instantiation with `Default`)
 - rust-lang#135985 (Rename test to `unresolvable-upvar-issue-87987.rs` and add some notes)
 - rust-lang#135991 (Fix set_name in thread mod for NuttX)
 - rust-lang#136009 (bootstrap: Handle bootstrap lockfile race condition better)
 - rust-lang#136018 (Use short ty string for move errors)
 - rust-lang#136027 (Skip suggestions in `derive`d code)
 - rust-lang#136029 (Bootstrap: Don't move ownership of job object)
 - rust-lang#136034 (fix(bootstrap): deserialize null as `f64::NAN`)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 5c821ae into rust-lang:master Jan 25, 2025
6 checks passed
@rustbot rustbot added this to the 1.86.0 milestone Jan 25, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jan 25, 2025
Rollup merge of rust-lang#135977 - nyurik:fix-fmt-options, r=joboet

Fix `FormattingOptions` instantiation with `Default`

The `fill` value by default should be set to `' '` (space), but the current implementation uses `#[derive(Default)]` which sets it to `\0`.

Note that `FormattingOptions` is being released as part of 1.85 (unstable) - so this might warrant a backport to that branch.

Tracking issue: rust-lang#118117

Follow up from rust-lang#118159

CC: ``@EliasHolzmann`` ``@programmerjake``

r? ``@m-ou-se``
@nyurik nyurik deleted the fix-fmt-options branch January 25, 2025 14:26
@EliasHolzmann
Copy link
Contributor

@nyurik Thanks, nice catch!

@nyurik
Copy link
Contributor Author

nyurik commented Feb 18, 2025

"There is (now) a lint for that" (tm)

rust-lang/rust-clippy#14234

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants