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: Unnamed argument in static trait methods #13105

Closed
japaric opened this issue Mar 23, 2014 · 3 comments · Fixed by #18099
Closed

ICE: Unnamed argument in static trait methods #13105

japaric opened this issue Mar 23, 2014 · 3 comments · Fixed by #18099
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

@japaric
Copy link
Member

japaric commented Mar 23, 2014

Script to reproduce:

trait Foo {
    // Good
    fn foo(&self);

    // Good
    fn bar(u8);

    // Good
    fn baz(&self) {

    }

    // ICE
    fn quux(u8) {

    }
}

fn main() {

}

Backtrace:

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', /var/tmp/paludis/build/dev-lang-rust-scm/work/rust-scm/src/librustc/lib.rs:1
stack backtrace:
   1:     0x7f6efa750b10 - rt::backtrace::imp::write::h1f99132f1b25f9a8lFb::v0.10.pre
   2:     0x7f6efa6b6470 - rt::unwind::begin_unwind_inner::h28090bbbfb0f2ea0Pfb::v0.10.pre
   3:     0x7f6efa6b63e0 - <unknown>
   4:     0x7f6efa750720 - rt::unwind::begin_unwind_raw::h906c42b0deb418a2Ycb::v0.10.pre
   5:     0x7f6efa6b5710 - rt::unwind::fail_::h15821e2ce08a2f70Cab::v0.10.pre
   6:     0x7f6efa750790 - <unknown>
   7:     0x7f6efa6b7670 - rt::unwind::fail_bounds_check::h970f59b4b39b895fZab::v0.10.pre
   8:     0x7f6efb759bb0 - middle::lint::Context$LT$$x27a$GT$.Visitor$LT$$LP$$RP$$GT$::visit_pat::h29763ab81fc19be276B::v0.10.pre
   9:     0x7f6efb75c570 - <unknown>
  10:     0x7f6efb75c4f0 - <unknown>
  11:     0x7f6efb75c6a0 - <unknown>
  12:     0x7f6efb741bb0 - <unknown>
  13:     0x7f6efb759070 - middle::lint::Context$LT$$x27a$GT$.Visitor$LT$$LP$$RP$$GT$::visit_fn::h834b5aee3f3b9929Z9B::v0.10.pre
  14:     0x7f6efb751630 - <unknown>
  15:     0x7f6efb741bb0 - <unknown>
  16:     0x7f6efb759210 - <unknown>
  17:     0x7f6efb7630a0 - <unknown>
  18:     0x7f6efb741bb0 - <unknown>
  19:     0x7f6efb762840 - middle::lint::check_crate::h96b37a495c4c9217hgC::v0.10.pre
  20:     0x7f6efb714200 - <unknown>
  21:     0x7f6efba74ca0 - driver::driver::phase_3_run_analysis_passes::hf88707dd4832a5b5QQe::v0.10.pre
  22:     0x7f6efba7b6a0 - driver::driver::compile_input::h1a4650f2f4c6ec96Nff::v0.10.pre
  23:     0x7f6efba9f360 - run_compiler::h56f03ac7e633fb534Sm::v0.10.pre
  24:     0x7f6efbab2600 - <unknown>
  25:     0x7f6efbab0f30 - <unknown>
  26:     0x7f6efbaac900 - <unknown>
  27:     0x7f6efaddf760 - <unknown>
  28:     0x7f6efa74c230 - <unknown>
  29:     0x7f6efa7575f0 - rust_try
  30:     0x7f6efa74c070 - rt::task::Task::run::h4ac4ccd9ba02c478U48::v0.10.pre
  31:     0x7f6efaddf500 - <unknown>
  32:     0x7f6efa74f5d0 - <unknown>
  33:     0x7f6ef7cdfe30 - <unknown>
  34:     0x7f6efa380a99 - __clone
  35:                0x0 - <unknown>

Exit code: 101

Version:

rustc 0.10-pre (1cd0a5e 2014-03-23 06:06:54 -0700)
host: x86_64-unknown-linux-gnu
@Aatch
Copy link
Contributor

Aatch commented Mar 24, 2014

nice catch, looks like a bug in the uppercase_variables lint.

Aatch added a commit to Aatch/rust that referenced this issue Mar 24, 2014
@DaGenix
Copy link

DaGenix commented Mar 24, 2014

I wrote that lint and didn't realize that it was legal to have unnamed function arguments. Whoops.

What is the point of an unnamed function argument? It doesn't seem like you'll be able to do anything with it.

@tomjakubowski
Copy link
Contributor

I can get an ICE even for unnamed arguments in 'non-static' methods:

#![crate_type="lib"]

trait Times {
    fn times(&self, int) {

    }
}
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', /Users/rustbuild/src/rust-buildbot/slave/nightly-mac/build/src/librustc/lib.rs:1
stack backtrace:
   1:        0x10fcc9654 - rt::backtrace::imp::write::hf792c9a431d98150WEa::v0.11.pre
   2:        0x10fc2b58e - rt::unwind::begin_unwind_inner::hd86b006519df9a922ea::v0.11.pre
   3:        0x10fc2ad18 - rt::unwind::begin_unwind::h10174172393206223895::v0.11.pre
   4:        0x10fcc9119 - rt::unwind::begin_unwind_raw::hca7322628e40a5b5bca::v0.11.pre
   5:        0x10fc29f8e - rt::unwind::fail_::h7f000d2154e6cd34P99::v0.11.pre
   6:        0x10fcc9162 - rt::unwind::fail_bounds_check::closure.40249
   7:        0x10fc2c09e - rt::unwind::fail_bounds_check::h2ea0b1a4f61a3302caa::v0.11.pre
   8:        0x10d41d9e3 - middle::lint::Context<'a>.Visitor<(*>::visit_pat::h1dc0d8536dedb86a98B::v0.11.pre
   9:        0x10d423f4f - visit::walk_fn::h5356099215230029470::v0.11.pre
  10:        0x10d423ed0 - middle::lint::Context<'a>.Visitor<(*>::visit_fn::closure.70610
  11:        0x10d42435e - middle::lint::Context<'a>.Visitor<(*>::visit_fn::closure.70612
  12:        0x10d403f31 - middle::lint::Context<'a>::with_lint_attrs::hef3c7739e0013001mSA::v0.11.pre
  13:        0x10d41cac0 - middle::lint::Context<'a>.Visitor<(*>::visit_fn::h43414315bc8a5a061bC::v0.11.pre
  14:        0x10d415f1b - middle::lint::Context<'a>.Visitor<(*>::visit_item::closure.70596
  15:        0x10d403f31 - middle::lint::Context<'a>::with_lint_attrs::hef3c7739e0013001mSA::v0.11.pre
  16:        0x10d41cc76 - visit::Visitor::visit_mod::h12750473236215063983::v0.11.pre
  17:        0x10d42a8b7 - middle::lint::check_crate::closure.70667
  18:        0x10d403f31 - middle::lint::Context<'a>::with_lint_attrs::hef3c7739e0013001mSA::v0.11.pre
  19:        0x10d429f05 - middle::lint::check_crate::hdeb4e388e38f57d5jiC::v0.11.pre
  20:        0x10d3d680f - util::common::time::h6685874155479263413::v0.11.pre
  21:        0x10d7f19b1 - driver::driver::phase_3_run_analysis_passes::he6c312d7dc672e1cg1e::v0.11.pre
  22:        0x10d7f6db2 - driver::driver::compile_input::h5cc16b6b358a89603qf::v0.11.pre
  23:        0x10d81cba2 - run_compiler::hfaca67788353830ezUm::v0.11.pre
  24:        0x10d830a1d - main_args::closure.91224
  25:        0x10d82edb2 - monitor::closure.91099
  26:        0x10d82a8fb - task::TaskBuilder::try::closure.90865
  27:        0x10cfd848c - task::spawn_opts::closure.7106
  28:        0x10fcc4758 - rt::task::Task::run::closure.40146
  29:        0x10fcce4cc - rust_try
  30:        0x10fcc45d7 - rt::task::Task::run::h767d3727f94ffe61C57::v0.11.pre
  31:        0x10cfd830f - task::spawn_opts::closure.7078
  32:        0x10fcc8026 - rt::thread::thread_start::h6bde74cf5aa3b556PK8::v0.11.pre
  33:     0x7fff86d8b899 - _pthread_body
  34:     0x7fff86d8b72a - _pthread_struct_init

@huonw huonw added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Sep 10, 2014
@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 Oct 4, 2014
bors added a commit that referenced this issue Oct 18, 2014
Closes #9249.
Closes #13105.
Closes #13837.
Closes #13847.
Closes #15207.
Closes #15261.
Closes #16048. 
Closes #16098.
Closes #16256.
Closes #16562.
Closes #16596.
Closes #16709.
Closes #16747.
Closes #17025.
Closes #17121.
Closes #17450.
Closes #17636.
bors pushed a commit to rust-lang-ci/rust that referenced this issue Oct 18, 2022
lyming2007 pushed a commit to lyming2007/rust that referenced this issue Oct 21, 2022
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

Successfully merging a pull request may close this issue.

5 participants