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 associated types and submodules #19173

Closed
erickt opened this issue Nov 21, 2014 · 2 comments
Closed

ICE with associated types and submodules #19173

erickt opened this issue Nov 21, 2014 · 2 comments
Labels
A-associated-items Area: Associated items such as associated types and consts.

Comments

@erickt
Copy link
Contributor

erickt commented Nov 21, 2014

Found an ICE playing with the experimental associated types:

#![feature(associated_types)]

impl<'a> IntoBuffer for &'a [u8] {
    type T = &'a [u8];

    fn into_buffer(self) -> &'a [u8] {
        self
    }
}

pub trait IntoBuffer {
    type T;

    fn into_buffer(self) -> <Self as IntoBuffer>::T;
}

fn main() {}

Errors with:

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
task 'rustc' panicked at 'No def'n found for DefId { krate: 0, node: 33 } in tcx.impl_or_trait_items', /Users/rustbuild/src/rust-buildbot/slave/nightly-mac/build/src/librustc/middle/ty.rs:4323

stack backtrace:
   1:        0x113062ba2 - rt::backtrace::imp::write::h7579c368c127979b6it
   2:        0x113065d3d - failure::on_fail::h8be83c0fdfea739bdBt
   3:        0x1132d8f65 - unwind::begin_unwind_inner::h4bdb4ca88294d49812c
   4:        0x1132d8baf - unwind::begin_unwind_fmt::hae17deb499932f75c0c
   5:        0x110158c84 - middle::ty::impl_or_trait_item::h4faeda649e6a6f19H64
   6:        0x1105141d9 - middle::typeck::collect::ImplCtxt<'a, 'tcx>.AstConv<'tcx>::associated_type_binding::h9055dfc46b8c27bakJG
   7:        0x110527559 - middle::typeck::astconv::create_substs_for_ast_path::h5023519427691145276
   8:        0x110436fcc - middle::typeck::collect::convert::h0d3126dddfce9a9eF3G
   9:        0x11042cf73 - middle::typeck::collect::collect_item_types::h2e912e08bc7db61fCYF
  10:        0x1106c0f96 - util::common::time::h15512248264236370325
  11:        0x1106c02ee - middle::typeck::check_crate::h7708c70a36786f0djVL
  12:        0x10fcb1d93 - driver::driver::phase_3_run_analysis_passes::h5c1577ba8747ac80bfS
  13:        0x10fca62bc - driver::driver::compile_input::h6cd958c13fa99356VVR
  14:        0x10fd24ab5 - driver::run_compiler::h3464f6d73ed1e2efpUT
  15:        0x10fd2328e - driver::run::closure.59750
  16:        0x10fb3ab9b - task::TaskBuilder<S>::try_future::closure.39054
  17:        0x10fb3aa93 - task::TaskBuilder<S>::spawn_internal::closure.39025
  18:        0x10fafe7bd - task::NativeSpawner.Spawner::spawn::closure.2477
  19:        0x11333b82c - rust_try_inner
  20:        0x11333b816 - rust_try
  21:        0x1132d6707 - unwind::try::h52975ec5962bbd4bmRc
  22:        0x1132d659c - task::Task::run::h585d701e145fcc2392b
  23:        0x10fafe5e3 - task::NativeSpawner.Spawner::spawn::closure.2401
  24:        0x1132d7dd7 - thread::thread_start::hfcf722effb78e787foc
  25:     0x7fff88b882fc - _pthread_body
  26:     0x7fff88b88279 - _pthread_body

However, if you swap the order of the trait and impl it works.

@aturon aturon added the A-associated-items Area: Associated items such as associated types and consts. label Nov 21, 2014
@japaric
Copy link
Member

japaric commented Nov 21, 2014

However, if you swap the order of the trait and impl it works.

Sounds like a duplicate of #18611

@erickt
Copy link
Contributor Author

erickt commented Nov 21, 2014

Thanks! Closing as duplicate.

@erickt erickt closed this as completed Nov 21, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-associated-items Area: Associated items such as associated types and consts.
Projects
None yet
Development

No branches or pull requests

3 participants