Skip to content

ICE: panicked at 'index out of bounds: the len is 0 but the index is 0', could not prove Binder(TraitPredicate(<bool as Copy>), []) #87573

Closed
@chengniansun

Description

@chengniansun

Might be a duplicate of #86535

Code

#![feature(no_core, lang_items)]
#![no_core]
static STATIC_BOOL: bool = true;
#[lang = "sized"]
trait Sized {}
#[lang = "copy"]
trait Copy {}
#[lang = "sync"]
trait Sync {}
impl Sync for bool {}
#[lang = "drop_in_place"]
fn main() {
    while false {}
}

Meta

rustc --version --verbose:

rustc 1.56.0-nightly (2faabf579 2021-07-27)
binary: rustc
commit-hash: 2faabf579323f5252329264cc53ba9ff803429a3
commit-date: 2021-07-27
host: x86_64-unknown-linux-gnu
release: 1.56.0-nightly
LLVM version: 12.0.1

Error output

warning: static is never used: `STATIC_BOOL`
 --> mutant.rs:3:1
  |
3 | static STATIC_BOOL: bool = true;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(dead_code)]` on by default

thread 'rustc' panicked at 'index out of bounds: the len is 0 but the index is 0', /rustc/2faabf579323f5252329264cc53ba9ff803429a3/compiler/rustc_middle/src/ty/subst.rs:303:43
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.56.0-nightly (2faabf579 2021-07-27) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type staticlib

query stack during panic:
#0 [resolve_instance] resolving instance `main`
#1 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
warning: 1 warning emitted

error: internal compiler error: broken MIR in DefId(0:6 ~ mutant[d0c6]::main) (NoSolution): could not prove Binder(TraitPredicate(<bool as Copy>), [])
  |
  = note: delayed at compiler/rustc_mir/src/borrow_check/type_check/mod.rs:299:27

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:1050:13
stack backtrace:
   0:     0x7fc5bb8e4f50 - std::backtrace_rs::backtrace::libunwind::trace::h99dbb39dca18857d
                               at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x7fc5bb8e4f50 - std::backtrace_rs::backtrace::trace_unsynchronized::h832861927e9cfedf
                               at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fc5bb8e4f50 - std::sys_common::backtrace::_print_fmt::h3d18154c77dcf310
                               at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7fc5bb8e4f50 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::he312f4ad5b9bb346
                               at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x7fc5bb952bbc - core::fmt::write::h9a6d9c74526a6c1b
                               at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/core/src/fmt/mod.rs:1115:17
   5:     0x7fc5bb8d6835 - std::io::Write::write_fmt::h6aced00850e8186f
                               at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/io/mod.rs:1665:15
   6:     0x7fc5bb8e8c6b - std::sys_common::backtrace::_print::h65d996766de40da4
                               at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x7fc5bb8e8c6b - std::sys_common::backtrace::print::h40df9727e635f303
                               at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x7fc5bb8e8c6b - std::panicking::default_hook::{{closure}}::hd2da4327dea91a51
                               at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/panicking.rs:208:50
   9:     0x7fc5bb8e8741 - std::panicking::default_hook::h3d55120ad6ada158
                               at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/panicking.rs:225:9
  10:     0x7fc5bc0c5611 - rustc_driver::DEFAULT_HOOK::{{closure}}::{{closure}}::h6c854bb74ca75dad
  11:     0x7fc5bb8e9499 - std::panicking::rust_panic_with_hook::hf85dd0bb545e3b55
                               at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/panicking.rs:626:17
  12:     0x7fc5bb8e8f57 - std::panicking::begin_panic_handler::{{closure}}::h736ae969434da9fa
                               at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/panicking.rs:519:13
  13:     0x7fc5bb8e542c - std::sys_common::backtrace::__rust_end_short_backtrace::h6133bb80b1d6c3e0
                               at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/sys_common/backtrace.rs:141:18
  14:     0x7fc5bb8e8eb9 - rust_begin_unwind
                               at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/panicking.rs:515:5
  15:     0x7fc5bb8b1eab - std::panicking::begin_panic_fmt::hf70e90a601287d8b
                               at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/panicking.rs:457:5
  16:     0x7fc5be50b3d9 - rustc_errors::HandlerInner::flush_delayed::h400415fe09e32e42
  17:     0x7fc5be509e3d - <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop::h99b093f7064b7696
  18:     0x7fc5bdbc68e6 - core::ptr::drop_in_place<rustc_session::parse::ParseSess>::hd2c66b9140bd0417
  19:     0x7fc5bdbc8bfe - <alloc::rc::Rc<T> as core::ops::drop::Drop>::drop::hd322edc4934bdbe3
  20:     0x7fc5bdb9c57d - core::ptr::drop_in_place<rustc_interface::interface::Compiler>::hba47a069d6e06a26
  21:     0x7fc5bdb9be3c - rustc_span::with_source_map::hdc8c4c7d7611fe77
  22:     0x7fc5bdbae0ba - rustc_interface::interface::create_compiler_and_run::hbe7a78745769ff96
  23:     0x7fc5bdba0e19 - scoped_tls::ScopedKey<T>::set::ha164143a03306a1b
  24:     0x7fc5bdb9ceba - std::sys_common::backtrace::__rust_begin_short_backtrace::h4dd3c27220dda569
  25:     0x7fc5bdb9c335 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h546778848e9193e6
  26:     0x7fc5bb8f5a27 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h09f167e08fc945ff
                               at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/alloc/src/boxed.rs:1572:9
  27:     0x7fc5bb8f5a27 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hf814fe85eeb118e0
                               at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/alloc/src/boxed.rs:1572:9
  28:     0x7fc5bb8f5a27 - std::sys::unix::thread::Thread::new::thread_start::hb71b17934c5f5e68
                               at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/sys/unix/thread.rs:91:17
  29:     0x7fc5bb822609 - start_thread
  30:     0x7fc5bb736293 - 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.56.0-nightly (2faabf579 2021-07-27) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type staticlib

query stack during panic:
end of query stack
thread panicked while panicking. aborting.
Backtrace

warning: static is never used: `STATIC_BOOL`
 --> mutant.rs:3:1
  |
3 | static STATIC_BOOL: bool = true;
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: `#[warn(dead_code)]` on by default

thread 'rustc' panicked at 'index out of bounds: the len is 0 but the index is 0', /rustc/2faabf579323f5252329264cc53ba9ff803429a3/compiler/rustc_middle/src/ty/subst.rs:303:43
stack backtrace:
   0: rust_begin_unwind
             at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/panicking.rs:515:5
   1: core::panicking::panic_fmt
             at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/core/src/panicking.rs:92:14
   2: core::panicking::panic_bounds_check
             at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/core/src/panicking.rs:69:5
   3: rustc_ty_utils::instance::inner_resolve_instance
   4: rustc_ty_utils::instance::resolve_instance
   5: rustc_query_system::query::plumbing::get_query_impl
   6: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::resolve_instance
   7: rustc_middle::ty::instance::Instance::resolve_opt_const_arg
   8: rustc_middle::ty::instance::Instance::resolve_drop_in_place
   9: rustc_mir::monomorphize::collector::collect_items_rec
  10: rustc_mir::monomorphize::collector::collect_crate_mono_items
  11: rustc_mir::monomorphize::partitioning::collect_and_partition_mono_items
  12: rustc_query_system::query::plumbing::get_query_impl
  13: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::collect_and_partition_mono_items
  14: <rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::backend::CodegenBackend>::codegen_crate
  15: rustc_interface::passes::QueryContext::enter
  16: rustc_interface::queries::Queries::ongoing_codegen
  17: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  18: rustc_span::with_source_map
  19: rustc_interface::interface::create_compiler_and_run
  20: 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.56.0-nightly (2faabf579 2021-07-27) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type staticlib

query stack during panic:
#0 [resolve_instance] resolving instance `main`
#1 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
warning: 1 warning emitted

error: internal compiler error: broken MIR in DefId(0:6 ~ mutant[d0c6]::main) (NoSolution): could not prove Binder(TraitPredicate(<bool as Copy>), [])
  |
  = note: delayed at compiler/rustc_mir/src/borrow_check/type_check/mod.rs:299:27

thread 'rustc' panicked at 'no errors encountered even though `delay_span_bug` issued', compiler/rustc_errors/src/lib.rs:1050:13
stack backtrace:
   0:     0x7fa952871f50 - std::backtrace_rs::backtrace::libunwind::trace::h99dbb39dca18857d
                               at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/../../backtrace/src/backtrace/libunwind.rs:90:5
   1:     0x7fa952871f50 - std::backtrace_rs::backtrace::trace_unsynchronized::h832861927e9cfedf
                               at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fa952871f50 - std::sys_common::backtrace::_print_fmt::h3d18154c77dcf310
                               at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x7fa952871f50 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::he312f4ad5b9bb346
                               at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/sys_common/backtrace.rs:46:22
   4:     0x7fa9528dfbbc - core::fmt::write::h9a6d9c74526a6c1b
                               at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/core/src/fmt/mod.rs:1115:17
   5:     0x7fa952863835 - std::io::Write::write_fmt::h6aced00850e8186f
                               at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/io/mod.rs:1665:15
   6:     0x7fa952875c6b - std::sys_common::backtrace::_print::h65d996766de40da4
                               at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/sys_common/backtrace.rs:49:5
   7:     0x7fa952875c6b - std::sys_common::backtrace::print::h40df9727e635f303
                               at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/sys_common/backtrace.rs:36:9
   8:     0x7fa952875c6b - std::panicking::default_hook::{{closure}}::hd2da4327dea91a51
                               at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/panicking.rs:208:50
   9:     0x7fa952875741 - std::panicking::default_hook::h3d55120ad6ada158
                               at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/panicking.rs:225:9
  10:     0x7fa953052611 - rustc_driver::DEFAULT_HOOK::{{closure}}::{{closure}}::h6c854bb74ca75dad
  11:     0x7fa952876499 - std::panicking::rust_panic_with_hook::hf85dd0bb545e3b55
                               at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/panicking.rs:626:17
  12:     0x7fa952875f57 - std::panicking::begin_panic_handler::{{closure}}::h736ae969434da9fa
                               at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/panicking.rs:519:13
  13:     0x7fa95287242c - std::sys_common::backtrace::__rust_end_short_backtrace::h6133bb80b1d6c3e0
                               at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/sys_common/backtrace.rs:141:18
  14:     0x7fa952875eb9 - rust_begin_unwind
                               at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/panicking.rs:515:5
  15:     0x7fa95283eeab - std::panicking::begin_panic_fmt::hf70e90a601287d8b
                               at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/panicking.rs:457:5
  16:     0x7fa9554983d9 - rustc_errors::HandlerInner::flush_delayed::h400415fe09e32e42
  17:     0x7fa955496e3d - <rustc_errors::HandlerInner as core::ops::drop::Drop>::drop::h99b093f7064b7696
  18:     0x7fa954b538e6 - core::ptr::drop_in_place<rustc_session::parse::ParseSess>::hd2c66b9140bd0417
  19:     0x7fa954b55bfe - <alloc::rc::Rc<T> as core::ops::drop::Drop>::drop::hd322edc4934bdbe3
  20:     0x7fa954b2957d - core::ptr::drop_in_place<rustc_interface::interface::Compiler>::hba47a069d6e06a26
  21:     0x7fa954b28e3c - rustc_span::with_source_map::hdc8c4c7d7611fe77
  22:     0x7fa954b3b0ba - rustc_interface::interface::create_compiler_and_run::hbe7a78745769ff96
  23:     0x7fa954b2de19 - scoped_tls::ScopedKey<T>::set::ha164143a03306a1b
  24:     0x7fa954b29eba - std::sys_common::backtrace::__rust_begin_short_backtrace::h4dd3c27220dda569
  25:     0x7fa954b29335 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h546778848e9193e6
  26:     0x7fa952882a27 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h09f167e08fc945ff
                               at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/alloc/src/boxed.rs:1572:9
  27:     0x7fa952882a27 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::hf814fe85eeb118e0
                               at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/alloc/src/boxed.rs:1572:9
  28:     0x7fa952882a27 - std::sys::unix::thread::Thread::new::thread_start::hb71b17934c5f5e68
                               at /rustc/2faabf579323f5252329264cc53ba9ff803429a3/library/std/src/sys/unix/thread.rs:91:17
  29:     0x7fa9527af609 - start_thread
  30:     0x7fa9526c3293 - 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.56.0-nightly (2faabf579 2021-07-27) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type staticlib

query stack during panic:
end of query stack
thread panicked while panicking. aborting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.E-needs-testCall for participation: An issue has been fixed and does not reproduce, but no test has been added.I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.glacierICE tracked in rust-lang/glacier.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions