Closed
Description
Found with a modified fuzz-rustc
Code
trait Dancer {
fn dance(&self) -> _ {
self.dance()
}
}
fn main() {}
Error output
thread 'rustc' panicked at 'index out of bounds: the len is 0 but the index is 0', compiler/rustc_hir_typeck/src/method/probe.rs:1790
Full output (two ICEs with backtraces)
thread 'rustc' panicked at 'index out of bounds: the len is 0 but the index is 0', compiler/rustc_hir_typeck/src/method/probe.rs:1790:14
stack backtrace:
0: 0x10cf9d2a6 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h1901ec5c10c2d477
1: 0x10cffbe2a - core::fmt::write::h453ba3b763f16dfb
2: 0x10cf8f64c - std::io::Write::write_fmt::h35935f9cf41659e0
3: 0x10cf9d08a - std::sys_common::backtrace::print::h48cb2ddd4d16ad05
4: 0x10cfa03d3 - std::panicking::default_hook::{{closure}}::hf85401495f021b7c
5: 0x10cfa0128 - std::panicking::default_hook::hcc698ed67aaec0db
6: 0x116d095fd - rustc_driver[c6bc39476a4ff69]::DEFAULT_HOOK::{closure#0}::{closure#0}
7: 0x10cfa0bb7 - std::panicking::rust_panic_with_hook::h4686e220b4123e59
8: 0x10cfa0964 - std::panicking::begin_panic_handler::{{closure}}::h159a2fe35d7f418a
9: 0x10cf9d748 - std::sys_common::backtrace::__rust_end_short_backtrace::h0017da2a305ee472
10: 0x10cfa062d - _rust_begin_unwind
11: 0x10d0283f3 - core::panicking::panic_fmt::h000b48597e446791
12: 0x10d028536 - core::panicking::panic_bounds_check::h0f3950fbbc766d3f
13: 0x1195f1459 - <rustc_hir_typeck[1fa5b17a40641e23]::method::probe::ProbeContext>::xform_self_ty
14: 0x1195e869e - <rustc_hir_typeck[1fa5b17a40641e23]::method::probe::ProbeContext>::assemble_inherent_candidates
15: 0x1196396d4 - <rustc_infer[c1d1b130600a802d]::infer::InferCtxt>::probe::<core[e7c8723dd1d9fd02]::result::Result<rustc_hir_typeck[1fa5b17a40641e23]::method::probe::Pick, rustc_hir_typeck[1fa5b17a40641e23]::method::MethodError>, <rustc_hir_typeck[1fa5b17a40641e23]::fn_ctxt::FnCtxt>::probe_op<<rustc_hir_typeck[1fa5b17a40641e23]::fn_ctxt::FnCtxt>::probe_for_name::{closure#0}, rustc_hir_typeck[1fa5b17a40641e23]::method::probe::Pick>::{closure#4}>
16: 0x119521d23 - <rustc_hir_typeck[1fa5b17a40641e23]::fn_ctxt::FnCtxt>::probe_for_name
17: 0x1195228a7 - <rustc_hir_typeck[1fa5b17a40641e23]::fn_ctxt::FnCtxt>::lookup_method
18: 0x119510d2d - <rustc_hir_typeck[1fa5b17a40641e23]::fn_ctxt::FnCtxt>::check_expr_kind
19: 0x1194b739f - <rustc_hir_typeck[1fa5b17a40641e23]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
20: 0x1194ce503 - <rustc_hir_typeck[1fa5b17a40641e23]::fn_ctxt::FnCtxt>::check_block_with_expected
21: 0x1195116fc - <rustc_hir_typeck[1fa5b17a40641e23]::fn_ctxt::FnCtxt>::check_expr_kind
22: 0x1194b739f - <rustc_hir_typeck[1fa5b17a40641e23]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
23: 0x1194b84c0 - <rustc_hir_typeck[1fa5b17a40641e23]::fn_ctxt::FnCtxt>::check_return_expr
24: 0x1195efa1f - rustc_hir_typeck[1fa5b17a40641e23]::check::check_fn
25: 0x1195e48a2 - <rustc_hir_typeck[1fa5b17a40641e23]::inherited::InheritedBuilder>::enter::<rustc_hir_typeck[1fa5b17a40641e23]::typeck_with_fallback<rustc_hir_typeck[1fa5b17a40641e23]::typeck::{closure#0}>::{closure#0}::{closure#1}, &rustc_middle[d5319f07d231351a]::ty::context::TypeckResults>
26: 0x119584fa6 - rustc_hir_typeck[1fa5b17a40641e23]::typeck
27: 0x11a58e37f - rustc_query_system[91c4ad596cfd42fe]::query::plumbing::try_execute_query::<rustc_query_impl[5858643fdf1b29eb]::plumbing::QueryCtxt, rustc_query_system[91c4ad596cfd42fe]::query::caches::VecCache<rustc_span[db835ecaf6c42563]::def_id::LocalDefId, &rustc_middle[d5319f07d231351a]::ty::context::TypeckResults>>
28: 0x11a618ac0 - rustc_query_system[91c4ad596cfd42fe]::query::plumbing::get_query::<rustc_query_impl[5858643fdf1b29eb]::queries::typeck, rustc_query_impl[5858643fdf1b29eb]::plumbing::QueryCtxt>
29: 0x11976e2fa - rustc_hir_analysis[59925a650e5b0dbf]::collect::infer_return_ty_for_fn_sig
30: 0x119779ead - rustc_hir_analysis[59925a650e5b0dbf]::collect::fn_sig
31: 0x11a50a7fa - rustc_query_system[91c4ad596cfd42fe]::query::plumbing::try_execute_query::<rustc_query_impl[5858643fdf1b29eb]::plumbing::QueryCtxt, rustc_query_system[91c4ad596cfd42fe]::query::caches::DefaultCache<rustc_span[db835ecaf6c42563]::def_id::DefId, rustc_middle[d5319f07d231351a]::ty::sty::Binder<rustc_middle[d5319f07d231351a]::ty::sty::FnSig>>>
32: 0x11a6187d8 - rustc_query_system[91c4ad596cfd42fe]::query::plumbing::get_query::<rustc_query_impl[5858643fdf1b29eb]::queries::fn_sig, rustc_query_impl[5858643fdf1b29eb]::plumbing::QueryCtxt>
33: 0x11a6af0a5 - <rustc_query_impl[5858643fdf1b29eb]::Queries as rustc_middle[d5319f07d231351a]::ty::query::QueryEngine>::fn_sig
34: 0x119764984 - <rustc_hir_analysis[59925a650e5b0dbf]::collect::CollectItemTypesVisitor as rustc_hir[ee402c82ab6bd85e]::intravisit::Visitor>::visit_trait_item
35: 0x11969c4a9 - <rustc_middle[d5319f07d231351a]::hir::map::Map>::visit_item_likes_in_module::<rustc_hir_analysis[59925a650e5b0dbf]::collect::CollectItemTypesVisitor>
36: 0x119762965 - rustc_hir_analysis[59925a650e5b0dbf]::collect::collect_mod_item_types
37: 0x11a592c4c - rustc_query_system[91c4ad596cfd42fe]::query::plumbing::try_execute_query::<rustc_query_impl[5858643fdf1b29eb]::plumbing::QueryCtxt, rustc_query_system[91c4ad596cfd42fe]::query::caches::VecCache<rustc_span[db835ecaf6c42563]::def_id::LocalDefId, ()>>
38: 0x11a610ecd - rustc_query_system[91c4ad596cfd42fe]::query::plumbing::get_query::<rustc_query_impl[5858643fdf1b29eb]::queries::collect_mod_item_types, rustc_query_impl[5858643fdf1b29eb]::plumbing::QueryCtxt>
39: 0x11969bd3a - <rustc_middle[d5319f07d231351a]::hir::map::Map>::for_each_module::<rustc_hir_analysis[59925a650e5b0dbf]::check_crate::{closure#0}::{closure#0}::{closure#0}>
40: 0x11972d181 - <rustc_session[bf9d936332845243]::session::Session>::track_errors::<rustc_hir_analysis[59925a650e5b0dbf]::check_crate::{closure#0}, ()>
41: 0x11983c758 - rustc_hir_analysis[59925a650e5b0dbf]::check_crate
42: 0x116dd218a - rustc_interface[6b0baa6f0acee236]::passes::analysis
43: 0x11a55e78b - rustc_query_system[91c4ad596cfd42fe]::query::plumbing::try_execute_query::<rustc_query_impl[5858643fdf1b29eb]::plumbing::QueryCtxt, rustc_query_system[91c4ad596cfd42fe]::query::caches::DefaultCache<(), core[e7c8723dd1d9fd02]::result::Result<(), rustc_errors[5974999511236221]::ErrorGuaranteed>>>
44: 0x11a618e8d - rustc_query_system[91c4ad596cfd42fe]::query::plumbing::get_query::<rustc_query_impl[5858643fdf1b29eb]::queries::analysis, rustc_query_impl[5858643fdf1b29eb]::plumbing::QueryCtxt>
45: 0x116c9b6d7 - <rustc_interface[6b0baa6f0acee236]::passes::QueryContext>::enter::<rustc_driver[c6bc39476a4ff69]::run_compiler::{closure#1}::{closure#2}::{closure#2}, core[e7c8723dd1d9fd02]::result::Result<(), rustc_errors[5974999511236221]::ErrorGuaranteed>>
46: 0x116ce1b75 - <rustc_interface[6b0baa6f0acee236]::interface::Compiler>::enter::<rustc_driver[c6bc39476a4ff69]::run_compiler::{closure#1}::{closure#2}, core[e7c8723dd1d9fd02]::result::Result<core[e7c8723dd1d9fd02]::option::Option<rustc_interface[6b0baa6f0acee236]::queries::Linker>, rustc_errors[5974999511236221]::ErrorGuaranteed>>
47: 0x116c7dd5d - rustc_span[db835ecaf6c42563]::with_source_map::<core[e7c8723dd1d9fd02]::result::Result<(), rustc_errors[5974999511236221]::ErrorGuaranteed>, rustc_interface[6b0baa6f0acee236]::interface::run_compiler<core[e7c8723dd1d9fd02]::result::Result<(), rustc_errors[5974999511236221]::ErrorGuaranteed>, rustc_driver[c6bc39476a4ff69]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
48: 0x116cd4a9d - <scoped_tls[9dceb67bf45baec5]::ScopedKey<rustc_span[db835ecaf6c42563]::SessionGlobals>>::set::<rustc_interface[6b0baa6f0acee236]::interface::run_compiler<core[e7c8723dd1d9fd02]::result::Result<(), rustc_errors[5974999511236221]::ErrorGuaranteed>, rustc_driver[c6bc39476a4ff69]::run_compiler::{closure#1}>::{closure#0}, core[e7c8723dd1d9fd02]::result::Result<(), rustc_errors[5974999511236221]::ErrorGuaranteed>>
49: 0x116ca3ffa - std[e853a6d0ec043b70]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[6b0baa6f0acee236]::util::run_in_thread_pool_with_globals<rustc_interface[6b0baa6f0acee236]::interface::run_compiler<core[e7c8723dd1d9fd02]::result::Result<(), rustc_errors[5974999511236221]::ErrorGuaranteed>, rustc_driver[c6bc39476a4ff69]::run_compiler::{closure#1}>::{closure#0}, core[e7c8723dd1d9fd02]::result::Result<(), rustc_errors[5974999511236221]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[e7c8723dd1d9fd02]::result::Result<(), rustc_errors[5974999511236221]::ErrorGuaranteed>>
50: 0x116c842a5 - <<std[e853a6d0ec043b70]::thread::Builder>::spawn_unchecked_<rustc_interface[6b0baa6f0acee236]::util::run_in_thread_pool_with_globals<rustc_interface[6b0baa6f0acee236]::interface::run_compiler<core[e7c8723dd1d9fd02]::result::Result<(), rustc_errors[5974999511236221]::ErrorGuaranteed>, rustc_driver[c6bc39476a4ff69]::run_compiler::{closure#1}>::{closure#0}, core[e7c8723dd1d9fd02]::result::Result<(), rustc_errors[5974999511236221]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[e7c8723dd1d9fd02]::result::Result<(), rustc_errors[5974999511236221]::ErrorGuaranteed>>::{closure#1} as core[e7c8723dd1d9fd02]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
51: 0x10cfa9e87 - std::sys::unix::thread::Thread::new::thread_start::hb253bfeab5e611e1
52: 0x7ff8083354e1 - __pthread_start
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.67.0-nightly (1eb62b123 2022-11-27) running on x86_64-apple-darwin
query stack during panic:
#0 [typeck] type-checking `Dancer::dance`
#1 [fn_sig] computing function signature of `Dancer::dance`
#2 [collect_mod_item_types] collecting item types in top-level module
#3 [analysis] running analysis passes on this crate
end of query stack
error: internal compiler error: no errors encountered even though `delay_span_bug` issued
error: internal compiler error[E0391]: cycle detected when computing function signature of `Dancer::dance`
--> apr.rs:2:5
|
2 | fn dance(&self) -> _ {
| ^^^^^^^^^^^^^^^^^^^^
|
note: ...which requires type-checking `Dancer::dance`...
--> apr.rs:2:5
|
2 | fn dance(&self) -> _ {
| ^^^^^^^^^^^^^^^^^^^^
= note: ...which again requires computing function signature of `Dancer::dance`, completing the cycle
note: cycle used when collecting item types in top-level module
--> apr.rs:1:1
|
1 | / pub trait Dancer {
2 | | fn dance(&self) -> _ {
3 | | self.dance()
4 | | }
5 | | }
6 | |
7 | | fn main() {}
| |____________^
error: internal compiler error: TyKind::Error constructed but no error reported
|
= note: delayed at compiler/rustc_middle/src/values.rs:36:23
thread 'rustc' panicked at 'Box<dyn Any>', compiler/rustc_errors/src/lib.rs:1609:13
stack backtrace:
0: 0x10cf9d2a6 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h1901ec5c10c2d477
1: 0x10cffbe2a - core::fmt::write::h453ba3b763f16dfb
2: 0x10cf8f64c - std::io::Write::write_fmt::h35935f9cf41659e0
3: 0x10cf9d08a - std::sys_common::backtrace::print::h48cb2ddd4d16ad05
4: 0x10cfa03d3 - std::panicking::default_hook::{{closure}}::hf85401495f021b7c
5: 0x10cfa0128 - std::panicking::default_hook::hcc698ed67aaec0db
6: 0x116d095fd - rustc_driver[c6bc39476a4ff69]::DEFAULT_HOOK::{closure#0}::{closure#0}
7: 0x10cfa0bb7 - std::panicking::rust_panic_with_hook::h4686e220b4123e59
8: 0x11b770a87 - std[e853a6d0ec043b70]::panicking::begin_panic::<rustc_errors[5974999511236221]::ExplicitBug>::{closure#0}
9: 0x11b76ee09 - std[e853a6d0ec043b70]::sys_common::backtrace::__rust_end_short_backtrace::<std[e853a6d0ec043b70]::panicking::begin_panic<rustc_errors[5974999511236221]::ExplicitBug>::{closure#0}, !>
10: 0x11bb91609 - std[e853a6d0ec043b70]::panicking::begin_panic::<rustc_errors[5974999511236221]::ExplicitBug>
11: 0x11b760399 - std[e853a6d0ec043b70]::panic::panic_any::<rustc_errors[5974999511236221]::ExplicitBug>
12: 0x11b767742 - <rustc_errors[5974999511236221]::HandlerInner>::flush_delayed::<alloc[374a688e4a400e73]::vec::Vec<rustc_errors[5974999511236221]::diagnostic::Diagnostic>, &str>
13: 0x11b7630e1 - <rustc_errors[5974999511236221]::HandlerInner as core[e7c8723dd1d9fd02]::ops::drop::Drop>::drop
14: 0x116c912b3 - core[e7c8723dd1d9fd02]::ptr::drop_in_place::<rustc_session[bf9d936332845243]::parse::ParseSess>
15: 0x116c92a12 - core[e7c8723dd1d9fd02]::ptr::drop_in_place::<rustc_session[bf9d936332845243]::session::Session>
16: 0x116c82012 - core[e7c8723dd1d9fd02]::ptr::drop_in_place::<rustc_interface[6b0baa6f0acee236]::interface::Compiler>
17: 0x116c7e2bc - rustc_span[db835ecaf6c42563]::with_source_map::<core[e7c8723dd1d9fd02]::result::Result<(), rustc_errors[5974999511236221]::ErrorGuaranteed>, rustc_interface[6b0baa6f0acee236]::interface::run_compiler<core[e7c8723dd1d9fd02]::result::Result<(), rustc_errors[5974999511236221]::ErrorGuaranteed>, rustc_driver[c6bc39476a4ff69]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
18: 0x116cd4a9d - <scoped_tls[9dceb67bf45baec5]::ScopedKey<rustc_span[db835ecaf6c42563]::SessionGlobals>>::set::<rustc_interface[6b0baa6f0acee236]::interface::run_compiler<core[e7c8723dd1d9fd02]::result::Result<(), rustc_errors[5974999511236221]::ErrorGuaranteed>, rustc_driver[c6bc39476a4ff69]::run_compiler::{closure#1}>::{closure#0}, core[e7c8723dd1d9fd02]::result::Result<(), rustc_errors[5974999511236221]::ErrorGuaranteed>>
19: 0x116ca3ffa - std[e853a6d0ec043b70]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[6b0baa6f0acee236]::util::run_in_thread_pool_with_globals<rustc_interface[6b0baa6f0acee236]::interface::run_compiler<core[e7c8723dd1d9fd02]::result::Result<(), rustc_errors[5974999511236221]::ErrorGuaranteed>, rustc_driver[c6bc39476a4ff69]::run_compiler::{closure#1}>::{closure#0}, core[e7c8723dd1d9fd02]::result::Result<(), rustc_errors[5974999511236221]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[e7c8723dd1d9fd02]::result::Result<(), rustc_errors[5974999511236221]::ErrorGuaranteed>>
20: 0x116c842a5 - <<std[e853a6d0ec043b70]::thread::Builder>::spawn_unchecked_<rustc_interface[6b0baa6f0acee236]::util::run_in_thread_pool_with_globals<rustc_interface[6b0baa6f0acee236]::interface::run_compiler<core[e7c8723dd1d9fd02]::result::Result<(), rustc_errors[5974999511236221]::ErrorGuaranteed>, rustc_driver[c6bc39476a4ff69]::run_compiler::{closure#1}>::{closure#0}, core[e7c8723dd1d9fd02]::result::Result<(), rustc_errors[5974999511236221]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[e7c8723dd1d9fd02]::result::Result<(), rustc_errors[5974999511236221]::ErrorGuaranteed>>::{closure#1} as core[e7c8723dd1d9fd02]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
21: 0x10cfa9e87 - std::sys::unix::thread::Thread::new::thread_start::hb253bfeab5e611e1
22: 0x7ff8083354e1 - __pthread_start
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.67.0-nightly (1eb62b123 2022-11-27) running on x86_64-apple-darwin
query stack during panic:
end of query stack
thread panicked while panicking. aborting.
Abort trap: 6
Regression
Regression in nightly-2022-08-18, somewhere in rollup 9c20b2a. I suspect #100389 (@compiler-errors)
Version
rustc 1.67.0-nightly (1eb62b123 2022-11-27)
binary: rustc
commit-hash: 1eb62b1235fd77200e6bd967d70e83c0f2497233
commit-date: 2022-11-27
host: x86_64-apple-darwin
release: 1.67.0-nightly
LLVM version: 15.0.4