Closed
Description
To ICE, both tests must be present. Also, if the code compiles successfully, the cache is poisoned. Until cargo clean
is run, all future runs will compile successfully, even once the offending code is reintroduced. Also, this only ICEs as a lib, not as a binary.
Steps to reproduce:
cargo test
# ICE- remove test1 or test2
cargo test
# compiles- add the test back, such that there are now two tests as before.
cargo test
# still compilescargo clean
cargo test
# ICE
I have been unable to reduce the code further. My apologies for its length. The original was much worse.
Code
lib.rs
:
#![feature(test)]
pub trait Corge<T> {
type Fred;
}
impl Corge<u8> for () {
type Fred = u32;
}
pub trait Waldo {
type Quax;
}
impl Waldo for u32 {
type Quax = u8;
}
pub trait Grault
where
(): Corge<Self::Thud>,
{
type Thud;
fn bar(_: <() as Corge<Self::Thud>>::Fred) {}
}
impl<T> Grault for T
where
T: Waldo,
(): Corge<T::Quax>,
<() as Corge<T::Quax>>::Fred: Waldo,
{
type Thud = u8;
}
pub trait Plugh<I> {
fn baz();
}
#[derive(Copy, Clone, Debug)]
pub struct Qiz<T> {
foo: T,
}
impl<T> Plugh<<() as Corge<T::Thud>>::Fred> for Qiz<T>
where
T: Grault,
(): Corge<T::Thud>,
{
fn baz() {}
}
#[cfg(test)]
mod tests {
use super::{Grault, Plugh, Qiz};
extern crate test;
#[test]
fn test1() {
<u32 as Grault>::bar(0u32);
}
#[test]
fn test2() {
<Qiz<u32> as Plugh<u32>>::baz();
}
}
Meta
rustc --version --verbose
:
rustc 1.49.0-nightly (ffa2e7ae8 2020-10-24)
binary: rustc
commit-hash: ffa2e7ae8fbf9badc035740db949b9dae271c29f
commit-date: 2020-10-24
host: x86_64-unknown-linux-gnu
release: 1.49.0-nightly
LLVM version: 11.0
Error output
$ cargo test --lib
Compiling icedemo v0.1.0 (/home/isaac/go/src/github.ibm.com/ifleonar/bitnn/ice_demo)
thread 'rustc' panicked at 'called `Result::unwrap()` on an `Err` value: ErrorReported', compiler/rustc_mir/src/monomorphize/collector.rs:746:84
stack backtrace:
0: rust_begin_unwind
at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/panicking.rs:483:5
1: core::panicking::panic_fmt
at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/core/src/panicking.rs:85:14
2: core::option::expect_none_failed
at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/core/src/option.rs:1268:5
3: <rustc_mir::monomorphize::collector::MirNeighborCollector as rustc_middle::mir::visit::Visitor>::visit_terminator
4: rustc_mir::monomorphize::collector::collect_neighbours
5: rustc_mir::monomorphize::collector::collect_items_rec
6: rustc_mir::monomorphize::collector::collect_items_rec
7: rustc_mir::monomorphize::collector::collect_items_rec
8: rustc_session::utils::<impl rustc_session::session::Session>::time
9: rustc_mir::monomorphize::collector::collect_crate_mono_items
10: rustc_mir::monomorphize::partitioning::collect_and_partition_mono_items
11: 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
12: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
13: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
14: rustc_data_structures::stack::ensure_sufficient_stack
15: rustc_query_system::query::plumbing::get_query_impl
16: rustc_codegen_ssa::base::codegen_crate
17: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
18: rustc_interface::passes::QueryContext::enter
19: rustc_interface::queries::Queries::ongoing_codegen
20: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
21: rustc_span::with_source_map
22: rustc_interface::interface::create_compiler_and_run
23: scoped_tls::ScopedKey<T>::set
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.49.0-nightly (ffa2e7ae8 2020-10-24) running on x86_64-unknown-linux-gnu
note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
#0 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
error: internal compiler error: Encountered error `Unimplemented` selecting `Binder(<Qiz<u32> as Plugh<u32>>)` during codegen
|
= note: delayed at compiler/rustc_trait_selection/src/traits/codegen.rs:68:32
thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:961:13
stack backtrace:
0: 0x7fc78a054a20 - std::backtrace_rs::backtrace::libunwind::trace::h303a626d53553a64
at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/../../backtrace/src/backtrace/libunwind.rs:100:5
1: 0x7fc78a054a20 - std::backtrace_rs::backtrace::trace_unsynchronized::h6abb882733c3f18c
at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x7fc78a054a20 - std::sys_common::backtrace::_print_fmt::h57829321f1d9217a
at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/sys_common/backtrace.rs:67:5
3: 0x7fc78a054a20 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h400b66a054640aac
at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/sys_common/backtrace.rs:46:22
4: 0x7fc78a0c3e9c - core::fmt::write::h1857a60b204f1b6a
at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/core/src/fmt/mod.rs:1076:17
5: 0x7fc78a046642 - std::io::Write::write_fmt::h6453b28c8b27c6ea
at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/io/mod.rs:1516:15
6: 0x7fc78a0599d5 - std::sys_common::backtrace::_print::h15cc4b3923cc9bc0
at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/sys_common/backtrace.rs:49:5
7: 0x7fc78a0599d5 - std::sys_common::backtrace::print::h953c7be178c0674d
at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/sys_common/backtrace.rs:36:9
8: 0x7fc78a0599d5 - std::panicking::default_hook::{{closure}}::h635d667f571198f0
at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/panicking.rs:208:50
9: 0x7fc78a059678 - std::panicking::default_hook::h3bc2efb48060abaa
at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/panicking.rs:227:9
10: 0x7fc78a922618 - rustc_driver::report_ice::hbf1325c7565687ba
11: 0x7fc78a05a216 - std::panicking::rust_panic_with_hook::h887eb0c89f46b8b2
at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/panicking.rs:581:17
12: 0x7fc78a059d99 - std::panicking::begin_panic_handler::{{closure}}::hf0d3f46d37dd3bc1
at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/panicking.rs:484:9
13: 0x7fc78a054ebc - std::sys_common::backtrace::__rust_end_short_backtrace::h4bce8b52717576e3
at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/sys_common/backtrace.rs:141:18
14: 0x7fc78a059d59 - rust_begin_unwind
at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/panicking.rs:483:5
15: 0x7fc78a059d0b - std::panicking::begin_panic_fmt::h53297a84a5b19714
at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/panicking.rs:437:5
16: 0x7fc78d9056b1 - rustc_errors::HandlerInner::flush_delayed::he2542202d1def2d9
17: 0x7fc78d902011 - <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop::h024d44c0c68aef34
18: 0x7fc78a932196 - core::ptr::drop_in_place::he2f10e88cd1e7c3b
19: 0x7fc78a935d46 - <alloc::rc::Rc<T> as core::ops::drop::Drop>::drop::hffa852c3f111defc
20: 0x7fc78a912a1d - core::ptr::drop_in_place::h772d28eb02df6d6d
21: 0x7fc78a90481d - rustc_span::with_source_map::h3820d41b3a036910
22: 0x7fc78a93e9c2 - rustc_interface::interface::create_compiler_and_run::h08ad396f4e7721e0
23: 0x7fc78a926d5a - scoped_tls::ScopedKey<T>::set::hd425a36fbe06985e
24: 0x7fc78a9439b5 - std::sys_common::backtrace::__rust_begin_short_backtrace::h23925571219dbc63
25: 0x7fc78a8c13ce - core::ops::function::FnOnce::call_once{{vtable.shim}}::h43b61b9af30b3669
26: 0x7fc78a06921a - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h88864ee659ddb161
at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/alloc/src/boxed.rs:1042:9
27: 0x7fc78a06921a - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h9f03cbdc7ab33431
at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/alloc/src/boxed.rs:1042:9
28: 0x7fc78a06921a - std::sys::unix::thread::Thread::new::thread_start::h5979dd5560a11418
at /rustc/ffa2e7ae8fbf9badc035740db949b9dae271c29f/library/std/src/sys/unix/thread.rs:89:17
29: 0x7fc789f863e9 - start_thread
30: 0x7fc789ea3293 - __GI___clone
31: 0x0 - <unknown>
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.49.0-nightly (ffa2e7ae8 2020-10-24) running on x86_64-unknown-linux-gnu
note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental
note: some of the compiler flags provided by cargo are hidden
query stack during panic:
end of query stack
thread panicked while panicking. aborting.
error: could not compile `icedemo`
Caused by:
process didn't exit successfully: `rustc --crate-name icedemo --edition=2018 src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 --test -C metadata=7ccb3572c942ab87 -C extra-filename=-7ccb3572c942ab87 --out-dir /home/isaac/go/src/github.ibm.com/ifleonar/bitnn/ice_demo/target/debug/deps -C incremental=/home/isaac/go/src/github.ibm.com/ifleonar/bitnn/ice_demo/target/debug/incremental -L dependency=/home/isaac/go/src/github.ibm.com/ifleonar/bitnn/ice_demo/target/debug/deps` (signal: 4, SIGILL: illegal instruction)
Metadata
Metadata
Assignees
Labels
Category: This is a bug.Call for participation: An issue has been fixed and does not reproduce, but no test has been added.Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️Medium priorityRelevant to the compiler team, which will review and decide on the PR/issue.ICE tracked in rust-lang/glacier.Performance or correctness regression from one stable version to another.