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 implementing Fn trait for unit struct #22603

Closed
ghost opened this issue Feb 20, 2015 · 5 comments
Closed

ICE implementing Fn trait for unit struct #22603

ghost opened this issue Feb 20, 2015 · 5 comments
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@ghost
Copy link

ghost commented Feb 20, 2015

The following programs generate the ICE with a slightly different message. May be related to #22565 and #22566

#![feature(unboxed_closures)]

pub struct Foo;

impl<A> Fn<(A,)> for Foo {
    type Output = ();
    extern "rust-call" fn call(&self, (_,): (A,)) {
    }
}

pub fn main() {
    println!("{:?}", Foo("bar"));
}
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. 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
thread 'rustc' panicked at 'assertion failed: `(left == right) && (right == left)` (left: `1`, right: `0`)', /Users/dwm/dev/freebroccolo/rust/src/librustc_trans/trans/adt.rs:1120

stack backtrace:
   1:        0x10f16fe23 - sys::backtrace::write::h3d6ead7c1184a95aYoB
   2:        0x10f19db85 - panicking::on_panic::h4ff071a70fb2a50dAGK
   3:        0x10f0cf188 - rt::unwind::begin_unwind_inner::h9fcba14039c4ae30QnK
   4:        0x10f0cf99e - rt::unwind::begin_unwind_fmt::h8a64dc3276ab80e6mmK
   5:        0x10b78ef5a - trans::adt::build_const_struct::h9f178ea5cb15adefd8J
   6:        0x10b6feb12 - trans::adt::trans_const::he12f11c052fd51c6qXJ
   7:        0x10b6fa1cb - trans::consts::const_expr_unadjusted::h6f4b4da94e54f806amo
   8:        0x10b6fca28 - trans::consts::const_expr::he362f3efa474e33578n
   9:        0x10b6fa146 - trans::consts::const_expr_unadjusted::h6f4b4da94e54f806amo
  10:        0x10b6fca28 - trans::consts::const_expr::he362f3efa474e33578n
  11:        0x10b6fe213 - iter::IteratorExt::fold::h16846351534471258687
  12:        0x10b6f893f - trans::consts::const_expr_unadjusted::h6f4b4da94e54f806amo
  13:        0x10b6fca28 - trans::consts::const_expr::he362f3efa474e33578n
  14:        0x10b68ed84 - trans::consts::get_const_expr_as_global::h0122b2bc5a07a52ed6n
  15:        0x10b643a17 - trans::expr::trans::h181c848f1f91f5c7BMh
  16:        0x10b734ee4 - trans::_match::trans_match_inner::h6e02f6c0e6a4b098zMx
  17:        0x10b691ee0 - trans::expr::trans_rvalue_dps_unadjusted::h5f563e68c9cce0602Wi
  18:        0x10b690362 - trans::expr::trans_unadjusted::h1caf7e41a27a61e7mqi
  19:        0x10b643ed0 - trans::expr::trans::h181c848f1f91f5c7BMh
  20:        0x10b6a71e3 - trans::expr::trans_addr_of::h3700c26ce80cf333tNj
  21:        0x10b6908f7 - trans::expr::trans_unadjusted::h1caf7e41a27a61e7mqi
  22:        0x10b643ed0 - trans::expr::trans::h181c848f1f91f5c7BMh
  23:        0x10b680aa5 - trans::callee::trans_args::h670e438b49426a11rjh
  24:        0x10b687394 - trans::callee::trans_call_inner::h12819191760544836083
  25:        0x10b692aed - trans::expr::trans_rvalue_dps_unadjusted::h5f563e68c9cce0602Wi
  26:        0x10b690362 - trans::expr::trans_unadjusted::h1caf7e41a27a61e7mqi
  27:        0x10b643ed0 - trans::expr::trans::h181c848f1f91f5c7BMh
  28:        0x10b680aa5 - trans::callee::trans_args::h670e438b49426a11rjh
  29:        0x10b687394 - trans::callee::trans_call_inner::h12819191760544836083
  30:        0x10b692aed - trans::expr::trans_rvalue_dps_unadjusted::h5f563e68c9cce0602Wi
  31:        0x10b6426eb - trans::expr::trans_into::h3a3c8b3d53f8afd1jGh
  32:        0x10b64153b - trans::controlflow::trans_stmt_semi::h26c41836c06fdbd36de
  33:        0x10b6431a3 - trans::controlflow::trans_block::hd7ca24723db0b5fbXee
  34:        0x10b7191f9 - trans::base::trans_closure::hbc388ffaaf4af161Fiu
  35:        0x10b62d4d6 - trans::base::trans_fn::hd5c4904336306603Wtu
  36:        0x10b62883d - trans::base::trans_item::h6fa4471c5f48a0b4PSu
  37:        0x10b71fbdc - trans::base::trans_crate::h15ffd65af4da49d1fQv
  38:        0x10b4ac638 - driver::phase_4_translate_to_llvm::h19f970ffecf43574iPa
  39:        0x10b4864f6 - driver::compile_input::hd5773fb44ef48d33Eba
  40:        0x10b560414 - run_compiler::h70410abf4d17bf43Rbc
  41:        0x10b55d495 - thunk::F.Invoke<A, R>::invoke::h1011432548731059940
  42:        0x10b55c130 - rt::unwind::try::try_fn::h9217449077233910915
  43:        0x10f21a289 - rust_try_inner
  44:        0x10f21a276 - rust_try
  45:        0x10b55c829 - thunk::F.Invoke<A, R>::invoke::h35832703021491210
  46:        0x10f186373 - sys::thread::thread_start::h5036bdc0fe436b19CWF
  47:     0x7fff82a3f268 - _pthread_body
  48:     0x7fff82a3f1e5 - _pthread_body
#![feature(unboxed_closures)]

pub struct Foo;

impl<A> Fn<(A,)> for Foo {
    type Output = A;
    extern "rust-call" fn call(&self, (arg,): (A,)) -> A {
        arg
    }
}

pub fn main() {
    println!("{:?}", Foo("bar"));
}
error: internal compiler error: adt::represent_type called on non-ADT type: &'static str
note: the compiler unexpectedly panicked. 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
thread 'rustc' panicked at 'Box<Any>', /Users/dwm/dev/freebroccolo/rust/src/libsyntax/diagnostic.rs:189

stack backtrace:
   1:        0x107908e23 - sys::backtrace::write::h3d6ead7c1184a95aYoB
   2:        0x107936b85 - panicking::on_panic::h4ff071a70fb2a50dAGK
   3:        0x107868188 - rt::unwind::begin_unwind_inner::h9fcba14039c4ae30QnK
   4:        0x106f32b2f - rt::unwind::begin_unwind::h6422578009397946341
   5:        0x106f3345d - diagnostic::Handler::bug::he3fe83188ec467dceeF
   6:        0x1047a7568 - session::Session::bug::hc6ca12d54ef8a384z3s
   7:        0x103f16223 - trans::adt::represent_type_uncached::h3807220f4faf82436mI
   8:        0x103de3790 - trans::adt::represent_type::hdcbcf49d3304f11cGjI
   9:        0x103e871a0 - trans::consts::const_expr_unadjusted::h6f4b4da94e54f806amo
  10:        0x103e89a28 - trans::consts::const_expr::he362f3efa474e33578n
  11:        0x103e87146 - trans::consts::const_expr_unadjusted::h6f4b4da94e54f806amo
  12:        0x103e89a28 - trans::consts::const_expr::he362f3efa474e33578n
  13:        0x103e8b213 - iter::IteratorExt::fold::h16846351534471258687
  14:        0x103e8593f - trans::consts::const_expr_unadjusted::h6f4b4da94e54f806amo
  15:        0x103e89a28 - trans::consts::const_expr::he362f3efa474e33578n
  16:        0x103e1bd84 - trans::consts::get_const_expr_as_global::h0122b2bc5a07a52ed6n
  17:        0x103dd0a17 - trans::expr::trans::h181c848f1f91f5c7BMh
  18:        0x103ec1ee4 - trans::_match::trans_match_inner::h6e02f6c0e6a4b098zMx
  19:        0x103e1eee0 - trans::expr::trans_rvalue_dps_unadjusted::h5f563e68c9cce0602Wi
  20:        0x103e1d362 - trans::expr::trans_unadjusted::h1caf7e41a27a61e7mqi
  21:        0x103dd0ed0 - trans::expr::trans::h181c848f1f91f5c7BMh
  22:        0x103e341e3 - trans::expr::trans_addr_of::h3700c26ce80cf333tNj
  23:        0x103e1d8f7 - trans::expr::trans_unadjusted::h1caf7e41a27a61e7mqi
  24:        0x103dd0ed0 - trans::expr::trans::h181c848f1f91f5c7BMh
  25:        0x103e0daa5 - trans::callee::trans_args::h670e438b49426a11rjh
  26:        0x103e14394 - trans::callee::trans_call_inner::h12819191760544836083
  27:        0x103e1faed - trans::expr::trans_rvalue_dps_unadjusted::h5f563e68c9cce0602Wi
  28:        0x103e1d362 - trans::expr::trans_unadjusted::h1caf7e41a27a61e7mqi
  29:        0x103dd0ed0 - trans::expr::trans::h181c848f1f91f5c7BMh
  30:        0x103e0daa5 - trans::callee::trans_args::h670e438b49426a11rjh
  31:        0x103e14394 - trans::callee::trans_call_inner::h12819191760544836083
  32:        0x103e1faed - trans::expr::trans_rvalue_dps_unadjusted::h5f563e68c9cce0602Wi
  33:        0x103dcf6eb - trans::expr::trans_into::h3a3c8b3d53f8afd1jGh
  34:        0x103dce53b - trans::controlflow::trans_stmt_semi::h26c41836c06fdbd36de
  35:        0x103dd01a3 - trans::controlflow::trans_block::hd7ca24723db0b5fbXee
  36:        0x103ea61f9 - trans::base::trans_closure::hbc388ffaaf4af161Fiu
  37:        0x103dba4d6 - trans::base::trans_fn::hd5c4904336306603Wtu
  38:        0x103db583d - trans::base::trans_item::h6fa4471c5f48a0b4PSu
  39:        0x103eacbdc - trans::base::trans_crate::h15ffd65af4da49d1fQv
  40:        0x103c3a638 - driver::phase_4_translate_to_llvm::h19f970ffecf43574iPa
  41:        0x103c144f6 - driver::compile_input::hd5773fb44ef48d33Eba
  42:        0x103cee414 - run_compiler::h70410abf4d17bf43Rbc
  43:        0x103ceb495 - thunk::F.Invoke<A, R>::invoke::h1011432548731059940
  44:        0x103cea130 - rt::unwind::try::try_fn::h9217449077233910915
  45:        0x1079b3289 - rust_try_inner
  46:        0x1079b3276 - rust_try
  47:        0x103cea829 - thunk::F.Invoke<A, R>::invoke::h35832703021491210
  48:        0x10791f373 - sys::thread::thread_start::h5036bdc0fe436b19CWF
  49:     0x7fff82a3f268 - _pthread_body
  50:     0x7fff82a3f1e5 - _pthread_body
@dotdash
Copy link
Contributor

dotdash commented Feb 21, 2015

Seems unrelated. In this case, it's trying to pass the arguments directly to the constructor Foo.

@dotdash dotdash added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Feb 21, 2015
@tamird
Copy link
Contributor

tamird commented Apr 22, 2015

Triage: still ICEs with updated code.

#![feature(unboxed_closures,core)]

pub struct Foo;

impl<A> FnOnce<(A,)> for Foo {
    type Output = ();
    extern "rust-call" fn call_once(self, (_,): (A,)) {
    }
}

pub fn main() {
    println!("{:?}", Foo("bar"));
}

@arielb1
Copy link
Contributor

arielb1 commented Jul 8, 2015

seems like more const trouble.

@steveklabnik
Copy link
Member

Triage: tracked by glacier

@Mark-Simulacrum
Copy link
Member

One more of those issues that's apparently not quite tracked by glacier... seems fixed on rustc 1.19.0-dev (7b5c3d2 2017-05-17). E-needstest.

@Mark-Simulacrum Mark-Simulacrum added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label May 19, 2017
MaloJaffre added a commit to MaloJaffre/rust that referenced this issue Jun 18, 2017
Mark-Simulacrum added a commit to Mark-Simulacrum/rust that referenced this issue Jun 18, 2017
frewsxcv added a commit to frewsxcv/rust that referenced this issue Jun 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

5 participants