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 when using generics, associated types and necromantic copy/paste #36013

Closed
blabaere opened this issue Aug 26, 2016 · 2 comments
Closed

ICE when using generics, associated types and necromantic copy/paste #36013

blabaere opened this issue Aug 26, 2016 · 2 comments

Comments

@blabaere
Copy link

rustc panic !

I tried this code:

impl<TStream, TCtx> endpoint::Endpoint<TCtx> for Pipe<TStream> where 
    TStream : StepStream + 'static, 
    TCtx : endpoint::EndpointRegistrar + endpoint::EventSender<TEvent=pipe::Event> {

    //ICE appears when inserting the below method
    fn ready(&mut self, ctx: &mut Context<PipeEvt>, events: mio::EventSet) {
        self.apply(|s| s.ready(ctx, events))
    }

}

// Here everything is working fine but I'm not satisfied with the design
impl<T : StepStream> Endpoint<PipeCmd, PipeEvt> for Pipe<T> {
    fn ready(&mut self, ctx: &mut Context<PipeEvt>, events: mio::EventSet) {
        self.apply(|s| s.ready(ctx, events))
    }
    fn process(&mut self, ctx: &mut Context<PipeEvt>, cmd: PipeCmd) {
        match cmd {
            PipeCmd::Open      => self.apply(|s| s.open(ctx)),
            PipeCmd::Close     => self.apply(|s| s.close(ctx)),
            PipeCmd::Send(msg) => self.apply(|s| s.send(ctx, msg)),
            PipeCmd::Recv      => self.apply(|s| s.recv(ctx))
        }
    }
}

I expected to see this happen: compiler error, because it was a just a copy/paste and laziness to actually look at it.

Instead, this happened: ICE

Meta

rustc --version --verbose:

rustc 1.13.0-nightly (490189634 2016-08-20)
binary: rustc
commit-hash: 490189634b656dcca9e41e6b52093569c03bd4df
commit-date: 2016-08-20
host: x86_64-unknown-linux-gnu
release: 1.13.0-nightly

Backtrace:

thread 'rustc' panicked at 'called `Option::unwrap()` on a `None` value', ../src/libcore/option.rs:326
stack backtrace:
   1:     0x7feb52a5ade9 - std::sys::backtrace::tracing::imp::write::h482d45d91246faa2
   2:     0x7feb52a6b4dc - std::panicking::default_hook::_{{closure}}::h89158f66286b674e
   3:     0x7feb52a697e7 - std::panicking::default_hook::h9e30d428ee3b0c43
   4:     0x7feb52a69ff8 - std::panicking::rust_panic_with_hook::h2224f33fb7bf2f4c
   5:     0x7feb52a69e92 - std::panicking::begin_panic::hcb11a4dc6d779ae5
   6:     0x7feb52a69dc0 - std::panicking::begin_panic_fmt::h310416c62f3935b3
   7:     0x7feb52a69d41 - rust_begin_unwind
   8:     0x7feb52ad540f - core::panicking::panic_fmt::hc5789f4e80194729
   9:     0x7feb52ad533b - core::panicking::panic::h1953378f4b37b561
  10:     0x7feb5114f0dc - rustc_typeck::check::compare_method::compare_impl_method::_{{closure}}::h08bef90d287aed42
  11:     0x7feb510ab0f9 - rustc_typeck::check::compare_method::compare_impl_method::he3538453c2efe177
  12:     0x7feb510c0082 - rustc_typeck::check::check_impl_items_against_trait::hb105ca8bb42a0b3d
  13:     0x7feb510bd602 - rustc_typeck::check::check_item_type::hba3733559d49be1e
  14:     0x7feb510b5e4b - _<rustc_typeck..check..CheckItemTypesVisitor<'a, 'tcx> as rustc..hir..intravisit..Visitor<'tcx>>::visit_item::h369cacffbaa18923
  15:     0x7feb510b7d4b - rustc_typeck::check::check_item_types::h81e44a5d40f450fd
  16:     0x7feb5112f4c3 - rustc_typeck::check_crate::h8ec8b2f490f5dc28
  17:     0x7feb52e4ab03 - rustc_driver::driver::phase_3_run_analysis_passes::_{{closure}}::h45e03cee16dcf298
  18:     0x7feb52e17546 - rustc_driver::driver::phase_3_run_analysis_passes::hc0de40cea97d81a1
  19:     0x7feb52e03f02 - rustc_driver::driver::compile_input::hd9ecc57abd3cba85
  20:     0x7feb52e36756 - rustc_driver::run_compiler::h184264500271cc39
  21:     0x7feb52d7c8c2 - std::panicking::try::do_call::h17a7a17ad7240c5c
  22:     0x7feb52a79846 - __rust_maybe_catch_panic
  23:     0x7feb52d9626a - _<F as alloc..boxed..FnBox<A>>::call_box::h93f9128277b2964a
  24:     0x7feb52a67bb2 - std::sys::thread::Thread::new::thread_start::he0bf102845911132
  25:     0x7feb4ad80181 - start_thread
  26:     0x7feb526a247c - __clone
  27:                0x0 - <unknown>
@durka
Copy link
Contributor

durka commented Aug 26, 2016

dupe of #35869

@Aatch
Copy link
Contributor

Aatch commented Aug 28, 2016

Fixed by #35877

@Aatch Aatch closed this as completed Aug 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants