Skip to content

ICE on deriving(Hash) on struct with no fields #16530

Closed
@pythonesque

Description

@pythonesque
#[deriving(Eq, PartialEq, Hash)]
struct Foo;

pub fn main() {
}

% RUST_BACKTRACE=1 rustc test.rs
test.rs:1:27: 1:31 error: internal compiler error: #[deriving(Hash)] needs at least one field
test.rs:1 #[deriving(Eq, PartialEq, Hash)]
                                    ^~~~
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/libsyntax/ast_util.rs:784

stack backtrace:
   1:     0x7f3570213e30 - rt::backtrace::imp::write::h43dac5486f5e7461t9p
   2:     0x7f3570216ed0 - failure::on_fail::h1e234ec252bd138bGuq
   3:     0x7f35747e3a60 - unwind::begin_unwind_inner::h84cc9a0765812e46M8d
   4:     0x7f3571804500 - unwind::begin_unwind::h14991031895584617642
   5:     0x7f3571804450 - diagnostic::SpanHandler::span_bug::hea4ecd8ab239d6d4sTD
   6:     0x7f35718a5ce0 - ext::base::ExtCtxt<'a>::span_bug::h30ed7ef1c35deca6gJ1
   7:     0x7f35718ea910 - ext::deriving::hash::expand_deriving_hash::closure.49550
   8:     0x7f357191c520 - ext::deriving::generic::MethodDef<'a>::call_substructure_method::h847ac2788a64860bmE6
   9:     0x7f3571918d90 - ext::deriving::generic::MethodDef<'a>::expand_struct_method_body::h0908f841e401f0523M6
  10:     0x7f35718d9a30 - ext::deriving::generic::TraitDef<'a>::expand::h88a3267643a21a08kt6
  11:     0x7f35718e7f50 - ext::deriving::hash::expand_deriving_hash::h0a0bb06c331b3d4fqH4
  12:     0x7f357189e380 - ext::deriving::expand_meta_deriving::h0ddef45aa4e013d0Ox7
  13:     0x7f3571932d80 - ext::expand::expand_item::h0339c5cb5201dae3mY7
  14:     0x7f357193c060 - ext::expand::MacroExpander<'a, 'b>.Folder::fold_item::h288561640d5ac0618J8
  15:     0x7f357193c000 - fold::noop_fold_mod::closure.50453
  16:     0x7f35718cd0b0 - iter::Iterator::collect::h16785455321615605245
  17:     0x7f357193b3f0 - fold::Folder::fold_mod::h2325071600941195257
  18:     0x7f3571974a80 - ext::expand::expand_crate::h68ddffbdc9de2152RM8
  19:     0x7f35757002e0 - driver::driver::phase_2_configure_and_expand::closure.132331
  20:     0x7f35754ec3c0 - driver::driver::phase_2_configure_and_expand::h398a490a9a6dcd85E6v
  21:     0x7f35756b9570 - driver::driver::compile_input::h53b0c1423273570bc0v
  22:     0x7f357575f8d0 - driver::run_compiler::h8e215e67a47bf587ruz
  23:     0x7f357575f7e0 - driver::main_args::closure.135617
  24:     0x7f3575771ef0 - task::TaskBuilder<S>::try_future::closure.136778
  25:     0x7f3575771cf0 - task::TaskBuilder<S>::spawn_internal::closure.136755
  26:     0x7f3574b44e60 - task::spawn_opts::closure.8314
  27:     0x7f357483b420 - rust_try_inner
  28:     0x7f357483b410 - rust_try
  29:     0x7f35747e10c0 - unwind::try::h9ef1228fa05d611fhXd
  30:     0x7f35747e0e60 - task::Task::run::h7037046a47095aa6T4c
  31:     0x7f3574b44c20 - task::spawn_opts::closure.8260
  32:     0x7f35747e2ca0 - thread::thread_start::h6cc33e9539afe5013sd
  33:     0x7f356f58b060 - start_thread
  34:     0x7f35744b2489 - __clone
  35:                0x0 - <unknown>

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions