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

internal compiler error: Switch on discriminant of non-ADT #5238

Closed
russcam opened this issue Feb 28, 2020 · 5 comments
Closed

internal compiler error: Switch on discriminant of non-ADT #5238

russcam opened this issue Feb 28, 2020 · 5 comments
Labels
C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@russcam
Copy link

russcam commented Feb 28, 2020

Hi! I'm using the github clippy action, and have started to see the following internal compiler error when clippy runs

    Checking rustc-ap-rustc_parse v642.0.0
error: internal compiler error: src\librustc_mir\dataflow\generic\engine.rs:315: Switch on discriminant of non-ADT

thread 'rustc' panicked at 'Box<Any>', src\librustc_errors\lib.rs:881:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

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

note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new

note: Clippy version: clippy 0.0.212 (fc5d0cc5 2020-02-24)

error: aborting due to previous error

This can be seen in https://github.com/elastic/elasticsearch-rs/commit/d0efcc8e174682da9d2cf215f1dacdedaf802b0b/checks?check_suite_id=487235109.

I can reproduce it locally with latest nightly.

@JohnTitor JohnTitor added C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️ labels Feb 28, 2020
@JohnTitor
Copy link
Member

Thanks for the report! We also saw that in our CI: https://github.com/rust-lang/rust-clippy/runs/473320782
I've investigated and prepared a fix.

@matthiaskrgr
Copy link
Member

reduced crash sample:

#![feature(generators, generator_trait)]

fn main() {
    let _ = || { yield; };
}

@repi
Copy link

repi commented Feb 28, 2020

We also ran into this with the same clippy version and latest nightly

@o0Ignition0o
Copy link

We ran into it as well on artillery:

Clippy version: clippy 0.0.212 (fc5d0cc 2020-02-24)

The bastion-rs artillery CI triggered an ICE: https://github.com/bastion-rs/artillery/pull/12/checks?check_run_id=476772942

 {"reason":"compiler-message","package_id":"artillery-core 0.1.0 (path+file:///home/runner/work/artillery/artillery/artillery-core)","target":{"kind":["lib"],"crate_types":["lib"],"name":"artillery-core","src_path":"/home/runner/work/artillery/artillery/artillery-core/src/lib.rs","edition":"2018","doctest":true},"message":{"rendered":"error: internal compiler error: src/librustc_mir/dataflow/generic/engine.rs:315: Switch on discriminant of non-ADT\n\n","children":[],"code":null,"level":"error: internal compiler error","message":"src/librustc_mir/dataflow/generic/engine.rs:315: Switch on discriminant of non-ADT","spans":[]}}
  thread 'rustc' panicked at 'Box<Any>', src/librustc_errors/lib.rs:881:9
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
  
  note: the compiler unexpectedly panicked. this is a bug.
  
  note: we would appreciate a bug report: https://github.com/rust-lang/rust-clippy/issues/new
  
  note: Clippy version: clippy 0.0.212 (fc5d0cc 2020-02-24)

Hope it helps :)

@JohnTitor
Copy link
Member

Oops, I forgot mentioning here. The proper fix is already submitted on rust-lang/rust and waiting-on-review now: rust-lang/rust#69562

@flip1995 flip1995 closed this as completed Mar 1, 2020
bors added a commit that referenced this issue Mar 2, 2020
bors added a commit that referenced this issue Mar 2, 2020
flip1995 pushed a commit to flip1995/rust-clippy that referenced this issue May 5, 2020
Changes:
````
Apply suggestions from code review
Simplify if_chain.
Move NumericLiteral to its own module.
Included binary and octal cases.
Resolve false positives for hex int cast.
Test for unnecessary_cast of hex int literal.
run-rustfix
Lint `if let Some` in question_mark lint
Add restrictive pat use in full binded struct
Update test case answers to match cargo dev fmt
Ran cargo dev fmt
Rustup to rust-lang/rust#69506
Recommended changes from flip1995
Revive rls integration test
use question mark operator
Add regression test
Use `try_eval_usize` over `eval_usize`
Add path for display trait
Use lang items instead of get_trait_def_id where possible
Update stderr
Don't lint debug formatting in debug impl
Whitelist unused attribute for use items.
Fix one last test issue
Refactor suggested by krishna-veerareddy
Fixed compile error from merging
Changed test output to reflect cargo fmt
Run cargo dev fmt
Finished checking for cases of absolute values
add test for rust-lang#5238
Some bugfixing
Created floating point abs lint and test, but not yet run
````
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: Clippy is not doing the correct thing I-ICE Issue: Clippy panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

6 participants