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 with manual implementation of Fn Trait #20225

Closed
flo-l opened this issue Dec 25, 2014 · 4 comments
Closed

ICE with manual implementation of Fn Trait #20225

flo-l opened this issue Dec 25, 2014 · 4 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

@flo-l
Copy link
Contributor

flo-l commented Dec 25, 2014

Summary

$ rustc --version
rustc 0.13.0-nightly (96a3c7c6a 2014-12-23 22:21:10 +0000)
$ uname -r
3.7.10-1.45-desktop

The following piece of code produces an ICE.

Code

#![feature(unboxed_closures)]
struct Test;
impl<T> Fn(&T) for Test {
  extern "rust-call" fn call(&self, args: T) {}
}

fn main() {}

Compiler Output

bug.rs:3:1: 5:2 error: internal compiler error: cannot relate bound region: ReLateBound(DebruijnIndex { depth: 1 }, BrAnon(0)) <= ReLateBound(DebruijnIndex { depth: 2 }, BrAnon(0))
bug.rs:3 impl<T> Fn(&T) for Test {
bug.rs:4   extern "rust-call" fn call(&self, args: T) {}
bug.rs:5 }
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>', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/libsyntax/diagnostic.rs:123

Backtrace

thread 'rustc' panicked at 'Box<Any>', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/libsyntax/diagnostic.rs:123

stack backtrace:
   1:     0x7fce43261cd0 - sys::backtrace::write::hb17309211a216bb7JGt
   2:     0x7fce43283120 - failure::on_fail::heb25cc4682c759b8j7z
   3:     0x7fce431ef090 - rt::unwind::begin_unwind_inner::h3152ae29e75c429ejLz
   4:     0x7fce3e25a3b0 - rt::unwind::begin_unwind::h6844074129470762541
   5:     0x7fce3e25a330 - diagnostic::SpanHandler::span_bug::h29f82f79f5d56042xXF
   6:     0x7fce4147f240 - middle::infer::region_inference::RegionVarBindings<$u{27}a$C$$u{20}$u{27}tcx$GT$::make_subregion::h8ac58e20ccbbde5acCw
   7:     0x7fce4141a4b0 - middle::infer::region_inference::RegionVarBindings<$u{27}a$C$$u{20}$u{27}tcx$GT$::make_eqregion::h9d47ba08dd8cf5d2ABw
   8:     0x7fce4141a140 - middle::infer::equate::Equate<$u{27}f$C$$u{20}$u{27}tcx$GT$.Combine$LT$$u{27}tcx$GT$::regions::h73e6d56c660a1845Dmr
   9:     0x7fce41412fa0 - middle::infer::equate::Equate<$u{27}f$C$$u{20}$u{27}tcx$GT$.Combine$LT$$u{27}tcx$GT$::tys::h471f5a98c9d6dfcaItr
  10:     0x7fce4142d500 - vec::Vec<T>.FromIterator<T>::from_iter::h5668640528306963737
  11:     0x7fce41412fa0 - middle::infer::equate::Equate<$u{27}f$C$$u{20}$u{27}tcx$GT$.Combine$LT$$u{27}tcx$GT$::tys::h471f5a98c9d6dfcaItr
  12:     0x7fce4142a7d0 - middle::infer::combine::Combine::substs_variances::h1078347395584664297
  13:     0x7fce4142a710 - middle::infer::combine::Combine::substs::h17827783322505970035
  14:     0x7fce4142a3d0 - middle::infer::combine::Combine::trait_refs::h17661170864613379829
  15:     0x7fce4149f120 - middle::infer::InferCtxt<$u{27}a$C$$u{20}$u{27}tcx$GT$::sub_trait_refs::h746edee146c20ac1hAB
  16:     0x7fce41513900 - middle::traits::select::SelectionContext<$u{27}cx$C$$u{20}$u{27}tcx$GT$::match_impl::h611636679202f639yuS
  17:     0x7fce4151ee10 - middle::traits::select::SelectionContext<$u{27}cx$C$$u{20}$u{27}tcx$GT$::assemble_candidates_from_impls::h07907ee2e8ab08c9qpR
  18:     0x7fce41519a40 - middle::traits::select::SelectionContext<$u{27}cx$C$$u{20}$u{27}tcx$GT$::candidate_from_obligation_no_cache::h9717abb1557071bcmUQ
  19:     0x7fce4150a8a0 - middle::traits::select::SelectionContext<$u{27}cx$C$$u{20}$u{27}tcx$GT$::candidate_from_obligation::he45ed325becf3f9dVLQ
  20:     0x7fce415077e0 - middle::traits::select::SelectionContext<$u{27}cx$C$$u{20}$u{27}tcx$GT$::select::h1df2ae4f37ebe11f1qQ
  21:     0x7fce41500d60 - middle::traits::fulfill::FulfillmentContext<$u{27}tcx$GT$::select::ha8f543f2a109b8a81PP
  22:     0x7fce413cf830 - middle::traits::fulfill::FulfillmentContext<$u{27}tcx$GT$::select_all_or_error::h28551a267f49929bMMP
  23:     0x7fce4271b040 - check::vtable::select_all_fcx_obligations_or_error::h5dc16acf92778f762fb
  24:     0x7fce42790270 - check::wf::CheckTypeWellFormedVisitor<$u{27}ccx$C$$u{20}$u{27}tcx$GT$::with_fcx::h702fa687a451d051zYi
  25:     0x7fce42794be0 - check::wf::CheckTypeWellFormedVisitor<$u{27}ccx$C$$u{20}$u{27}tcx$GT$.Visitor$LT$$u{27}v$GT$::visit_item::h6897cdd375616c9cA7i
  26:     0x7fce42a74a30 - check_crate::unboxed_closure.43520
  27:     0x7fce42a6f6c0 - check_crate::h9fa0de23a730bc6051y
  28:     0x7fce437c08e0 - driver::phase_3_run_analysis_passes::hb82a5f356d65399aJta
  29:     0x7fce437a30c0 - driver::compile_input::h3a3ece9a540d8ec3wba
  30:     0x7fce43972450 - thunk::Thunk<(*,$u{20}R$GT$::new::unboxed_closure.30350
  31:     0x7fce43972320 - thunk::F.Invoke<A,$u{20}R$GT$::invoke::h12674338790413327364
  32:     0x7fce439709d0 - rt::unwind::try::try_fn::h12634669535511272181
  33:     0x7fce432e88b0 - rust_try_inner
  34:     0x7fce432e88a0 - rust_try
  35:     0x7fce43970d00 - thunk::F.Invoke<A,$u{20}R$GT$::invoke::h8791273253097928462
  36:     0x7fce43272510 - sys::thread::thread_start::h31ef8e2419d4f09ahFw
  37:     0x7fce3da5bd40 - start_thread
  38:     0x7fce42e9b0a9 - clone
  39:                0x0 - <unknown>
@jdm jdm added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Dec 25, 2014
@shepmaster
Copy link
Member

Note that the definition and trait types are mismatched. This does compile:

struct Test;
impl<T> Fn(T) for Test {
    extern "rust-call" fn call(&self, _args: (T,)) {}
}

@shepmaster
Copy link
Member

Similar error message to #20186

@bombless
Copy link
Contributor

Even more minified, with less backtrace:

impl Fn(&()) for () { fn call(&self, _: (&(),)){} }
fn main() {}

version:

rustc 1.0.0-nightly (44a287e6e 2015-01-08 17:03:40 -0800)
binary: rustc
commit-hash: 44a287e6eb22ec3c2a687fc156813577464017f7
commit-date: 2015-01-08 17:03:40 -0800
host: i686-pc-windows-gnu
release: 1.0.0-nightly

and

rustc 1.0.0-dev (378fb5846 2015-01-17 03:51:34 +0000)
binary: rustc
commit-hash: 378fb5846d2d8dbc5ab24a5e92794c5c39d492dc
commit-date: 2015-01-17 03:51:34 +0000
host: i686-pc-windows-gnu
release: 1.0.0-dev
thread 'rustc' panicked at 'assertion failed: !generic_bounds.has_escaping_regions()', C:\bot\slave\nightly-dist-rustc-win-32\build\src\librustc_typeck\check\mod.rs:2231

stack backtrace:
   1: 0x62f3ce2f - rt::unwind::register::he1c697e5991dcbf88Dz
   2: 0x62ec350c - rt::unwind::begin_unwind_inner::ha377d8b3de16ce78GBz
   3:  0x1175635
   4:  0x11c9b4c - check::LvaluePreference...std..fmt..Show::fmt::h05e7aff324b7d3e5wqm
   5:  0x11f4685 - check::FnCtxt<'a, 'tcx>.mc..Typer<'tcx>::is_method_call::h9e9bd83f4778ce0f1Uj
   6:  0x12d9abf - check_crate::h18c07136f917886b23x
   7:  0x12d4580 - check_crate::h18c07136f917886b23x
   8: 0x6b7ddc8b - driver::phase_3_run_analysis_passes::ha45f499ff7826752gwa
   9: 0x6b7c2941 - driver::compile_input::hdb1b2f5e3352478cxba
  10: 0x6b892829 - run::h9a36f6fac224e9f5V3b
  11: 0x6b890caf - run::h9a36f6fac224e9f5V3b
  12: 0x6b88f9af - run::h9a36f6fac224e9f5V3b
  13: 0x62f6879c - rust_try
  14: 0x62f2e597 - sys::tcp::TcpListener::bind::h84f1a79868ba93248qw
  15: 0x7634919f - BaseThreadInitThunk
  16: 0x775f0bbb - RtlInitializeExceptionChain

@bombless
Copy link
Contributor

Okay, mine seems to be a different problem...

@ghost ghost added the E-needs-test Call for participation: An issue has been fixed and does not reproduce, but no test has been added. label Mar 4, 2015
@bors bors closed this as completed in a19bbca Mar 17, 2015
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

4 participants