Skip to content

-Z treat-err-as-bug panics even when no errors occur #35886

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
nagisa opened this issue Aug 22, 2016 · 3 comments · Fixed by #41942
Closed

-Z treat-err-as-bug panics even when no errors occur #35886

nagisa opened this issue Aug 22, 2016 · 3 comments · Fixed by #41942
Labels
A-frontend Area: Compiler frontend (errors, parsing and HIR) E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.

Comments

@nagisa
Copy link
Member

nagisa commented Aug 22, 2016

echo 'fn test(){} fn main() {}' | rustc - -Z treat-err-as-bug
<anon>:1:1: 1:12 warning: function is never used: `test`, #[warn(dead_code)] on by default 
<anon>:1 fn test(){} fn main() {}
         ^~~~~~~~~~~
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/blob/master/CONTRIBUTING.md#bug-reports 
note: run with `RUST_BACKTRACE=1` for a backtrace 
thread 'rustc' panicked at 'encountered error with `-Z treat_err_as_bug', ../src/librustc_errors/lib.rs:546
@durka
Copy link
Contributor

durka commented Aug 22, 2016

This is because of this line added in #33137. I'm guessing it needs a conditional to check whether self.level == Level::Error.

@Mark-Simulacrum
Copy link
Member

Marking as E-easy and E-mentor. @durka's fix (adding self.level == Level::Error) seems to be still correct, but needs to be added around this line:

self.handler.panic_if_treat_err_as_bug();
.

Let me know if you'd like to do this, and please ask if you have any questions. If you file a PR, please cc or r? me on it.

@Mark-Simulacrum Mark-Simulacrum added A-frontend Area: Compiler frontend (errors, parsing and HIR) E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion. labels May 11, 2017
@tommyip
Copy link
Contributor

tommyip commented May 12, 2017

I would like to take this issue.

tommyip added a commit to tommyip/rust that referenced this issue May 12, 2017
This fix an issue where the compiler panics even if there is no
error when passed with the `-Z treat-err-as-bug` option.

Fixes rust-lang#35886.
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue May 12, 2017
Fix unexpected panic with the -Z treat-err-as-bug option

This fix an issue where the compiler panics even if there is no error when passed with the `-Z treat-err-as-bug` option.

Fixes rust-lang#35886.

r? @Mark-Simulacrum
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue May 12, 2017
Fix unexpected panic with the -Z treat-err-as-bug option

This fix an issue where the compiler panics even if there is no error when passed with the `-Z treat-err-as-bug` option.

Fixes rust-lang#35886.

r? @Mark-Simulacrum
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue May 12, 2017
Fix unexpected panic with the -Z treat-err-as-bug option

This fix an issue where the compiler panics even if there is no error when passed with the `-Z treat-err-as-bug` option.

Fixes rust-lang#35886.

r? @Mark-Simulacrum
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue May 13, 2017
Fix unexpected panic with the -Z treat-err-as-bug option

This fix an issue where the compiler panics even if there is no error when passed with the `-Z treat-err-as-bug` option.

Fixes rust-lang#35886.

r? @Mark-Simulacrum
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
A-frontend Area: Compiler frontend (errors, parsing and HIR) E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue. E-mentor Call for participation: This issue has a mentor. Use #t-compiler/help on Zulip for discussion.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants