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

Compiler crash with unnamed parameter. #13116

Closed
compmstr opened this issue Mar 24, 2014 · 3 comments
Closed

Compiler crash with unnamed parameter. #13116

compmstr opened this issue Mar 24, 2014 · 3 comments

Comments

@compmstr
Copy link

If you have a default implementation for a trait method, and don't provide a name for the parameter, the compiler will crash instead of showing a syntax error.

ex:

trait Drawable{
fn draw(&mut self, f32){} // This will crash the compiler
}

trait Drawable{
fn draw(&mut self, d_time: f32){} // This will compile and work as intended
}

The backtrace when the compiler crashes is as follows:
task 'rustc' failed at 'index out of bounds: the len is 0 but the index is 0', /home/corey/programming/rust/versions/rust/src/librustc/lib.rs:1
stack backtrace:
1: 0x7ffe9dd3a600 - rt::backtrace::imp::write::h43ed367ff6ec8062mHb::v0.10.pre
2: 0x7ffe9dc9fe10 - rt::unwind::begin_unwind_inner::h429b9db6779a12dcQhb::v0.10.pre
3: 0x7ffe9dc9fd80 - rt::unwind::begin_unwind::h79798f4b44fbb17bqhb::v0.10.pre
4: 0x7ffe9dd3a210 - rt::unwind::begin_unwind_raw::h0b348fcefe22c823Zeb::v0.10.pre
5: 0x7ffe9dc9f0b0 - rt::unwind::fail_::h8824f9d64c0ec9d7Dcb::v0.10.pre
6: 0x7ffe9dd3a280 - rt::unwind::fail_bounds_check::closure.40769
7: 0x7ffe9dca1010 - rt::unwind::fail_bounds_check::hc2d5b6f9b5fc56a20cb::v0.10.pre
8: 0x7ffe9eaf7f20 - middle::lint::Context$LT$$x27a$GT$.Visitor$LT$$LP$$RP$$GT$::visit_pat::h7a9472f62848a24fC9B::v0.10.pre
9: 0x7ffe9eafa960 - visit::walk_fn::he10b1e679cee0eefj6u::v0.10.pre
10: 0x7ffe9eafa8e0 - middle::lint::Context$LT$$x27a$GT$.Visitor$LT$$LP$$RP$$GT$::visit_fn::closure.71452
11: 0x7ffe9eafaa90 - middle::lint::Context$LT$$x27a$GT$.Visitor$LT$$LP$$RP$$GT$::visit_fn::closure.71454
12: 0x7ffe9eae0410 - middle::lint::Context$LT$$x27a$GT$::with_lint_attrs::ha94646037287dd66ZTA::v0.10.pre
13: 0x7ffe9eaf73b0 - middle::lint::Context$LT$$x27a$GT$.Visitor$LT$$LP$$RP$$GT$::visit_fn::h45b6e9195921b2a4ucC::v0.10.pre
14: 0x7ffe9eaef7e0 - middle::lint::Context$LT$$x27a$GT$.Visitor$LT$$LP$$RP$$GT$::visit_item::closure.71442
15: 0x7ffe9eae0410 - middle::lint::Context$LT$$x27a$GT$::with_lint_attrs::ha94646037287dd66ZTA::v0.10.pre
16: 0x7ffe9eaf7550 - visit::Visitor::visit_mod::h2cefa0a457a05cdagZw::v0.10.pre
17: 0x7ffe9eb01040 - middle::lint::check_crate::closure.71512
18: 0x7ffe9eae0410 - middle::lint::Context$LT$$x27a$GT$::with_lint_attrs::ha94646037287dd66ZTA::v0.10.pre
19: 0x7ffe9eb007d0 - middle::lint::check_crate::h720ceda6a3842effSiC::v0.10.pre
20: 0x7ffe9eab2910 - util::common::time::h29acbd1a7bd8e027Zch::v0.10.pre
21: 0x7ffe9ee17950 - driver::driver::phase_3_run_analysis_passes::h2519405deb9df491g1e::v0.10.pre
22: 0x7ffe9ee1e4d0 - driver::driver::compile_input::he6ac8834e12409f2tqf::v0.10.pre
23: 0x7ffe9ee42000 - run_compiler::h73da9b5de1b64391p4m::v0.10.pre
24: 0x7ffe9ee55330 - main_args::closure.91104
25: 0x7ffe9ee53c60 - monitor::closure.90989
26: 0x7ffe9ee4f630 - task::TaskBuilder::try::closure.90800
27: 0x7ffea0bb7300 - task::spawn_opts::closure.7479
28: 0x7ffe9dd35d20 - rt::task::Task::run::closure.40674
29: 0x7ffe9dd41110 - rust_try
30: 0x7ffe9dd35b60 - rt::task::Task::run::hca9f4f2190d84d1fV68::v0.10.pre
31: 0x7ffea0bb70a0 - task::spawn_opts::closure.7452
32: 0x7ffe9dd390c0 - rt::thread::thread_start::h3d1b32419b999440nN9::v0.10.pre
33: 0x7ffe9b0aeea0 - start_thread
34: 0x7ffe9d95f999 - __clone
35: 0x0 -

I am running on Lubuntu x86_64.

Thanks for all the great work

@edwardw
Copy link
Contributor

edwardw commented Mar 24, 2014

Dupe of #13105?

@compmstr
Copy link
Author

Yep, sorry, didn't find that one in the search. Should I close this?

@alexcrichton
Copy link
Member

Closing as a dupe of #13105

JohnTitor pushed a commit to JohnTitor/rust that referenced this issue Aug 30, 2022
Make use of NoHash hashing for FileId and CrateId

Both of these are mere integers so there is nothing to hash here.

Ideally we would use this for `la_arena::Idx` too, but that doesn't work due to the orphan rule, and `la_arena` is unfortunately a public library so we can't really do much here... Unless we remove the trait restriction but I'd like not to
flip1995 pushed a commit to flip1995/rust that referenced this issue Jul 25, 2024
…r=y21

Lint `zero_repeat_side_effects`  only if array length is a literal zero

changelog: [`zero_repeat_side_effects` ] Lint only if array length is a literal zero
Fixes rust-lang#13110 .
r? y21
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