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

Improve diagnostics for unterminated nested block comment #95859

Merged
merged 2 commits into from
Apr 16, 2022

Conversation

yue4u
Copy link
Contributor

@yue4u yue4u commented Apr 9, 2022

close #95283

(This is my first time try to messing around with rust compiler and might get a lot of things wrong... 🙇 )

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @petrochenkov (or someone else) soon.

Please see the contribution instructions for more information.

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Apr 9, 2022
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Apr 9, 2022
@yue4u yue4u force-pushed the unterminated-nested-block-comment branch from 1dbebb3 to 5d1f333 Compare April 9, 2022 18:19
@petrochenkov
Copy link
Contributor

petrochenkov commented Apr 12, 2022

The text of the comment should be available in fn cook_lexer_token, so I suggest searching for the nested /* in it only if we are actually going to report the "unterminated block (doc-)comment" error.
That would help to keep the lexer alone and to not do any extra work on good path.

Also all this logic searching for /* and adding the labels can be moved to a separate function and placed somewhere together with other error-reporting functions.

@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 12, 2022
@yue4u yue4u force-pushed the unterminated-nested-block-comment branch 2 times, most recently from 66ff71a to 08baf85 Compare April 13, 2022 17:28
@yue4u yue4u force-pushed the unterminated-nested-block-comment branch from 08baf85 to 4a0f8d5 Compare April 13, 2022 18:22
Copy link
Contributor Author

@yue4u yue4u left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @petrochenkov , thanks for the review. I updated this pr and does this look better?

compiler/rustc_parse/src/lexer/mod.rs Outdated Show resolved Hide resolved
@petrochenkov petrochenkov added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Apr 13, 2022
@petrochenkov
Copy link
Contributor

Thanks!
@bors r

@bors
Copy link
Contributor

bors commented Apr 14, 2022

📌 Commit 1b7008d has been approved by petrochenkov

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Apr 14, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Apr 14, 2022
…comment, r=petrochenkov

Improve diagnostics for unterminated nested block comment

close rust-lang#95283

(This is my first time try to messing around with rust compiler and might get a lot of things wrong... 🙇 )
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Apr 14, 2022
…comment, r=petrochenkov

Improve diagnostics for unterminated nested block comment

close rust-lang#95283

(This is my first time try to messing around with rust compiler and might get a lot of things wrong... 🙇 )
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Apr 14, 2022
…comment, r=petrochenkov

Improve diagnostics for unterminated nested block comment

close rust-lang#95283

(This is my first time try to messing around with rust compiler and might get a lot of things wrong... 🙇 )
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Apr 15, 2022
…comment, r=petrochenkov

Improve diagnostics for unterminated nested block comment

close rust-lang#95283

(This is my first time try to messing around with rust compiler and might get a lot of things wrong... 🙇 )
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Apr 15, 2022
…comment, r=petrochenkov

Improve diagnostics for unterminated nested block comment

close rust-lang#95283

(This is my first time try to messing around with rust compiler and might get a lot of things wrong... 🙇 )
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Apr 16, 2022
…comment, r=petrochenkov

Improve diagnostics for unterminated nested block comment

close rust-lang#95283

(This is my first time try to messing around with rust compiler and might get a lot of things wrong... 🙇 )
bors added a commit to rust-lang-ci/rust that referenced this pull request Apr 16, 2022
Rollup of 9 pull requests

Successful merges:

 - rust-lang#93969 (Only add codegen backend to dep info if -Zbinary-dep-depinfo is used)
 - rust-lang#94605 (Add missing links in platform support docs)
 - rust-lang#95372 (make unaligned_references lint deny-by-default)
 - rust-lang#95859 (Improve diagnostics for unterminated nested block comment)
 - rust-lang#95961 (implement SIMD gather/scatter via vector getelementptr)
 - rust-lang#96004 (Consider lifetimes when comparing types for equality in MIR validator)
 - rust-lang#96050 (Remove some now-dead code that was only relevant before deaggregation.)
 - rust-lang#96070 ([test] Add test cases for untested functions for BTreeMap)
 - rust-lang#96099 (MaybeUninit array cleanup)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 946d76e into rust-lang:master Apr 16, 2022
@rustbot rustbot added this to the 1.62.0 milestone Apr 16, 2022
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. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Better diagnostics for accidentally nested block comments
5 participants