Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ICE: encountered overly generic constant #2499

Closed
matthiaskrgr opened this issue Aug 20, 2022 · 3 comments
Closed

ICE: encountered overly generic constant #2499

matthiaskrgr opened this issue Aug 20, 2022 · 3 comments
Labels
C-bug Category: This is a bug. I-ICE Impact: makes Miri crash with some ICE

Comments

@matthiaskrgr
Copy link
Member

code from glacier fixed/99575.rs

use std::pin::Pin;

fn main() {
    let a = Enum::A(Pin::new(Box::new(A())));
    let b = Enum::B(Pin::new(Box::new(B())));
    println!("{:?} {:?}", a, b);
}

#[derive(Debug)]
enum Enum {
    A(Pin<Box<A>>),
    B(Pin<Box<B>>),
}

#[derive(Debug)]
struct A();

impl Drop for Pin<Box<A>> {
    fn drop(&mut self) {}
}

#[derive(Debug)]
struct B();

// UNCOMMENT TO FIX COMPILER ERROR
// impl Drop for Pin<Box<B>> {
//     fn drop(&mut self) {}
// }

cargo miri run

Preparing a sysroot for Miri (target: x86_64-unknown-linux-gnu)... done
WARNING: Ignoring `RUSTC_WRAPPER` environment variable, Miri does not support wrapping.
   Compiling M v0.1.0 (/tmp/M)
    Finished dev [unoptimized + debuginfo] target(s) in 0.29s
     Running `/home/matthias/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/bin/cargo-miri runner target/miri/x86_64-unknown-linux-gnu/debug/M`
warning: crate `M` should have a snake case name
  |
  = note: `#[warn(non_snake_case)]` on by default
  = help: convert the identifier to snake case: `m`

A(A) B(B)
error: internal compiler error: src/tools/miri/src/diagnostics.rs:227:21: This error should be impossible in Miri: encountered overly generic constant

thread 'rustc' panicked at 'Box<dyn Any>', /rustc/0b79f758c9aa6646606662a6d623a0752286cd17/compiler/rustc_errors/src/lib.rs:1393:9
stack backtrace:
   0:     0x7fe9613306d0 - std::backtrace_rs::backtrace::libunwind::trace::hdc27bfa6aa97f84d
                               at /rustc/0b79f758c9aa6646606662a6d623a0752286cd17/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   1:     0x7fe9613306d0 - std::backtrace_rs::backtrace::trace_unsynchronized::hd260a87da0307fa5
                               at /rustc/0b79f758c9aa6646606662a6d623a0752286cd17/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x7fe9613306d0 - std::sys_common::backtrace::_print_fmt::h789cb96c4a337f2c
                               at /rustc/0b79f758c9aa6646606662a6d623a0752286cd17/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x7fe9613306d0 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h36bc3de3612a60f5
                               at /rustc/0b79f758c9aa6646606662a6d623a0752286cd17/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x7fe96138b76e - core::fmt::write::h2db4bfe92ef037b0
                               at /rustc/0b79f758c9aa6646606662a6d623a0752286cd17/library/core/src/fmt/mod.rs:1202:17
   5:     0x7fe9613214d5 - std::io::Write::write_fmt::hcd345fc714a96537
                               at /rustc/0b79f758c9aa6646606662a6d623a0752286cd17/library/std/src/io/mod.rs:1672:15
   6:     0x7fe961333393 - std::sys_common::backtrace::_print::hcf53c28899e66110
                               at /rustc/0b79f758c9aa6646606662a6d623a0752286cd17/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x7fe961333393 - std::sys_common::backtrace::print::hd8ec3e1ae139ef7a
                               at /rustc/0b79f758c9aa6646606662a6d623a0752286cd17/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x7fe961333393 - std::panicking::default_hook::{{closure}}::he70b99e2f9e5bd44
                               at /rustc/0b79f758c9aa6646606662a6d623a0752286cd17/library/std/src/panicking.rs:295:22
   9:     0x7fe96133307f - std::panicking::default_hook::h8d91a23b91011754
                               at /rustc/0b79f758c9aa6646606662a6d623a0752286cd17/library/std/src/panicking.rs:314:9
  10:     0x7fe963b72644 - <rustc_driver[d9adb13473fd7853]::DEFAULT_HOOK::{closure#0}::{closure#0} as core[97bb3a13db18d0cb]::ops::function::FnOnce<(&core[97bb3a13db18d0cb]::panic::panic_info::PanicInfo,)>>::call_once::{shim:vtable#0}
  11:     0x7fe961333bcd - std::panicking::rust_panic_with_hook::h5af783bc1124b2c1
                               at /rustc/0b79f758c9aa6646606662a6d623a0752286cd17/library/std/src/panicking.rs:702:17
  12:     0x7fe964b103c1 - std[e5af5fec29962f4a]::panicking::begin_panic::<rustc_errors[713e2db940a8ff0d]::ExplicitBug>::{closure#0}
  13:     0x7fe964b0fbc6 - std[e5af5fec29962f4a]::sys_common::backtrace::__rust_end_short_backtrace::<std[e5af5fec29962f4a]::panicking::begin_panic<rustc_errors[713e2db940a8ff0d]::ExplicitBug>::{closure#0}, !>
  14:     0x7fe964af0f46 - std[e5af5fec29962f4a]::panicking::begin_panic::<rustc_errors[713e2db940a8ff0d]::ExplicitBug>
  15:     0x7fe964b359a6 - std[e5af5fec29962f4a]::panic::panic_any::<rustc_errors[713e2db940a8ff0d]::ExplicitBug>
  16:     0x7fe964b34f0d - <rustc_errors[713e2db940a8ff0d]::HandlerInner>::bug::<&alloc[d0a20223ecbdb9c4]::string::String>
  17:     0x7fe964b34c60 - <rustc_errors[713e2db940a8ff0d]::Handler>::bug::<&alloc[d0a20223ecbdb9c4]::string::String>
  18:     0x7fe964b5d23d - rustc_middle[151dce3d5e114089]::ty::context::tls::with_context_opt::<rustc_middle[151dce3d5e114089]::ty::context::tls::with_opt<rustc_middle[151dce3d5e114089]::util::bug::opt_span_bug_fmt<rustc_span[8d4f92e92ba5c24b]::span_encoding::Span>::{closure#0}, ()>::{closure#0}, ()>
  19:     0x7fe964b5f0a6 - rustc_middle[151dce3d5e114089]::util::bug::opt_span_bug_fmt::<rustc_span[8d4f92e92ba5c24b]::span_encoding::Span>
  20:     0x7fe9624fb803 - rustc_middle[151dce3d5e114089]::util::bug::bug_fmt
  21:     0x5573c6aca02e - miri[dae667ef59e4b333]::diagnostics::report_error
  22:     0x5573c6badeb6 - miri[dae667ef59e4b333]::eval::eval_entry
  23:     0x5573c6a34733 - <rustc_interface[67a969eeca26ae2c]::passes::QueryContext>::enter::<<miri[aab31a201f2846f7]::MiriCompilerCalls as rustc_driver[d9adb13473fd7853]::Callbacks>::after_analysis::{closure#0}, ()>
  24:     0x5573c6a3919f - <miri[aab31a201f2846f7]::MiriCompilerCalls as rustc_driver[d9adb13473fd7853]::Callbacks>::after_analysis
  25:     0x7fe9633496eb - <rustc_interface[67a969eeca26ae2c]::interface::Compiler>::enter::<rustc_driver[d9adb13473fd7853]::run_compiler::{closure#1}::{closure#2}, core[97bb3a13db18d0cb]::result::Result<core[97bb3a13db18d0cb]::option::Option<rustc_interface[67a969eeca26ae2c]::queries::Linker>, rustc_errors[713e2db940a8ff0d]::ErrorGuaranteed>>
  26:     0x7fe9633451bc - rustc_span[8d4f92e92ba5c24b]::with_source_map::<core[97bb3a13db18d0cb]::result::Result<(), rustc_errors[713e2db940a8ff0d]::ErrorGuaranteed>, rustc_interface[67a969eeca26ae2c]::interface::create_compiler_and_run<core[97bb3a13db18d0cb]::result::Result<(), rustc_errors[713e2db940a8ff0d]::ErrorGuaranteed>, rustc_driver[d9adb13473fd7853]::run_compiler::{closure#1}>::{closure#1}>
  27:     0x7fe963344ba2 - rustc_interface[67a969eeca26ae2c]::interface::create_compiler_and_run::<core[97bb3a13db18d0cb]::result::Result<(), rustc_errors[713e2db940a8ff0d]::ErrorGuaranteed>, rustc_driver[d9adb13473fd7853]::run_compiler::{closure#1}>
  28:     0x7fe963343741 - <scoped_tls[e4311800d1c0ff57]::ScopedKey<rustc_span[8d4f92e92ba5c24b]::SessionGlobals>>::set::<rustc_interface[67a969eeca26ae2c]::interface::run_compiler<core[97bb3a13db18d0cb]::result::Result<(), rustc_errors[713e2db940a8ff0d]::ErrorGuaranteed>, rustc_driver[d9adb13473fd7853]::run_compiler::{closure#1}>::{closure#0}, core[97bb3a13db18d0cb]::result::Result<(), rustc_errors[713e2db940a8ff0d]::ErrorGuaranteed>>
  29:     0x7fe96334342f - std[e5af5fec29962f4a]::sys_common::backtrace::__rust_begin_short_backtrace::<rustc_interface[67a969eeca26ae2c]::util::run_in_thread_pool_with_globals<rustc_interface[67a969eeca26ae2c]::interface::run_compiler<core[97bb3a13db18d0cb]::result::Result<(), rustc_errors[713e2db940a8ff0d]::ErrorGuaranteed>, rustc_driver[d9adb13473fd7853]::run_compiler::{closure#1}>::{closure#0}, core[97bb3a13db18d0cb]::result::Result<(), rustc_errors[713e2db940a8ff0d]::ErrorGuaranteed>>::{closure#0}, core[97bb3a13db18d0cb]::result::Result<(), rustc_errors[713e2db940a8ff0d]::ErrorGuaranteed>>
  30:     0x7fe963999e79 - <<std[e5af5fec29962f4a]::thread::Builder>::spawn_unchecked_<rustc_interface[67a969eeca26ae2c]::util::run_in_thread_pool_with_globals<rustc_interface[67a969eeca26ae2c]::interface::run_compiler<core[97bb3a13db18d0cb]::result::Result<(), rustc_errors[713e2db940a8ff0d]::ErrorGuaranteed>, rustc_driver[d9adb13473fd7853]::run_compiler::{closure#1}>::{closure#0}, core[97bb3a13db18d0cb]::result::Result<(), rustc_errors[713e2db940a8ff0d]::ErrorGuaranteed>>::{closure#0}, core[97bb3a13db18d0cb]::result::Result<(), rustc_errors[713e2db940a8ff0d]::ErrorGuaranteed>>::{closure#1} as core[97bb3a13db18d0cb]::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}
  31:     0x7fe96133d9c3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h374ee76b025338a5
                               at /rustc/0b79f758c9aa6646606662a6d623a0752286cd17/library/alloc/src/boxed.rs:1935:9
  32:     0x7fe96133d9c3 - <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once::h2bee731a5ba86295
                               at /rustc/0b79f758c9aa6646606662a6d623a0752286cd17/library/alloc/src/boxed.rs:1935:9
  33:     0x7fe96133d9c3 - std::sys::unix::thread::Thread::new::thread_start::h44c172ae3f11ec1f
                               at /rustc/0b79f758c9aa6646606662a6d623a0752286cd17/library/std/src/sys/unix/thread.rs:108:17
  34:     0x7fe960f9c78d - <unknown>
  35:     0x7fe96101d8e4 - clone
  36:                0x0 - <unknown>

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.65.0-nightly (0b79f758c 2022-08-18) running on x86_64-unknown-linux-gnu

note: compiler flags: --crate-type bin -C embed-bitcode=no -C debuginfo=2 -C incremental -C target-cpu=native

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
end of query stack
error: aborting due to previous error; 1 warning emitted
@matthiaskrgr
Copy link
Member Author

original rustc ticket: rust-lang/rust#99575

@RalfJung
Copy link
Member

RalfJung commented Aug 21, 2022

I don't think the latest released Miri already contains rust-lang/rust#100740. The version you used certainly did not (it is based on rustc 0b79f758c 2022-08-18).

@RalfJung RalfJung added C-bug Category: This is a bug. I-ICE Impact: makes Miri crash with some ICE labels Aug 21, 2022
@RalfJung
Copy link
Member

Yeah this got fixed by rust-lang/rust#100740 for Miri as well. When I try it locally with the latest rustc commit I get no ICE, and instead

error[E0120]: the `Drop` trait may only be implemented for local structs, enums, and unions
  --> ice.rs:18:15
   |
18 | impl Drop for Pin<Box<A>> {
   |               ^^^^^^^^^^^ must be a struct, enum, or union in the current crate

error: aborting due to previous error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. I-ICE Impact: makes Miri crash with some ICE
Projects
None yet
Development

No branches or pull requests

2 participants