Skip to content

Rustc unwrap panic at src/librustc_mir/transform/match_branches.rs #75574

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

Closed
gretchenfrage opened this issue Aug 15, 2020 · 3 comments
Closed
Labels
A-mir-opt Area: MIR optimizations C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@gretchenfrage
Copy link

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/librustc_mir/transform/match_branches.rs:54:81

Code

I couldn't reduce it to a MCVE, so the whole source tree is here: https://github.com/gretchenfrage/rustc-bug-aug-15-20-1 . I hope that's useful. Clone the repo and run game/run.sh. I found this reproducibley panics on my laptop.

Meta

rustc 1.45.2 (d3fb005a3 2020-07-31)
binary: rustc
commit-hash: d3fb005a39e62501b8b0b356166e515ae24e2e54
commit-date: 2020-07-31
host: x86_64-apple-darwin
release: 1.45.2
LLVM version: 10.0

Error output

Backtrace

   Compiling libc v0.2.74
   Compiling autocfg v1.0.0
   Compiling cfg-if v0.1.10
   Compiling proc-macro2 v1.0.19
   Compiling unicode-xid v0.2.1
   Compiling syn v1.0.38
   Compiling bitflags v1.2.1
   Compiling lazy_static v1.4.0
   Compiling byteorder v1.3.4
   Compiling cc v1.0.58
   Compiling log v0.4.11
   Compiling scopeguard v1.1.0
   Compiling memchr v2.3.3
   Compiling foreign-types-shared v0.1.1
   Compiling serde_derive v1.0.114
   Compiling maybe-uninit v2.0.0
   Compiling core-foundation-sys v0.8.0
   Compiling serde v1.0.114
   Compiling pin-project-internal v0.4.23
   Compiling block v0.1.6
   Compiling core-foundation-sys v0.7.0
   Compiling smallvec v1.4.1
   Compiling rayon-core v1.7.1
   Compiling proc-macro-nested v0.1.6
   Compiling slab v0.4.2
   Compiling proc-macro-hack v0.5.18
   Compiling getrandom v0.1.14
   Compiling futures-sink v0.3.5
   Compiling version_check v0.1.5
   Compiling futures-core v0.3.5
   Compiling semver-parser v0.7.0
   Compiling adler32 v1.2.0
   Compiling once_cell v1.4.0
   Compiling regex-syntax v0.6.18
   Compiling futures-io v0.3.5
   Compiling crc32fast v1.2.0
   Compiling ryu v1.0.5
   Compiling pin-utils v0.1.0
   Compiling atom v0.3.5
   Compiling copyless v0.1.5
   Compiling arrayvec v0.5.1
   Compiling lzw v0.10.0
   Compiling gimli v0.22.0
   Compiling range-alloc v0.1.1
   Compiling either v1.5.3
   Compiling serde_json v1.0.57
   Compiling adler v0.2.3
   Compiling object v0.20.0
   Compiling rustc-demangle v0.1.16
   Compiling ppv-lite86 v0.2.8
   Compiling itoa v0.4.6
   Compiling color_quant v1.0.1
   Compiling unicode-width v0.1.8
   Compiling typed-arena v2.0.1
   Compiling bytemuck v1.3.1
   Compiling mint v0.5.5
   Compiling ansi_term v0.12.1
   Compiling dispatch v0.2.0
   Compiling static_assertions v1.1.0
   Compiling scoped_threadpool v0.1.9
   Compiling instant v0.1.6
   Compiling iter_vals v0.1.0
   Compiling array_iterator v0.2.4
   Compiling arraymap v0.1.1
   Compiling tracing-core v0.1.13
   Compiling thread_local v1.0.1
   Compiling sharded-slab v0.0.9
   Compiling num-traits v0.2.12
   Compiling crossbeam-utils v0.7.2
   Compiling memoffset v0.5.5
   Compiling num-integer v0.1.43
   Compiling crossbeam-epoch v0.8.2
   Compiling rayon v1.3.1
   Compiling num-iter v0.1.41
   Compiling num-rational v0.3.0
   Compiling lock_api v0.3.4
   Compiling foreign-types v0.3.2
   Compiling futures-channel v0.3.5
   Compiling objc_exception v0.1.2
   Compiling spirv_cross v0.20.0
   Compiling nom v4.2.3
   Compiling semver v0.9.0
   Compiling miniz_oxide v0.3.7
   Compiling futures-task v0.3.5
   Compiling hibitset v0.6.3
   Compiling miniz_oxide v0.4.0
   Compiling addr2line v0.13.0
   Compiling gif v0.10.3
   Compiling textwrap v0.12.1
   Compiling storage-map v0.2.0
   Compiling rustc_version v0.2.3
   Compiling malloc_buf v0.0.6
   Compiling raw-window-handle v0.3.3
   Compiling parking_lot_core v0.7.2
   Compiling num_cpus v1.13.0
   Compiling time v0.1.43
   Compiling backtrace v0.3.50
   Compiling quote v1.0.7
   Compiling wgpu-types v0.5.0 (https://github.com/gfx-rs/wgpu?rev=8057acf120f9944056a6b5de6cf326f18ae7671d#8057acf1)
   Compiling tracing-log v0.1.1
   Compiling core-foundation v0.9.0
   Compiling aho-corasick v0.7.13
   Compiling fxhash v0.2.1
   Compiling regex-automata v0.1.9
   Compiling deflate v0.8.6
   Compiling tiff v0.5.0
   Compiling core-foundation v0.7.0
   Compiling vek v0.11.2
   Compiling gfx-hal v0.5.3
   Compiling parking_lot v0.10.2
   Compiling rand_core v0.5.1
   Compiling crossbeam-queue v0.2.3
   Compiling spirv_headers v1.4.2
   Compiling approx v0.3.2
   Compiling core-graphics-types v0.1.0
   Compiling regex v1.3.9
   Compiling matchers v0.0.1
   Compiling png v0.16.7
   Compiling core-graphics v0.19.2
   Compiling objc v0.2.7
   Compiling ansi-parser v0.6.5
   Compiling rand_chacha v0.2.2
   Compiling crossbeam-deque v0.7.3
   Compiling gfx-memory v0.1.3 (https://github.com/gfx-rs/gfx-extras?rev=473a4cdc63463e7986707507c4a7f6a3a767e329#473a4cdc)
   Compiling gfx-backend-empty v0.5.2
   Compiling gfx-descriptor v0.1.0 (https://github.com/gfx-rs/gfx-extras?rev=473a4cdc63463e7986707507c4a7f6a3a767e329#473a4cdc)
   Compiling chrono v0.4.13
   Compiling cocoa-foundation v0.1.0
   Compiling cocoa v0.20.2
   Compiling core-video-sys v0.1.4
   Compiling thiserror-impl v1.0.20
   Compiling futures-macro v0.3.5
   Compiling tracing-attributes v0.1.9
   Compiling rand v0.7.3
   Compiling metal v0.20.0
   Compiling winit v0.22.2
   Compiling thiserror v1.0.20
   Compiling pin-project v0.4.23
   Compiling tracing v0.1.18
   Compiling naga v0.1.0 (https://github.com/gfx-rs/naga?rev=1eb637038dd15fc1dad770eca8e6943424dbc122#1eb63703)
thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', src/librustc_mir/transform/match_branches.rs:54:81
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic
   3: <rustc_mir::transform::match_branches::MatchBranchSimplification as rustc_mir::transform::MirPass>::run_pass
   4: rustc_mir::transform::run_passes
   5: rustc_mir::transform::run_optimization_passes
   6: rustc_mir::transform::inner_optimized_mir
   7: rustc_mir::transform::optimized_mir
   8: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
   9: rustc_data_structures::stack::ensure_sufficient_stack
  10: rustc_query_system::query::plumbing::get_query_impl
  11: rustc_middle::ty::<impl rustc_middle::ty::context::TyCtxt>::instance_mir
  12: rustc_mir::monomorphize::collector::collect_neighbours
  13: rustc_mir::monomorphize::collector::collect_items_rec
  14: rustc_session::utils::<impl rustc_session::session::Session>::time
  15: rustc_mir::monomorphize::collector::collect_crate_mono_items
  16: rustc_mir::monomorphize::partitioning::collect_and_partition_mono_items
  17: rustc_middle::ty::query::<impl rustc_query_system::query::config::QueryAccessors<rustc_middle::ty::context::TyCtxt> for rustc_middle::ty::query::queries::collect_and_partition_mono_items>::compute
  18: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  19: rustc_data_structures::stack::ensure_sufficient_stack
  20: rustc_query_system::query::plumbing::get_query_impl
  21: rustc_codegen_ssa::base::codegen_crate
  22: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
  23: rustc_session::utils::<impl rustc_session::session::Session>::time
  24: rustc_interface::passes::QueryContext::enter
  25: rustc_interface::queries::Queries::ongoing_codegen
  26: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  27: rustc_span::with_source_map
  28: rustc_interface::interface::create_compiler_and_run
  29: rustc_span::with_session_globals
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose 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.47.0-nightly (8e21bd063 2020-08-14) running on x86_64-apple-darwin

note: compiler flags: -C opt-level=2 -C embed-bitcode=no -C debuginfo=2 -C debug-assertions=on --crate-type lib

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

query stack during panic:
#0 [optimized_mir] optimizing MIR for `proc::validator::Validator::validate`
#1 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
error: could not compile `naga`.

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error: build failed

@gretchenfrage gretchenfrage added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 15, 2020
@JulianKnodt
Copy link
Contributor

JulianKnodt commented Aug 15, 2020

Ah there have been recent changes in this file which might've resolved this, do you think you can pull the latest nightly and see if it still occurs?

Edit: After doing so, it appears the bug is still there and the file isn't updated. I think it should be fixed by #75537

@JulianKnodt
Copy link
Contributor

JulianKnodt commented Aug 15, 2020

This is also the same error as #75572, which is actually in the same crate: naga

@jonas-schievink jonas-schievink added the A-mir-opt Area: MIR optimizations label Aug 15, 2020
@jonas-schievink
Copy link
Contributor

Duplicate of #75572

@jonas-schievink jonas-schievink marked this as a duplicate of #75572 Aug 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-mir-opt Area: MIR optimizations C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

3 participants