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

fix(doctest): treat fatal parse errors as incomplete attributes #99142

Merged

Conversation

notriddle
Copy link
Contributor

Fixes #99089

@rustbot rustbot added the T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. label Jul 11, 2022
@rust-highfive
Copy link
Collaborator

r? @GuillaumeGomez

(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 11, 2022
@GuillaumeGomez
Copy link
Member

I'm a bit lost about this change: you added the support for sending compilation errors somewhere else that stderr but that seems to be it. There is no new attribute check from what I can see. Can you explain to me please?

@notriddle
Copy link
Contributor Author

Rustdoc already has the infrastructure in place to recognize unterminated crate attributes.

&& check_if_attr_is_complete(&mod_attr_pending, edition)

The only reason it didn’t work is that unclosed quotes are a Fatal error in rustc, which is implemented by panicking. That means I need to catch the panic (which rustc_driver::catch_fatal_errors does), and I need to do special setup to make sure the fatal error does not write anything to the console (since with_silent_emitter only silences non-fatal errors).

@GuillaumeGomez
Copy link
Member

Thanks for the explanations!

@bors r+ rollup

@bors
Copy link
Contributor

bors commented Jul 11, 2022

📌 Commit 6c44357 has been approved by GuillaumeGomez

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 Jul 11, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this pull request Jul 11, 2022
…ne-crate-attributes, r=GuillaumeGomez

fix(doctest): treat fatal parse errors as incomplete attributes

Fixes rust-lang#99089
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jul 11, 2022
…ne-crate-attributes, r=GuillaumeGomez

fix(doctest): treat fatal parse errors as incomplete attributes

Fixes rust-lang#99089
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Jul 11, 2022
…ne-crate-attributes, r=GuillaumeGomez

fix(doctest): treat fatal parse errors as incomplete attributes

Fixes rust-lang#99089
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 12, 2022
…askrgr

Rollup of 8 pull requests

Successful merges:

 - rust-lang#97210 (Support `-A`, `-W`, `-D` and `-F` when running `./x.py clippy`)
 - rust-lang#99055 (Fix rustdoc help options)
 - rust-lang#99075 (Fix duplicated type annotation suggestion)
 - rust-lang#99124 (Fix sized check ICE in asm check)
 - rust-lang#99142 (fix(doctest): treat fatal parse errors as incomplete attributes)
 - rust-lang#99145 (Don't rerun the build script for the compiler each time on non-windows platforms)
 - rust-lang#99146 (Do not error during method probe on `Sized` predicates for types that aren't the method receiver)
 - rust-lang#99161 (compiletest: trim edition before passing as flag)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 24d241a into rust-lang:master Jul 12, 2022
@rustbot rustbot added this to the 1.64.0 milestone Jul 12, 2022
@notriddle notriddle deleted the notriddle/doctest-multiline-crate-attributes branch July 12, 2022 03:36
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-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rustdoc: unterminated string with inner attributes
5 participants