Uh oh!
There was an error while loading. Please reload this page.
style-guide: Format single associated type where clauses on the same line - #119515
Conversation
rustbot
commented
Jan 2, 2024
r? @yaahc (rustbot has picked a reviewer for you, use r? to override) |
rustbot
commented
Jan 2, 2024
Some changes occurred in src/doc/style-guide cc @rust-lang/style |
Uh oh!
There was an error while loading. Please reload this page.
5010ff3 to
6324736Comparebors
commented
Jan 11, 2024
☔ The latest upstream changes (presumably #119837) made this pull request unmergeable. Please resolve the merge conflicts. |
joshtriplett
commented
Jan 12, 2024
@rfcbot merge |
Team member @joshtriplett has proposed to merge this. The next step is review by the rest of the tagged team members: No concerns currently listed. Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up! See this document for info about what commands tagged team members can give me. |
Uh oh!
There was an error while loading. Please reload this page.
rfcbot
commented
Jan 24, 2024
🔔 This is now entering its final comment period, as per the review above. 🔔 |
pitaj
commented
Jan 31, 2024
Just curious about the reasoning here fncount(self) -> usizewhereSelf:Sized,{todo!()}Why exclude functions with bodies, and why not allow |
rfcbot
commented
Feb 3, 2024
The final comment period, with a disposition to merge, as per the review above, is now complete. As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed. This will be merged soon. |
compiler-errors
commented
Feb 5, 2024
Please rebase, then r=me. @rustbot author |
Dylan-DPC
commented
Apr 22, 2024
@joshtriplett any updates on this? this is ready for a merge and has been approved but requires a rebase before that |
…e line In particular, lifetime-generic associated types often have a `where Self: 'a` bound, which we can format on the same line.
Show an example that has bounds.
compiler-errors
commented
May 13, 2024
@bors r+ |
bors
commented
May 13, 2024
…-clause-same-line, r=compiler-errors style-guide: Format single associated type `where` clauses on the same line In particular, lifetime-generic associated types often have a `where Self: 'a` bound, which we can format on the same line.
@pitaj This was intended as a narrow fix for making GATs simpler to write and read. The rationale for excluding functions with bodies is the same as the rationale for excluding types that have an Separate from that: Putting a function's |
pitaj
commented
May 13, 2024
A more complex function signature would also be more likely to spill into the next line. The argument seems to apply equally regardless of whether the function has a body or not. |
joshtriplett
commented
May 13, 2024
The argument I wrote above was in response to the idea of writing fncount(self) -> usizewhereSelf:Sized{todo!()}I'd make a different argument about why not to write: fncount(self) -> usizewhereSelf:Sized{todo!()}That argument would mostly be "that function already has a body, so it's already spread over several lines and has a blank line separating it from other functions, so the incremental value of putting By contrast, if you have: fncount(self) -> usizewhereSelf:Sized;fnrecount(self) -> usizewhereSelf:Sized;fnturn_purple(&mutself);I think that's more readable than breaking each of the |
…-clause-same-line, r=compiler-errors style-guide: Format single associated type `where` clauses on the same line In particular, lifetime-generic associated types often have a `where Self: 'a` bound, which we can format on the same line.
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#119515 (style-guide: Format single associated type `where` clauses on the same line) - rust-lang#119959 ([meta] Clarify prioritization alert) - rust-lang#123817 (Stabilize `seek_seek_relative`) - rust-lang#124532 (elaborate obligations in coherence) - rust-lang#125063 (Don't call `env::set_var` in `rustc_driver::install_ice_hook`) r? `@ghost` `@rustbot` modify labels: rollup
…iaskrgr Rollup of 5 pull requests Successful merges: - rust-lang#119515 (style-guide: Format single associated type `where` clauses on the same line) - rust-lang#119959 ([meta] Clarify prioritization alert) - rust-lang#123817 (Stabilize `seek_seek_relative`) - rust-lang#125063 (Don't call `env::set_var` in `rustc_driver::install_ice_hook`) - rust-lang#125071 (Migrate rustdoc target spec json path) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#119515 - joshtriplett:style-guide-gat-where-clause-same-line, r=compiler-errors style-guide: Format single associated type `where` clauses on the same line In particular, lifetime-generic associated types often have a `where Self: 'a` bound, which we can format on the same line.
…compiler-errors Revert rust-lang#119515 single line where clause style guide This did not get implemented for the style edition in 2024, so this PR removes it from the documentation. See tracking issue rust-lang#132381. This can be added back in the next edition if it gets implemented. I'm a little unclear on what the style team intends for how future changes are documented. For example, the current style-guide documented behavior that rustfmt does not support. I'm not sure who the audience for this document is, or how this is intended to stay in sync with rustfmt. For example, if I read this and assume this is how it is supposed to work, and then rustfmt breaks that, it seems like that is confusing. Similarly, if I'm staying on an older edition, this documentation would be incorrect for my crate. Perhaps changes like this could be "teed-up" in a PR, but not merged until the edition is stabilized (similar to how the reference works)? And include notes for parts that are edition-specific (so if I am using an older edition, I can see that something is different). In general, I'm a little confused on how this is intended to work. Reverts: - rust-lang#119515
Rollup of 9 pull requests Successful merges: - rust-lang#132474 (Add more mailmap entries) - rust-lang#133486 (borrowck diagnostics: make `add_move_error_suggestions` use the HIR rather than `SourceMap`) - rust-lang#134063 (dec2flt: Clean up float parsing modules) - rust-lang#134861 (Add GUI test for item info elements color) - rust-lang#134968 (Print how to rebless Python formatting in tidy) - rust-lang#134971 (chore: fix typos) - rust-lang#134972 (add .mailmap entry for myself) - rust-lang#134974 (Revert rust-lang#119515 single line where clause style guide) - rust-lang#134975 (Revert style guide rhs break) r? `@ghost` `@rustbot` modify labels: rollup
…compiler-errors Revert rust-lang#119515 single line where clause style guide This did not get implemented for the style edition in 2024, so this PR removes it from the documentation. See tracking issue rust-lang#132381. This can be added back in the next edition if it gets implemented. I'm a little unclear on what the style team intends for how future changes are documented. For example, the current style-guide documented behavior that rustfmt does not support. I'm not sure who the audience for this document is, or how this is intended to stay in sync with rustfmt. For example, if I read this and assume this is how it is supposed to work, and then rustfmt breaks that, it seems like that is confusing. Similarly, if I'm staying on an older edition, this documentation would be incorrect for my crate. Perhaps changes like this could be "teed-up" in a PR, but not merged until the edition is stabilized (similar to how the reference works)? And include notes for parts that are edition-specific (so if I am using an older edition, I can see that something is different). In general, I'm a little confused on how this is intended to work. Reverts: - rust-lang#119515
Rollup of 8 pull requests Successful merges: - rust-lang#132474 (Add more mailmap entries) - rust-lang#133486 (borrowck diagnostics: make `add_move_error_suggestions` use the HIR rather than `SourceMap`) - rust-lang#134861 (Add GUI test for item info elements color) - rust-lang#134968 (Print how to rebless Python formatting in tidy) - rust-lang#134971 (chore: fix typos) - rust-lang#134972 (add .mailmap entry for myself) - rust-lang#134974 (Revert rust-lang#119515 single line where clause style guide) - rust-lang#134975 (Revert style guide rhs break) r? `@ghost` `@rustbot` modify labels: rollup
Rollup merge of rust-lang#134974 - ehuss:revert-single-line-where, r=compiler-errors Revert rust-lang#119515 single line where clause style guide This did not get implemented for the style edition in 2024, so this PR removes it from the documentation. See tracking issue rust-lang#132381. This can be added back in the next edition if it gets implemented. I'm a little unclear on what the style team intends for how future changes are documented. For example, the current style-guide documented behavior that rustfmt does not support. I'm not sure who the audience for this document is, or how this is intended to stay in sync with rustfmt. For example, if I read this and assume this is how it is supposed to work, and then rustfmt breaks that, it seems like that is confusing. Similarly, if I'm staying on an older edition, this documentation would be incorrect for my crate. Perhaps changes like this could be "teed-up" in a PR, but not merged until the edition is stabilized (similar to how the reference works)? And include notes for parts that are edition-specific (so if I am using an older edition, I can see that something is different). In general, I'm a little confused on how this is intended to work. Reverts: - rust-lang#119515
In particular, lifetime-generic associated types often have a
where Self: 'abound, which we can format on the same line.