-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
Code
pub trait T {
fn f();
}
pub struct S;
impl S {
pub fn f() {}
}
fn main() {
let s = S;
s.f();
}
Meta
rustc --version --verbose
:
rustc 1.75.0 (82e1608df 2023-12-21)
binary: rustc
commit-hash: 82e1608dfa6e0b5569232559e3d385fea5a93112
commit-date: 2023-12-21
host: aarch64-apple-darwin
release: 1.75.0
LLVM version: 17.0.6
The bug is not present in nightly:
rustc --version --verbose
:
rustc 1.77.0-nightly (190f4c961 2024-01-09)
binary: rustc
commit-hash: 190f4c96116a3b59b7de4881cfec544be0246d84
commit-date: 2024-01-09
host: aarch64-apple-darwin
release: 1.77.0-nightly
LLVM version: 17.0.6
Error output
thread 'rustc' panicked at compiler/rustc_hir_typeck/src/method/suggest.rs:3299:28:
index out of bounds: the len is 0 but the index is 0
stack backtrace:
0: 0x103d4d304 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h298c9ab285ff3934
1: 0x103d8f2c8 - core::fmt::write::h4e276abdb6d0c2a1
2: 0x103d43ac4 - std::io::Write::write_fmt::hd421848f5f0bf9d0
3: 0x103d4d140 - std::sys_common::backtrace::print::hd8bd9ecab1f94b94
4: 0x103d4fb40 - std::panicking::default_hook::{{closure}}::h520eeb743fc98fb4
5: 0x103d4f888 - std::panicking::default_hook::ha6550ffe49b63df1
6: 0x10ce49688 - <alloc[7c7540ab8626f01a]::boxed::Box<rustc_driver_impl[468d0e274936ffb9]::install_ice_hook::{closure#0}> as core[5213bbcd403abe9e]::ops::function::Fn<(&dyn for<'a, 'b> core[5213bbcd403abe9e]::ops::function::Fn<(&'a core[5213bbcd403abe9e]::panic::panic_info::PanicInfo<'b>,), Output = ()> + core[5213bbcd403abe9e]::marker::Send + core[5213bbcd403abe9e]::marker::Sync, &core[5213bbcd403abe9e]::panic::panic_info::PanicInfo)>>::call
7: 0x103d501b8 - std::panicking::rust_panic_with_hook::hddb0e884a202de7c
8: 0x103d4ff80 - std::panicking::begin_panic_handler::{{closure}}::hd2798398a2fd9077
9: 0x103d4d76c - std::sys_common::backtrace::__rust_end_short_backtrace::h9201cc364dbb8a23
10: 0x103d4fd1c - _rust_begin_unwind
11: 0x103da9118 - core::panicking::panic_fmt::h4d5168028d4c43c7
12: 0x103da92a4 - core::panicking::panic_bounds_check::h17fa693e54374598
13: 0x10d2dbab4 - rustc_hir_typeck[67526d70d648d1bc]::method::suggest::print_disambiguation_help
14: 0x10d2316e0 - <rustc_hir_typeck[67526d70d648d1bc]::fn_ctxt::FnCtxt>::note_candidates_on_method_error
15: 0x10d2287dc - <rustc_hir_typeck[67526d70d648d1bc]::fn_ctxt::FnCtxt>::report_no_match_method_error
16: 0x10d2593a0 - <rustc_hir_typeck[67526d70d648d1bc]::fn_ctxt::FnCtxt>::report_method_error
17: 0x10d24f0d4 - <rustc_hir_typeck[67526d70d648d1bc]::fn_ctxt::FnCtxt>::check_expr_kind
18: 0x10d1f6a54 - <rustc_hir_typeck[67526d70d648d1bc]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
19: 0x10d212c90 - <rustc_hir_typeck[67526d70d648d1bc]::fn_ctxt::FnCtxt>::check_stmt
20: 0x10d213264 - <rustc_hir_typeck[67526d70d648d1bc]::fn_ctxt::FnCtxt>::check_block_with_expected
21: 0x10d1f6a54 - <rustc_hir_typeck[67526d70d648d1bc]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
22: 0x10d1f7c80 - <rustc_hir_typeck[67526d70d648d1bc]::fn_ctxt::FnCtxt>::check_return_expr
23: 0x10d328634 - rustc_hir_typeck[67526d70d648d1bc]::check::check_fn
24: 0x10d2a9fe0 - rustc_hir_typeck[67526d70d648d1bc]::typeck
25: 0x10df871a0 - rustc_query_impl[5bcaede170c3d419]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[5bcaede170c3d419]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[ca6410b6d29fc80e]::query::erase::Erased<[u8; 8usize]>>
26: 0x10e07867c - <rustc_query_impl[5bcaede170c3d419]::query_impl::typeck::dynamic_query::{closure#2} as core[5213bbcd403abe9e]::ops::function::FnOnce<(rustc_middle[ca6410b6d29fc80e]::ty::context::TyCtxt, rustc_span[e10e2d7f054ef3fb]::def_id::LocalDefId)>>::call_once
27: 0x10df4f120 - rustc_query_system[879461235231c87d]::query::plumbing::try_execute_query::<rustc_query_impl[5bcaede170c3d419]::DynamicConfig<rustc_query_system[879461235231c87d]::query::caches::VecCache<rustc_span[e10e2d7f054ef3fb]::def_id::LocalDefId, rustc_middle[ca6410b6d29fc80e]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[5bcaede170c3d419]::plumbing::QueryCtxt, true>
28: 0x10e01e2f8 - rustc_query_impl[5bcaede170c3d419]::query_impl::typeck::get_query_incr::__rust_end_short_backtrace
29: 0x10d140d10 - std[1bb08b5702199c76]::panicking::try::<(), core[5213bbcd403abe9e]::panic::unwind_safe::AssertUnwindSafe<rustc_data_structures[919fbfa8d0821c7b]::sync::parallel::disabled::par_for_each_in<&[rustc_span[e10e2d7f054ef3fb]::def_id::LocalDefId], <rustc_middle[ca6410b6d29fc80e]::hir::map::Map>::par_body_owners<rustc_hir_analysis[709ef6bc47d99aaa]::check_crate::{closure#7}>::{closure#0}>::{closure#0}::{closure#0}::{closure#0}>>
30: 0x10d0ec8c4 - <rustc_data_structures[919fbfa8d0821c7b]::sync::parallel::ParallelGuard>::run::<(), rustc_data_structures[919fbfa8d0821c7b]::sync::parallel::disabled::par_for_each_in<&[rustc_span[e10e2d7f054ef3fb]::def_id::LocalDefId], <rustc_middle[ca6410b6d29fc80e]::hir::map::Map>::par_body_owners<rustc_hir_analysis[709ef6bc47d99aaa]::check_crate::{closure#7}>::{closure#0}>::{closure#0}::{closure#0}::{closure#0}>
31: 0x10d0e62c8 - rustc_hir_analysis[709ef6bc47d99aaa]::check_crate
32: 0x10d537ac0 - rustc_interface[ea1e3d08865d7976]::passes::analysis
33: 0x10df8723c - rustc_query_impl[5bcaede170c3d419]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[5bcaede170c3d419]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[ca6410b6d29fc80e]::query::erase::Erased<[u8; 1usize]>>
34: 0x10e0eec04 - <rustc_query_impl[5bcaede170c3d419]::query_impl::analysis::dynamic_query::{closure#2} as core[5213bbcd403abe9e]::ops::function::FnOnce<(rustc_middle[ca6410b6d29fc80e]::ty::context::TyCtxt, ())>>::call_once
35: 0x10def2754 - rustc_query_system[879461235231c87d]::query::plumbing::try_execute_query::<rustc_query_impl[5bcaede170c3d419]::DynamicConfig<rustc_query_system[879461235231c87d]::query::caches::SingleCache<rustc_middle[ca6410b6d29fc80e]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[5bcaede170c3d419]::plumbing::QueryCtxt, true>
36: 0x10e00f374 - rustc_query_impl[5bcaede170c3d419]::query_impl::analysis::get_query_incr::__rust_end_short_backtrace
37: 0x10ce21228 - <rustc_middle[ca6410b6d29fc80e]::ty::context::GlobalCtxt>::enter::<rustc_driver_impl[468d0e274936ffb9]::run_compiler::{closure#1}::{closure#2}::{closure#6}, core[5213bbcd403abe9e]::result::Result<(), rustc_span[e10e2d7f054ef3fb]::ErrorGuaranteed>>
38: 0x10ce202d4 - rustc_span[e10e2d7f054ef3fb]::set_source_map::<core[5213bbcd403abe9e]::result::Result<(), rustc_span[e10e2d7f054ef3fb]::ErrorGuaranteed>, rustc_interface[ea1e3d08865d7976]::interface::run_compiler<core[5213bbcd403abe9e]::result::Result<(), rustc_span[e10e2d7f054ef3fb]::ErrorGuaranteed>, rustc_driver_impl[468d0e274936ffb9]::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
39: 0x10ce65764 - <scoped_tls[299824ca9de1a1fb]::ScopedKey<rustc_span[e10e2d7f054ef3fb]::SessionGlobals>>::set::<rustc_interface[ea1e3d08865d7976]::interface::run_compiler<core[5213bbcd403abe9e]::result::Result<(), rustc_span[e10e2d7f054ef3fb]::ErrorGuaranteed>, rustc_driver_impl[468d0e274936ffb9]::run_compiler::{closure#1}>::{closure#0}, core[5213bbcd403abe9e]::result::Result<(), rustc_span[e10e2d7f054ef3fb]::ErrorGuaranteed>>
40: 0x10ce20bf8 - rustc_span[e10e2d7f054ef3fb]::create_session_globals_then::<core[5213bbcd403abe9e]::result::Result<(), rustc_span[e10e2d7f054ef3fb]::ErrorGuaranteed>, rustc_interface[ea1e3d08865d7976]::interface::run_compiler<core[5213bbcd403abe9e]::result::Result<(), rustc_span[e10e2d7f054ef3fb]::ErrorGuaranteed>, rustc_driver_impl[468d0e274936ffb9]::run_compiler::{closure#1}>::{closure#0}>
41: 0x10ce52d74 - std[1bb08b5702199c76]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[ea1e3d08865d7976]::util::run_in_thread_with_globals<rustc_interface[ea1e3d08865d7976]::interface::run_compiler<core[5213bbcd403abe9e]::result::Result<(), rustc_span[e10e2d7f054ef3fb]::ErrorGuaranteed>, rustc_driver_impl[468d0e274936ffb9]::run_compiler::{closure#1}>::{closure#0}, core[5213bbcd403abe9e]::result::Result<(), rustc_span[e10e2d7f054ef3fb]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[5213bbcd403abe9e]::result::Result<(), rustc_span[e10e2d7f054ef3fb]::ErrorGuaranteed>>
42: 0x10ce6bbc0 - <<std[1bb08b5702199c76]::thread::Builder>::spawn_unchecked_<rustc_interface[ea1e3d08865d7976]::util::run_in_thread_with_globals<rustc_interface[ea1e3d08865d7976]::interface::run_compiler<core[5213bbcd403abe9e]::result::Result<(), rustc_span[e10e2d7f054ef3fb]::ErrorGuaranteed>, rustc_driver_impl[468d0e274936ffb9]::run_compiler::{closure#1}>::{closure#0}, core[5213bbcd403abe9e]::result::Result<(), rustc_span[e10e2d7f054ef3fb]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[5213bbcd403abe9e]::result::Result<(), rustc_span[e10e2d7f054ef3fb]::ErrorGuaranteed>>::{closure#1} as core[5213bbcd403abe9e]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
43: 0x103d583b4 - std::sys::unix::thread::Thread::new::thread_start::h9b6324e2391e6ebb
44: 0x185a9e034 - __pthread_joiner_wake
Backtrace
thread 'rustc' panicked at compiler/rustc_hir_typeck/src/method/suggest.rs:3299:28:
index out of bounds: the len is 0 but the index is 0
stack backtrace:
0: _rust_begin_unwind
1: core::panicking::panic_fmt
2: core::panicking::panic_bounds_check
3: rustc_hir_typeck::method::suggest::print_disambiguation_help
4: <rustc_hir_typeck::fn_ctxt::FnCtxt>::note_candidates_on_method_error
5: <rustc_hir_typeck::fn_ctxt::FnCtxt>::report_no_match_method_error
6: <rustc_hir_typeck::fn_ctxt::FnCtxt>::report_method_error
7: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_kind
8: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
9: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_stmt
10: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_block_with_expected
11: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
12: <rustc_hir_typeck::fn_ctxt::FnCtxt>::check_return_expr
13: rustc_hir_typeck::check::check_fn
14: rustc_hir_typeck::typeck
[... omitted 2 frames ...]
15: std::panicking::try::<(), core::panic::unwind_safe::AssertUnwindSafe<rustc_data_structures::sync::parallel::disabled::par_for_each_in<&[rustc_span::def_id::LocalDefId], <rustc_middle::hir::map::Map>::par_body_owners<rustc_hir_analysis::check_crate::{closure#7}>::{closure#0}>::{closure#0}::{closure#0}::{closure#0}>>
16: <rustc_data_structures::sync::parallel::ParallelGuard>::run::<(), rustc_data_structures::sync::parallel::disabled::par_for_each_in<&[rustc_span::def_id::LocalDefId], <rustc_middle::hir::map::Map>::par_body_owners<rustc_hir_analysis::check_crate::{closure#7}>::{closure#0}>::{closure#0}::{closure#0}::{closure#0}>
17: rustc_hir_analysis::check_crate
18: rustc_interface::passes::analysis
[... omitted 2 frames ...]
19: <rustc_middle::ty::context::GlobalCtxt>::enter::<rustc_driver_impl::run_compiler::{closure#1}::{closure#2}::{closure#6}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
20: rustc_span::set_source_map::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}::{closure#0}>
21: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
22: rustc_span::create_session_globals_then::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#1}>::{closure#0}>
Metadata
Metadata
Assignees
Labels
C-bugCategory: This is a bug.Category: This is a bug.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.