Skip to content
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

pprust: support multiline comments within lines #74272

Merged

Conversation

davidtwco
Copy link
Member

@davidtwco davidtwco commented Jul 12, 2020

Fixes #73626.

This PR adds support to rustc_ast_pretty for multiline comments that start and end within a line of source code.

Fun fact: the commit which added this assert was from 2011!

rust/src/comp/pretty/pprust.rs

Lines 1146 to 1150 in d12ea39

case (lexer::mixed) {
assert vec::len(cmnt.lines) == 1u;
zerobreak(s.s);
word(s.s, cmnt.lines.(0));
zerobreak(s.s);

This commit adds support to rustc_ast_pretty for multiline comments that
start and end within a line of source code.

Signed-off-by: David Wood <david@davidtw.co>
@rust-highfive
Copy link
Collaborator

r? @lcnr

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 12, 2020
@lcnr
Copy link
Contributor

lcnr commented Jul 12, 2020

This is something I am not familiar with.

r? @Mark-Simulacrum

@Mark-Simulacrum
Copy link
Member

@bors r+

This looks good to me, though I'm sure pretty won't be perfect in terms of formatting of these lines and such.

@bors
Copy link
Contributor

bors commented Jul 12, 2020

📌 Commit 083c2f6 has been approved by Mark-Simulacrum

@bors
Copy link
Contributor

bors commented Jul 12, 2020

🌲 The tree is currently closed for pull requests below priority 20, this pull request will be tested once the tree is reopened

@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 Jul 12, 2020
Manishearth added a commit to Manishearth/rust that referenced this pull request Jul 14, 2020
…ed-comments, r=Mark-Simulacrum

pprust: support multiline comments within lines

Fixes rust-lang#73626.

This PR adds support to `rustc_ast_pretty` for multiline comments that start and end within a line of source code.

Fun fact: [the commit which added this assert](rust-lang@d12ea39) was from 2011!
https://github.com/rust-lang/rust/blob/d12ea3989649616437a7c1434f5c5a6438235eb7/src/comp/pretty/pprust.rs#L1146-L1150
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Jul 14, 2020
…ed-comments, r=Mark-Simulacrum

pprust: support multiline comments within lines

Fixes rust-lang#73626.

This PR adds support to `rustc_ast_pretty` for multiline comments that start and end within a line of source code.

Fun fact: [the commit which added this assert](rust-lang@d12ea39) was from 2011!
https://github.com/rust-lang/rust/blob/d12ea3989649616437a7c1434f5c5a6438235eb7/src/comp/pretty/pprust.rs#L1146-L1150
Manishearth added a commit to Manishearth/rust that referenced this pull request Jul 14, 2020
…ed-comments, r=Mark-Simulacrum

pprust: support multiline comments within lines

Fixes rust-lang#73626.

This PR adds support to `rustc_ast_pretty` for multiline comments that start and end within a line of source code.

Fun fact: [the commit which added this assert](rust-lang@d12ea39) was from 2011!
https://github.com/rust-lang/rust/blob/d12ea3989649616437a7c1434f5c5a6438235eb7/src/comp/pretty/pprust.rs#L1146-L1150
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 14, 2020
…arth

Rollup of 11 pull requests

Successful merges:

 - rust-lang#73759 (Add missing Stdin and StdinLock examples)
 - rust-lang#74211 (Structured suggestion when not using struct pattern)
 - rust-lang#74228 (Provide structured suggestion on unsized fields and fn params)
 - rust-lang#74252 (Don't allow `DESTDIR` to influence LLVM builds)
 - rust-lang#74263 (Slight reorganization of sys/(fast_)thread_local)
 - rust-lang#74271 (process_unix: prefer i32::*_be_bytes over manually shifting bytes)
 - rust-lang#74272 (pprust: support multiline comments within lines)
 - rust-lang#74332 (Update cargo)
 - rust-lang#74334 (bootstrap: Improve wording on docs for `verbose-tests`)
 - rust-lang#74336 (typeck: use `item_name` in cross-crate packed diag)
 - rust-lang#74340 (lint: use `transparent_newtype_field` to avoid ICE)

Failed merges:

r? @ghost
@bors bors merged commit 92e90f9 into rust-lang:master Jul 14, 2020
@davidtwco davidtwco deleted the issue-73626-multiline-mixed-comments branch July 15, 2020 06:07
@cuviper cuviper added this to the 1.47.0 milestone May 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ICE in librustc_ast_pretty printing of multiline Mixed comments
6 participants