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

task 'rustc' failed at 'index out of bounds: the len is 0 but the index is 0 #17146

Closed
Nullreff opened this issue Sep 10, 2014 · 3 comments
Closed
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@Nullreff
Copy link

The Rust compiler displays the following error when building my project. I'm running 32bit Debian Stable.

> rustc --version
rustc 0.12.0-pre-nightly (325808a33 2014-09-08 20:51:14 +0000)
> RUST_BACKTRACE=1 rustc rustymine.rs 
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://doc.rust-lang.org/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', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/librustc/middle/check_match.rs:524

stack backtrace:
   1: 0xb5fcb7e0 - rt::backtrace::imp::write::h3a47248f3065eac3F8q
   2: 0xb5fce720 - failure::on_fail::hdbacec6aadb65e07nur
   3: 0xb633ad50 - unwind::begin_unwind_inner::h5300f193b285b88962d
   4: 0xb633a940 - unwind::begin_unwind_fmt::h7172303ea891f784q0d
   5: 0xb633a8e0 - rust_begin_unwind
   6: 0xb6386b90 - failure::begin_unwind::h655f95ed1bb60961Wnk
   7: 0xb6386a10 - failure::fail_bounds_check::h20dabaa82101fe44Skk
   8: 0xb67360b0 - middle::check_match::is_useful::h9e3b962eb29b67abC7n
   9: 0xb674ecb0 - middle::check_match::is_useful_specialized::hfe48f6eb9f7260ccygo
  10: 0xb674e1d0 - middle::check_match::is_useful::closure.115587
  11: 0xb67360b0 - middle::check_match::is_useful::h9e3b962eb29b67abC7n
  12: 0xb674ecb0 - middle::check_match::is_useful_specialized::hfe48f6eb9f7260ccygo
  13: 0xb674e1d0 - middle::check_match::is_useful::closure.115587
  14: 0xb67360b0 - middle::check_match::is_useful::h9e3b962eb29b67abC7n
  15: 0xb672d580 - middle::check_match::check_expr::h72f8cc5487eaaabcwvn
  16: 0xb6733c90 - visit::walk_block::h2389838162361242636
  17: 0xb672d580 - middle::check_match::check_expr::h72f8cc5487eaaabcwvn
  18: 0xb6733c90 - visit::walk_block::h2389838162361242636
  19: 0xb6731c60 - middle::check_match::check_fn::he2b12c28d6b0f26f2Fo
  20: 0xb672d580 - middle::check_match::check_expr::h72f8cc5487eaaabcwvn
  21: 0xb672d580 - middle::check_match::check_expr::h72f8cc5487eaaabcwvn
  22: 0xb6733c90 - visit::walk_block::h2389838162361242636
  23: 0xb672d580 - middle::check_match::check_expr::h72f8cc5487eaaabcwvn
  24: 0xb6733c90 - visit::walk_block::h2389838162361242636
  25: 0xb6731c60 - middle::check_match::check_fn::he2b12c28d6b0f26f2Fo
  26: 0xb672d580 - middle::check_match::check_expr::h72f8cc5487eaaabcwvn
  27: 0xb672d580 - middle::check_match::check_expr::h72f8cc5487eaaabcwvn
  28: 0xb6733c90 - visit::walk_block::h2389838162361242636
  29: 0xb672d580 - middle::check_match::check_expr::h72f8cc5487eaaabcwvn
  30: 0xb6733c90 - visit::walk_block::h2389838162361242636
  31: 0xb6731c60 - middle::check_match::check_fn::he2b12c28d6b0f26f2Fo
  32: 0xb672d580 - middle::check_match::check_expr::h72f8cc5487eaaabcwvn
  33: 0xb672d580 - middle::check_match::check_expr::h72f8cc5487eaaabcwvn
  34: 0xb6733c90 - visit::walk_block::h2389838162361242636
  35: 0xb6731c60 - middle::check_match::check_fn::he2b12c28d6b0f26f2Fo
  36: 0xb67339b0 - visit::walk_method_helper::h1060611821396196880
  37: 0xb6732c10 - visit::walk_item::h7664931802223527900
  38: 0xb6732280 - middle::check_match::check_crate::h5b27abcac0ce801d1un
  39: 0xb6e2b490 - driver::driver::phase_3_run_analysis_passes::closure.147043
  40: 0xb64f2990 - util::common::time::h812626770107026942
  41: 0xb6dc3b20 - driver::driver::phase_3_run_analysis_passes::hb99188760c9b77156YD
  42: 0xb6dbf360 - driver::driver::compile_input::hd4ea02dac05db950JKD
  43: 0xb6e51d60 - driver::run_compiler::he2e446b60ce2ccb41CH
  44: 0xb6e51c50 - driver::main_args::closure.148066
  45: 0xb650a4d0 - task::TaskBuilder<S>::try_future::closure.100101
  46: 0xb650a2d0 - task::TaskBuilder<S>::spawn_internal::closure.100072
  47: 0xb76d6ed0 - task::spawn_opts::closure.8393
  48: 0xb633a700 - unwind::try::try_fn::hdf9b81d28426036bETd
  49: 0xb6396da0 - rust_try_inner
  50: 0xb6396d60 - rust_try
  51: 0xb63385d0 - unwind::try::hae97d74b77b782e2gRd
  52: 0xb6338420 - task::Task::run::h92279797e7a5a13d92c
  53: 0xb76d6c80 - task::spawn_opts::closure.8333
  54: 0xb6339ec0 - thread::thread_start::he3aa271ed21f4438god
  55:        0x0 - <unknown>
@huonw huonw added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Sep 10, 2014
@mdinger
Copy link
Contributor

mdinger commented Sep 10, 2014

Reduced:

use std::io::{IoError, InvalidInput};
use std::io::net::tcp::TcpStream;

enum Packet {JsonPacket(u8, str)}

impl Packet {
    fn read_json(stream: &mut TcpStream) {
        Ok(0u).and_then(|size| {
            stream.read_byte().and_then(|command| {
                stream.read_exact(size - 1).and_then(|data| {
                    match std::str::from_utf8(data.as_slice()) {
                        Some(&json) => Ok(JsonPacket(command, json)),
                        None => Err(IoError {
                            kind: InvalidInput,
                            desc: "hi",
                            detail: None
                        })
                    }
                })
            })
        });
    }
}

fn main() {}

@mdinger
Copy link
Contributor

mdinger commented Sep 10, 2014

@eddyb says it reduces to this:

Min:

fn main() {
    let &x = "foo";
}

Also says it's probably the same as this: #17118 (comment)

@Nullreff
Copy link
Author

This has been fixed on master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

3 participants