Closed
Description
auto-reduced (treereduce-rust):
struct Qux;
trait Foo {
fn foo();
}
trait FooBar {
fn foo() {}
}
fn main() {
Qux.foo();
}
original code
original:
//~| NOTE `FooBar` defines an item `foo`, but is explicitly unimplemented
// explicitly unimplemented instead of suggesting to implement it.
#![feature(negative_impls)]
struct Qux;
//~^ NOTE method `clone` not found for this
//~^^ NOTE method `foo` not found for this
impl !Clone for Qux {}
trait Bar {
fn bar(&self);
}
impl !Bar for u32 {}
trait Foo {
fn foo();
}
//~^^^ NOTE `Foo` defines an item `foo`, perhaps you need to implement it
trait FooBar {
fn foo() {}
}
impl !Foo for Qux {}
impl !FooBar for Qux {}
impl !FooBar for u32 {}
fn main() {
Qux.clone();
//~^ ERROR no method named `clone` found for struct `Qux`
//~| NOTE method not found in `Qux`
//~| NOTE `Clone` defines an item `clone`, but is explicitly unimplemented
0_u32.bar();
//~^ ERROR no method named `bar` found for type `u32`
//~| NOTE method not found in `u32`
//~| NOTE `Bar` defines an item `bar`, but is explicitly unimplemented
Qux.foo();
//~^ ERROR no method named `foo` found for struct `Qux`
//~| NOTE method not found in `Qux`
//~| NOTE the following traits define an item `foo`, but are explicitly unimplemented
0_u32.foo();
//~^ ERROR no method named `foo` found for type `u32`
//~| NOTE method not found in `u32`
//~| NOTE `FooBar` defines an item `foo`, but is explicitly unimplemented
}
Version information
rustc 1.75.0-nightly (90fdc1fc2 2023-11-08)
binary: rustc
commit-hash: 90fdc1fc270fef7d1a999207f1da29b41da70dac
commit-date: 2023-11-08
host: x86_64-unknown-linux-gnu
release: 1.75.0-nightly
LLVM version: 17.0.4
Command:
/home/matthias/.rustup/toolchains/master/bin/rustc
Program output
thread 'rustc' panicked at compiler/rustc_hir_typeck/src/method/suggest.rs:3267:28:
index out of bounds: the len is 0 but the index is 0
stack backtrace:
0: 0x7f558c569c9c - std::backtrace_rs::backtrace::libunwind::trace::h4cacad3efd053c57
at /rustc/90fdc1fc270fef7d1a999207f1da29b41da70dac/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
1: 0x7f558c569c9c - std::backtrace_rs::backtrace::trace_unsynchronized::h60a96d4c0f6f19f2
at /rustc/90fdc1fc270fef7d1a999207f1da29b41da70dac/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7f558c569c9c - std::sys_common::backtrace::_print_fmt::h8c87de3e1bb77864
at /rustc/90fdc1fc270fef7d1a999207f1da29b41da70dac/library/std/src/sys_common/backtrace.rs:67:5
3: 0x7f558c569c9c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h90f7d0de2a82d349
at /rustc/90fdc1fc270fef7d1a999207f1da29b41da70dac/library/std/src/sys_common/backtrace.rs:44:22
4: 0x7f558c5cbec0 - core::fmt::rt::Argument::fmt::h2521fae008f201c2
at /rustc/90fdc1fc270fef7d1a999207f1da29b41da70dac/library/core/src/fmt/rt.rs:142:9
5: 0x7f558c5cbec0 - core::fmt::write::hd9fb4ac99710e5d4
at /rustc/90fdc1fc270fef7d1a999207f1da29b41da70dac/library/core/src/fmt/mod.rs:1117:17
6: 0x7f558c55db2f - std::io::Write::write_fmt::h7d3ba14c5ae005be
at /rustc/90fdc1fc270fef7d1a999207f1da29b41da70dac/library/std/src/io/mod.rs:1763:15
7: 0x7f558c569a84 - std::sys_common::backtrace::_print::h0ced51cacaf4784e
at /rustc/90fdc1fc270fef7d1a999207f1da29b41da70dac/library/std/src/sys_common/backtrace.rs:47:5
8: 0x7f558c569a84 - std::sys_common::backtrace::print::h04242fd2f0fdc11a
at /rustc/90fdc1fc270fef7d1a999207f1da29b41da70dac/library/std/src/sys_common/backtrace.rs:34:9
9: 0x7f558c56c717 - std::panicking::default_hook::{{closure}}::he595f6c71a103f6a
10: 0x7f558c56c47f - std::panicking::default_hook::h97b0a6664767309c
at /rustc/90fdc1fc270fef7d1a999207f1da29b41da70dac/library/std/src/panicking.rs:292:9
11: 0x7f558f2905a0 - std[c87f0bd25ad96681]::panicking::update_hook::<alloc[472ad42f6dc9d7e0]::boxed::Box<rustc_driver_impl[91ab505cea6d35d6]::install_ice_hook::{closure#0}>>::{closure#0}
12: 0x7f558c56ce58 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h26f3f48657cb1161
at /rustc/90fdc1fc270fef7d1a999207f1da29b41da70dac/library/alloc/src/boxed.rs:2021:9
13: 0x7f558c56ce58 - std::panicking::rust_panic_with_hook::hfeab6f425309a9cb
at /rustc/90fdc1fc270fef7d1a999207f1da29b41da70dac/library/std/src/panicking.rs:783:13
14: 0x7f558c56cbae - std::panicking::begin_panic_handler::{{closure}}::hcf1b18ee87449b18
at /rustc/90fdc1fc270fef7d1a999207f1da29b41da70dac/library/std/src/panicking.rs:657:13
15: 0x7f558c56a166 - std::sys_common::backtrace::__rust_end_short_backtrace::h3600f6fefa018996
at /rustc/90fdc1fc270fef7d1a999207f1da29b41da70dac/library/std/src/sys_common/backtrace.rs:170:18
16: 0x7f558c56c912 - rust_begin_unwind
at /rustc/90fdc1fc270fef7d1a999207f1da29b41da70dac/library/std/src/panicking.rs:645:5
17: 0x7f558c5c85e5 - core::panicking::panic_fmt::h580fad0f523b6edb
at /rustc/90fdc1fc270fef7d1a999207f1da29b41da70dac/library/core/src/panicking.rs:72:14
18: 0x7f558c5c8802 - core::panicking::panic_bounds_check::h00683c4747a06e3c
at /rustc/90fdc1fc270fef7d1a999207f1da29b41da70dac/library/core/src/panicking.rs:190:5
19: 0x7f558f479ba4 - rustc_hir_typeck[3527dd3ab8e93e18]::method::suggest::print_disambiguation_help
20: 0x7f558f46e581 - <rustc_hir_typeck[3527dd3ab8e93e18]::fn_ctxt::FnCtxt>::note_candidates_on_method_error
21: 0x7f558f465112 - <rustc_hir_typeck[3527dd3ab8e93e18]::fn_ctxt::FnCtxt>::report_no_match_method_error
22: 0x7f558f489655 - <rustc_hir_typeck[3527dd3ab8e93e18]::fn_ctxt::FnCtxt>::report_method_error
23: 0x7f5590f43648 - <rustc_hir_typeck[3527dd3ab8e93e18]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
24: 0x7f55909fb7ed - <rustc_hir_typeck[3527dd3ab8e93e18]::fn_ctxt::FnCtxt>::check_block_with_expected
25: 0x7f5590f39ff4 - <rustc_hir_typeck[3527dd3ab8e93e18]::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
26: 0x7f5590c82f73 - rustc_hir_typeck[3527dd3ab8e93e18]::check::check_fn
27: 0x7f5590743232 - rustc_hir_typeck[3527dd3ab8e93e18]::typeck
28: 0x7f5590742613 - rustc_query_impl[bb198b722ad60ec4]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bb198b722ad60ec4]::query_impl::typeck::dynamic_query::{closure#2}::{closure#0}, rustc_middle[2f3b4338eb4d867d]::query::erase::Erased<[u8; 8usize]>>
29: 0x7f55905260c3 - rustc_query_system[8394796f04c1893f]::query::plumbing::try_execute_query::<rustc_query_impl[bb198b722ad60ec4]::DynamicConfig<rustc_query_system[8394796f04c1893f]::query::caches::VecCache<rustc_span[28e78e1535805e41]::def_id::LocalDefId, rustc_middle[2f3b4338eb4d867d]::query::erase::Erased<[u8; 8usize]>>, false, false, false>, rustc_query_impl[bb198b722ad60ec4]::plumbing::QueryCtxt, false>
30: 0x7f5590525d50 - rustc_query_impl[bb198b722ad60ec4]::query_impl::typeck::get_query_non_incr::__rust_end_short_backtrace
31: 0x7f5590a52848 - rustc_hir_analysis[20751297b0c8f371]::check_crate
32: 0x7f559076c595 - rustc_interface[b068b4732ba2e620]::passes::analysis
33: 0x7f559076c1f7 - rustc_query_impl[bb198b722ad60ec4]::plumbing::__rust_begin_short_backtrace::<rustc_query_impl[bb198b722ad60ec4]::query_impl::analysis::dynamic_query::{closure#2}::{closure#0}, rustc_middle[2f3b4338eb4d867d]::query::erase::Erased<[u8; 1usize]>>
34: 0x7f55912eb840 - rustc_query_system[8394796f04c1893f]::query::plumbing::try_execute_query::<rustc_query_impl[bb198b722ad60ec4]::DynamicConfig<rustc_query_system[8394796f04c1893f]::query::caches::SingleCache<rustc_middle[2f3b4338eb4d867d]::query::erase::Erased<[u8; 1usize]>>, false, false, false>, rustc_query_impl[bb198b722ad60ec4]::plumbing::QueryCtxt, false>
35: 0x7f55912eb647 - rustc_query_impl[bb198b722ad60ec4]::query_impl::analysis::get_query_non_incr::__rust_end_short_backtrace
36: 0x7f559132f9f3 - rustc_interface[b068b4732ba2e620]::interface::run_compiler::<core[ef96f50667b2724]::result::Result<(), rustc_span[28e78e1535805e41]::ErrorGuaranteed>, rustc_driver_impl[91ab505cea6d35d6]::run_compiler::{closure#1}>::{closure#0}
37: 0x7f559130f30a - std[c87f0bd25ad96681]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[b068b4732ba2e620]::util::run_in_thread_with_globals<rustc_interface[b068b4732ba2e620]::util::run_in_thread_pool_with_globals<rustc_interface[b068b4732ba2e620]::interface::run_compiler<core[ef96f50667b2724]::result::Result<(), rustc_span[28e78e1535805e41]::ErrorGuaranteed>, rustc_driver_impl[91ab505cea6d35d6]::run_compiler::{closure#1}>::{closure#0}, core[ef96f50667b2724]::result::Result<(), rustc_span[28e78e1535805e41]::ErrorGuaranteed>>::{closure#0}, core[ef96f50667b2724]::result::Result<(), rustc_span[28e78e1535805e41]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[ef96f50667b2724]::result::Result<(), rustc_span[28e78e1535805e41]::ErrorGuaranteed>>
38: 0x7f559130f133 - <<std[c87f0bd25ad96681]::thread::Builder>::spawn_unchecked_<rustc_interface[b068b4732ba2e620]::util::run_in_thread_with_globals<rustc_interface[b068b4732ba2e620]::util::run_in_thread_pool_with_globals<rustc_interface[b068b4732ba2e620]::interface::run_compiler<core[ef96f50667b2724]::result::Result<(), rustc_span[28e78e1535805e41]::ErrorGuaranteed>, rustc_driver_impl[91ab505cea6d35d6]::run_compiler::{closure#1}>::{closure#0}, core[ef96f50667b2724]::result::Result<(), rustc_span[28e78e1535805e41]::ErrorGuaranteed>>::{closure#0}, core[ef96f50667b2724]::result::Result<(), rustc_span[28e78e1535805e41]::ErrorGuaranteed>>::{closure#0}::{closure#0}, core[ef96f50667b2724]::result::Result<(), rustc_span[28e78e1535805e41]::ErrorGuaranteed>>::{closure#1} as core[ef96f50667b2724]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
39: 0x7f558c577bc5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h17bda90db2405af6
at /rustc/90fdc1fc270fef7d1a999207f1da29b41da70dac/library/alloc/src/boxed.rs:2007:9
40: 0x7f558c577bc5 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hcc57d17e6cd1ea6f
at /rustc/90fdc1fc270fef7d1a999207f1da29b41da70dac/library/alloc/src/boxed.rs:2007:9
41: 0x7f558c577bc5 - std::sys::unix::thread::Thread::new::thread_start::he06af6cad13c0a3a
at /rustc/90fdc1fc270fef7d1a999207f1da29b41da70dac/library/std/src/sys/unix/thread.rs:108:17
42: 0x7f558c3419eb - <unknown>
43: 0x7f558c3c57cc - <unknown>
44: 0x0 - <unknown>
error: 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.75.0-nightly (90fdc1fc2 2023-11-08) running on x86_64-unknown-linux-gnu
query stack during panic:
#0 [typeck] type-checking `main`
#1 [analysis] running analysis passes on this crate
end of query stack