rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
94.88k stars 12.23k forks source link

Compiler Unexpected Panic: index out of bounds #92708

Open tsunrise opened 2 years ago

tsunrise commented 2 years ago

Code

I'm not sure how to produce an minimal example here... but I tried to compile ark-bcs crate here: https://github.com/arkworks-rs/bcs/tree/7c8539b3bd84768abc920897ac6aacf178403f03

Meta

rustc --version --verbose:

rustc 1.59.0-nightly (f8abed9ed 2021-12-26)
binary: rustc
commit-hash: f8abed9ed48bace6be0087bcd44ed534e239b8d8
commit-date: 2021-12-26
host: x86_64-pc-windows-msvc
release: 1.59.0-nightly
LLVM version: 13.0.0

Error output

thread 'rustc' panicked at 'index out of bounds: the len is 379 but the index is 389', compiler\rustc_query_impl\src\on_disk_cache.rs:712:18                                                                  
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-nightly (f8abed9ed 2021-12-26) running on x86_64-pc-windows-msvc

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type lib

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

query stack during panic:
#0 [type_of] computing type of `bcs::simulation_transcript::SimulationTranscript::prover_messages_info`
#1 [inferred_outlives_crate] computing the inferred outlives predicates for items in this crate
end of query stack
error: could not compile `ark-bcs`
Backtrace

``` thread 'rustc' panicked at 'index out of bounds: the len is 379 but the index is 389', compiler\rustc_query_impl\src\on_disk_cache.rs:712:18 stack backtrace: 0: 0x7ffe571d677f - ::fmt::ha14ac31702ace1f3 1: 0x7ffe5720444a - core::fmt::write::h0b23fe237025484e 2: 0x7ffe571c7df8 - ::fmt::h3bfbf14ba3d5317f 3: 0x7ffe571d9f26 - std::panicking::take_hook::hffa15ec901b97064 4: 0x7ffe571d9a09 - std::panicking::take_hook::hffa15ec901b97064 5: 0x7ffe30cf1cd9 - <[i8] as rand[bcd226d3eaf62888]::AsByteSliceMut>::to_le 6: 0x7ffe571da789 - std::panicking::rust_panic_with_hook::h145f4955d18516ac 7: 0x7ffe571da50b - ::get::hc5a1161d800cf4b9 8: 0x7ffe571d70a7 - ::fmt::ha14ac31702ace1f3 9: 0x7ffe571da239 - rust_begin_unwind 10: 0x7ffe57236cb0 - core::panicking::panic_fmt::h8e2ecdf5d83ec6e4 11: 0x7ffe57236c77 - core::panicking::panic_bounds_check::h737a948987edb2cc 12: 0x7ffe345f7f0b - >::de code 13: 0x7ffe345accc6 - <&[(rustc_middle[7b7365041b54fb0d]::ty::Predicate, rustc_span[2116069557bae9a5]::span_encoding::Span)] as rustc_serialize[ba830b73d8fe109f]::serialize::Decodable>::decode 14: 0x7ffe3448dd60 - rustc_query_impl[a59bb0577500cd34]::query_callbacks::diagnostic_hir_wf_check 15: 0x7ffe3445a083 - RNvXsd_NtCsedwKXTSOeye_16rustc_query_impl13on_disk_cacheRINtNtNtNtCseSmLWCZGRrf_3std11collections4hash3set7HashSetNtNtCs2Q7cGApXuuL_10rustc_span6def_id10LocalDefIdINtNtCsf4aqhrItn GP_4core4hash18BuildHasherDefaultNtCskeHs41vGeAj_10rustc_hash8FxHasherEEINtN 16: 0x7ffe344087f8 - ::try_mark_green 17: 0x7ffe3459def9 - <&[(rustc_middle[7b7365041b54fb0d]::ty::Predicate, rustc_span[2116069557bae9a5]::span_encoding::Span)] as rustc_serialize[ba830b73d8fe109f]::serialize::Decodable>::decode 18: 0x7ffe344a30f4 - ::load_side_effects 19: 0x7ffe3459dfe8 - <&[(rustc_middle[7b7365041b54fb0d]::ty::Predicate, rustc_span[2116069557bae9a5]::span_encoding::Span)] as rustc_serialize[ba830b73d8fe109f]::serialize::Decodable>::decode 20: 0x7ffe3444eeea - RNvXsd_NtCsedwKXTSOeye_16rustc_query_impl13on_disk_cacheRINtNtNtNtCseSmLWCZGRrf_3std11collections4hash3set7HashSetNtNtCs2Q7cGApXuuL_10rustc_span6def_id10LocalDefIdINtNtCsf4aqhrItn GP_4core4hash18BuildHasherDefaultNtCskeHs41vGeAj_10rustc_hash8FxHasherEEINtN 21: 0x7ffe344508eb - RNvXsd_NtCsedwKXTSOeye_16rustc_query_impl13on_disk_cacheRINtNtNtNtCseSmLWCZGRrf_3std11collections4hash3set7HashSetNtNtCs2Q7cGApXuuL_10rustc_span6def_id10LocalDefIdINtNtCsf4aqhrItn GP_4core4hash18BuildHasherDefaultNtCskeHs41vGeAj_10rustc_hash8FxHasherEEINtN 22: 0x7ffe3459e0f3 - <&[(rustc_middle[7b7365041b54fb0d]::ty::Predicate, rustc_span[2116069557bae9a5]::span_encoding::Span)] as rustc_serialize[ba830b73d8fe109f]::serialize::Decodable>::decode 23: 0x7ffe34408f04 - ::try_mark_green 24: 0x7ffe3459def9 - <&[(rustc_middle[7b7365041b54fb0d]::ty::Predicate, rustc_span[2116069557bae9a5]::span_encoding::Span)] as rustc_serialize[ba830b73d8fe109f]::serialize::Decodable>::decode 25: 0x7ffe344a09c9 - ::load_side_effects 26: 0x7ffe342fd32b - ::initialize_start_block 27: 0x7ffe343c9482 - ::as_dyn 28: 0x7ffe34289093 - ::initialize_start_block 29: 0x7ffe343761d8 - ::initialize_start_block 30: 0x7ffe338b8ab6 - ::visit_item 31: 0x7ffe3381fe3e - <::visit_item::RegionId a s core[af7f507fbd0dfa75]::fmt::Debug>::fmt 32: 0x7ffe33860b83 - ::fold_region 33: 0x7ffe34410de3 - ::try_mark_green 34: 0x7ffe345467b5 - <&[rustc_ast[f9ec3740b9f34bac]::ast::InlineAsmTemplatePiece] as rustc_serialize[ba830b73d8fe109f]::serialize::Decodable>::decode 35: 0x7ffe343d9f7c - ::as_dyn 36: 0x7ffe34216047 - ::initialize_start_block 37: 0x7ffe3439831c - ::initialize_start_block 38: 0x7ffe3446f697 - rustc_query_impl[a59bb0577500cd34]::query_callbacks::inferred_outlives_crate 39: 0x7ffe351b6063 - ::try_force_from_dep_node 40: 0x7ffe345742fb - <&[rustc_ast[f9ec3740b9f34bac]::ast::InlineAsmTemplatePiece] as rustc_serialize[ba830b73d8fe109f]::serialize::Decodable>::decode 41: 0x7ffe345742d7 - <&[rustc_ast[f9ec3740b9f34bac]::ast::InlineAsmTemplatePiece] as rustc_serialize[ba830b73d8fe109f]::serialize::Decodable>::decode 42: 0x7ffe345742d7 - <&[rustc_ast[f9ec3740b9f34bac]::ast::InlineAsmTemplatePiece] as rustc_serialize[ba830b73d8fe109f]::serialize::Decodable>::decode 43: 0x7ffe345742d7 - <&[rustc_ast[f9ec3740b9f34bac]::ast::InlineAsmTemplatePiece] as rustc_serialize[ba830b73d8fe109f]::serialize::Decodable>::decode 44: 0x7ffe34573f6a - <&[rustc_ast[f9ec3740b9f34bac]::ast::InlineAsmTemplatePiece] as rustc_serialize[ba830b73d8fe109f]::serialize::Decodable>::decode 45: 0x7ffe3432b88c - ::initialize_start_block 46: 0x7ffe34356860 - ::initialize_start_block 47: 0x7ffe338212d2 - <::visit_item::RegionId a s core[af7f507fbd0dfa75]::fmt::Debug>::fmt 48: 0x7ffe3375a4b8 - ::regions 49: 0x7ffe3372f375 - rustc_typeck[941f9db1b1bb2212]::check_crate 50: 0x7ffe30e682bf - rustc_interface[9eb461368c5c4705]::passes::analysis 51: 0x7ffe34410afb - ::try_mark_green 52: 0x7ffe34543dbe - <&[rustc_ast[f9ec3740b9f34bac]::ast::InlineAsmTemplatePiece] as rustc_serialize[ba830b73d8fe109f]::serialize::Decodable>::decode 53: 0x7ffe343d75d1 - ::as_dyn 54: 0x7ffe342d6b49 - ::initialize_start_block 55: 0x7ffe34376322 - ::initialize_start_block 56: 0x7ffe30d7c180 - ::fmt 57: 0x7ffe30d71aa6 - ::fmt 58: 0x7ffe30d0e7e5 - rustc_driver[55170faa71b16ce8]::pretty::print_after_hir_lowering 59: 0x7ffe30d6fe73 - ::fmt 60: 0x7ffe30d1b7d3 - ::fmt 61: 0x7ffe30d8d488 - ::fmt 62: 0x7ffe571e92dc - std::sys::windows::thread::Thread::new::hb9be5e253c09c837 63: 0x7ffec48d7034 - BaseThreadInitThunk 64: 0x7ffec5c22651 - RtlUserThreadStart ```

M1ngXU commented 2 years ago

just had the same problem with my own crate, also using nightly and having issues with a 'type' and a index out of bounds

Edit: same issue with stable version

Edit2: Fixing all clippy issues solved the problem