Skip to content

ICE: parametric trait method with default implementation and missing argument name #14351

Closed
@peterhj

Description

@peterhj

Hi,

I believe I've found an internal compiler error. I did a quick search but I didn't find a similar case (although I did see some similar error messages). I am using rust 0.10 release on Mac OS X 10.9.3 amd64.

The following is a test case (I compiled it as part of a library, i.e., crate_type = "lib"). Notice that the default implementation of the trait method dosomething is missing an argument name for &str (nothing special about &str).

pub trait Base {
}

pub trait GenericT<T: Base> { 
  fn dosomething(&mut self, &str) { // XXX: notice the missing argument name to &str.
  }
}

pub struct GenericS<T> {
  instance: ~GenericT<T>,
}

impl<T: Base> GenericS<T> {
  fn new(instance: ~GenericT<T>) -> GenericS<T> { 
    GenericS{
      instance: instance,
    }
  }
}

And here's the accompanying stack trace:

error: internal compiler error: unexpected failure
note: the compiler hit an unexpected failure path. this is a bug.
note: we would appreciate a bug report: http://static.rust-lang.org/doc/master/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' failed at 'index out of bounds: the len is 0 but the index is 0', <clobbered>/rust-0.10/src/librustc/lib.rs:1
stack backtrace:
   1:        0x1065ca364 - rt::backtrace::imp::write::h65a09bfd89e9eaafg8b::v0.10
   2:        0x10652e5b6 - rt::unwind::begin_unwind_inner::h5a331550b6dabf0cKIb::v0.10
   3:        0x10652da28 - rt::unwind::begin_unwind::h2208f1307dcb398akIb::v0.10
   4:        0x1065c9e39 - rt::unwind::begin_unwind_raw::h39368944990e60fbTFb::v0.10
   5:        0x10652cc9e - rt::unwind::fail_::h467b70172d68d132xDb::v0.10
   6:        0x1065c9e82 - rt::unwind::fail_bounds_check::closure.41732
   7:        0x10652ed2e - rt::unwind::fail_bounds_check::hf988bd30faa54847UDb::v0.10
   8:        0x103e023a9 - middle::lint::Context$LT$$x27a$GT$.Visitor$LT$$LP$$RP$$GT$::visit_pat::h044a762b19bc684aBKC::v0.10
   9:        0x103e047ef - visit::walk_fn::h5ffa88dbd8b1e470nHv::v0.10
  10:        0x103e04770 - middle::lint::Context$LT$$x27a$GT$.Visitor$LT$$LP$$RP$$GT$::visit_fn::closure.71680
  11:        0x103e04cc0 - middle::lint::Context$LT$$x27a$GT$.Visitor$LT$$LP$$RP$$GT$::visit_fn::closure.71682
  12:        0x103de7f4e - middle::lint::Context$LT$$x27a$GT$::with_lint_attrs::hbe5aea6fd35e85d0RtB::v0.10
  13:        0x103e01480 - middle::lint::Context$LT$$x27a$GT$.Visitor$LT$$LP$$RP$$GT$::visit_fn::h2a236b2a24aa13ddtNC::v0.10
  14:        0x103dfa46b - middle::lint::Context$LT$$x27a$GT$.Visitor$LT$$LP$$RP$$GT$::visit_item::closure.71670
  15:        0x103de7f4e - middle::lint::Context$LT$$x27a$GT$::with_lint_attrs::hbe5aea6fd35e85d0RtB::v0.10
  16:        0x103e01636 - visit::Visitor::visit_mod::ha4816a1551c6eec6lzx::v0.10
  17:        0x103dfa03f - middle::lint::Context$LT$$x27a$GT$.Visitor$LT$$LP$$RP$$GT$::visit_item::closure.71670
  18:        0x103de7f4e - middle::lint::Context$LT$$x27a$GT$::with_lint_attrs::hbe5aea6fd35e85d0RtB::v0.10
  19:        0x103e01636 - visit::Visitor::visit_mod::ha4816a1551c6eec6lzx::v0.10
  20:        0x103e0b657 - middle::lint::check_crate::closure.71740
  21:        0x103de7f4e - middle::lint::Context$LT$$x27a$GT$::with_lint_attrs::hbe5aea6fd35e85d0RtB::v0.10
  22:        0x103e0acc6 - middle::lint::check_crate::h961d0706a9352ff7LTC::v0.10
  23:        0x103dbb03f - util::common::time::hdb035200b6259047XHh::v0.10
  24:        0x1041cbf27 - driver::driver::phase_3_run_analysis_passes::hf72c7de5c196f29avxf::v0.10
  25:        0x1041d1083 - driver::driver::compile_input::hc891bfe86e556e69sWf::v0.10
  26:        0x1041f6ce4 - run_compiler::h83b362fce9ccfbd8Yzn::v0.10
  27:        0x10420a98d - main_args::closure.92066
  28:        0x1042091a2 - monitor::closure.91951
  29:        0x104204d4b - task::TaskBuilder::try::closure.91726
  30:        0x1039ca49c - task::spawn_opts::closure.7957
  31:        0x1065c5788 - rt::task::Task::run::closure.41637
  32:        0x1065d01bc - rust_try
  33:        0x1065c5607 - rt::task::Task::run::hef30afd49f41e7b7NB9::v0.10
  34:        0x1039ca31f - task::spawn_opts::closure.7929
  35:        0x1065c8d46 - rt::thread::thread_start::h32f9e43720e7da7buga::v0.10
  36:     0x7fff8e3fa899 - _pthread_body
  37:     0x7fff8e3fa72a - _pthread_struct_init

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions