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

rustdoc: Fix ICE report #92310

Merged
merged 1 commit into from
Feb 3, 2022
Merged

rustdoc: Fix ICE report #92310

merged 1 commit into from
Feb 3, 2022

Conversation

ehuss
Copy link
Contributor

@ehuss ehuss commented Dec 27, 2021

The ICE report in rustdoc was confusing because it was returning an argument parse error:

thread 'rustc' panicked at 'aborting due to `-Z treat-err-as-bug=1`', compiler/rustc_errors/src/lib.rs:1212:27
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

error: Unrecognized option: 'crate-version'

This is because the ICE reporter was trying to parse the arguments as rustc, not rustdoc. Since an argument error is a fatal error, it was early-exiting with the argument error due to unwinding.

This changes it to be a more primitive scan of the arguments. The arguments being checked are pretty simple, and only have a small handful of forms that are easy to check for.

It now looks like this:

thread 'rustc' panicked at 'aborting due to `-Z treat-err-as-bug=1`', compiler/rustc_errors/src/lib.rs:1212:27
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.59.0-dev running on x86_64-apple-darwin

note: compiler flags: --crate-type lib -Z treat-err-as-bug

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack

It still says rustc, but I can live with that.

@rust-highfive
Copy link
Collaborator

r? @estebank

(rust-highfive has picked a reviewer for you, use r? to override)

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Dec 27, 2021
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 27, 2021
@camelid
Copy link
Member

camelid commented Dec 27, 2021

I'd always wondered why it reported an argument error...

@JohnCSimon JohnCSimon added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 23, 2022
@ijackson
Copy link
Contributor

ijackson commented Feb 2, 2022

Ah, cool, the strange behaviour in #93579 is explained :-). Thanks for fixing.

@estebank
Copy link
Contributor

estebank commented Feb 2, 2022

@bors r+

@bors
Copy link
Contributor

bors commented Feb 2, 2022

📌 Commit 4413141 has been approved by estebank

@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 Feb 2, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Feb 3, 2022
rustdoc: Fix ICE report

The ICE report in rustdoc was confusing because it was returning an argument parse error:

```
thread 'rustc' panicked at 'aborting due to `-Z treat-err-as-bug=1`', compiler/rustc_errors/src/lib.rs:1212:27
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

error: Unrecognized option: 'crate-version'
```

This is because the ICE reporter was trying to parse the arguments as rustc, not rustdoc.  Since an argument error is a fatal error, it was early-exiting with the argument error due to unwinding.

This changes it to be a more primitive scan of the arguments. The arguments being checked are pretty simple, and only have a small handful of forms that are easy to check for.

It now looks like this:

```
thread 'rustc' panicked at 'aborting due to `-Z treat-err-as-bug=1`', compiler/rustc_errors/src/lib.rs:1212:27
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.59.0-dev running on x86_64-apple-darwin

note: compiler flags: --crate-type lib -Z treat-err-as-bug

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
```

It still says `rustc`, but I can live with that.
bors added a commit to rust-lang-ci/rust that referenced this pull request Feb 3, 2022
Rollup of 7 pull requests

Successful merges:

 - rust-lang#92310 (rustdoc: Fix ICE report)
 - rust-lang#92802 (Deduplicate lines in long const-eval stack trace)
 - rust-lang#93515 (Factor convenience functions out of main printer implementation)
 - rust-lang#93566 (Make rustc use `RUST_BACKTRACE=full` by default)
 - rust-lang#93589 (Use Option::then in two places)
 - rust-lang#93600 (fix: Remove extra newlines from junit output)
 - rust-lang#93606 (Correct incorrect description of preorder traversals)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors
Copy link
Contributor

bors commented Feb 3, 2022

⌛ Testing commit 4413141 with merge 4e8fb74...

@bors bors merged commit 9298bd8 into rust-lang:master Feb 3, 2022
@rustbot rustbot added this to the 1.60.0 milestone Feb 3, 2022
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Sep 10, 2022
Fix ICE report flags display.

rust-lang#92310 made some changes to the ICE report that displays the rustc flags, but it introduced a bug where a flag like `-Z incremental-verify-ich=yes` was being treated as-if it was `-Cincremental`. This corrupted the output and made it confusing. The cause was using `starts_with` instead of properly splitting the option.

For example, with the command like `rustc foo.rs -Cincremental=/tmp/a -Zincremental-verify-ich=yes --crate-type lib` would previously look like:

```
note: compiler flags: -C incremental -Z incremental --crate-type lib
```

It now looks like:

```
note: compiler flags: -C incremental=[REDACTED] -Z incremental-verify-ich=yes --crate-type lib
```

I added a `[REDACTED]` marker for `-Cincremental` so it is a little less confusing that a value has been removed.

Fixes rust-lang#101588
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.

None yet

8 participants