Skip to content

Internal compiler error: index out of bounds #13774

Closed
@pmer

Description

@pmer

Hi,

When I compile the file below, I get a rustc crash.

Paul

rustc 0.11-pre-nightly (eea4909 2014-04-24 23:41:15 -0700)
host: x86_64-apple-darwin

broken.rs

use std::io::net::get_host_addresses;
use std::io::net::ip::SocketAddr;
use std::io::net::tcp::TcpStream;

fn main() {
    let tcp: Option<TcpStream> = match get_host_addresses("foo") {
        Some(ip_addrs) => {
            TcpStream::connect(SocketAddr { ip: ip_addrs[0], port: 123 })
        }
        None => None
    };
}

Output from rustc

$ RUST_BACKTRACE=1 rustc broken.rs
error.rs:7:3: 7:17 error: mismatched types: expected `std::result::Result<~[std::io::net::ip::IpAddr],std::io::IoError>` but found `std::option::Option<<generic #3>>` (expected enum std::result::Result but found enum std::option::Option)
broken.rs:7         Some(ip_addrs) => {
                    ^~~~~~~~~~~~~~
error.rs:10:3: 10:7 error: mismatched types: expected `std::result::Result<~[std::io::net::ip::IpAddr],std::io::IoError>` but found `std::option::Option<<generic #4>>` (expected enum std::result::Result but found enum std::option::Option)
broken.rs:10        None => None
                    ^~~~
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:        0x10ee74844 - rt::backtrace::imp::write::h254d0a6dd1fae24biCa::v0.11.pre
   2:        0x10edd68de - rt::unwind::begin_unwind_inner::h6e474448729455a4oca::v0.11.pre
   3:        0x10edd6068 - rt::unwind::begin_unwind::h7603572080577830236::v0.11.pre
   4:        0x10ee74309 - rt::unwind::begin_unwind_raw::h0893674862f52c69x99::v0.11.pre
   5:        0x10edd52de - rt::unwind::fail_::h986c56d6444ce004b79::v0.11.pre
   6:        0x10ee74352 - rt::unwind::fail_bounds_check::closure.40229
   7:        0x10edd73ee - rt::unwind::fail_bounds_check::haa7cd8c92bfd2426y79::v0.11.pre
   8:        0x10c3bae19 - middle::typeck::check::method::LookupContext<'a>::push_bound_candidates::closure.65797
   9:        0x10c3b93ba - middle::typeck::check::autoderef::h8672163575663336579::v0.11.pre
  10:        0x10c3b6023 - middle::typeck::check::method::LookupContext<'a>::push_bound_candidates::h29b8d24ad9e039f0hr5::v0.11.pre
  11:        0x10c3b62db - middle::typeck::check::method::lookup_in_trait::hb3ac8398b508d0f8394::v0.11.pre
  12:        0x10c3b7206 - middle::typeck::check::try_overloaded_deref::hb57187f417494bacY48::v0.11.pre
  13:        0x10c3f1ae3 - middle::typeck::check::check_expr_with_unifier::h14dfafb7fd79d7ad9y9::v0.11.pre
  14:        0x10c40701b - middle::typeck::check::check_expr_with_unifier::check_struct_or_variant_fields::h3c60b1f6f2d6b1fakBa::v0.11.pre
  15:        0x10c3fa665 - middle::typeck::check::check_expr_with_unifier::h14dfafb7fd79d7ad9y9::v0.11.pre
  16:        0x10c3fbfac - middle::typeck::check::check_expr_with_unifier::check_argument_types::hc4eb6280ef2b8c42eD9::v0.11.pre
  17:        0x10c3f6daf - middle::typeck::check::check_expr_with_unifier::h14dfafb7fd79d7ad9y9::v0.11.pre
  18:        0x10c3d40cc - middle::typeck::check::check_block_with_expected::h8543f9c515ddcaecFUb::v0.11.pre
  19:        0x10c3f3e8e - middle::typeck::check::check_expr_with_unifier::h14dfafb7fd79d7ad9y9::v0.11.pre
  20:        0x10c3520be - middle::typeck::check::_match::check_match::h98ff7676eee7f374mvZ::v0.11.pre
  21:        0x10c3f3948 - middle::typeck::check::check_expr_with_unifier::h14dfafb7fd79d7ad9y9::v0.11.pre
  22:        0x10c40e3e7 - middle::typeck::check::check_decl_local::h1d1cf1f2938ef041LOb::v0.11.pre
  23:        0x10c40e6a3 - middle::typeck::check::check_stmt::hcdc201804707bbadIQb::v0.11.pre
  24:        0x10c3d3d75 - middle::typeck::check::check_block_with_expected::h8543f9c515ddcaecFUb::v0.11.pre
  25:        0x10c3cfd59 - middle::typeck::check::check_fn::h96f34b8abe910ac1oo7::v0.11.pre
  26:        0x10c3cf58a - middle::typeck::check::check_bare_fn::h6d0294df25d164a1fe7::v0.11.pre
  27:        0x10c3c751e - middle::typeck::check::check_item::ha90fc7a645300b4eCK7::v0.11.pre
  28:        0x10c3cf31d - middle::typeck::check::check_item_types::h8ccfb043ecab00a2xd7::v0.11.pre
  29:        0x10c50279f - util::common::time::h14699901310049870540::v0.11.pre
  30:        0x10c5016cd - middle::typeck::check_crate::h1fa7fae4c9077d6aFIu::v0.11.pre
  31:        0x10c91deed - driver::driver::phase_3_run_analysis_passes::h8e28097da6e59f487Df::v0.11.pre
  32:        0x10c923f62 - driver::driver::compile_input::h5c1c854541bd3a7eU3f::v0.11.pre
  33:        0x10c949dd2 - run_compiler::h62e9fe55eaa01b0dLAn::v0.11.pre
  34:        0x10c95dc4d - main_args::closure.91516
  35:        0x10c95bfe2 - monitor::closure.91391
  36:        0x10c957b2b - task::TaskBuilder::try::closure.91157
  37:        0x10eaba47c - task::spawn_opts::closure.7105
  38:        0x10ee6f948 - rt::task::Task::run::closure.40126
  39:        0x10ee796bc - rust_try
  40:        0x10ee6f7c7 - rt::task::Task::run::h67dcf35100df5a07Y27::v0.11.pre
  41:        0x10eaba2ff - task::spawn_opts::closure.7077
  42:        0x10ee73216 - rt::thread::thread_start::he31c712e1f859f82bI8::v0.11.pre
  43:     0x7fff93bd2899 - _pthread_body
  44:     0x7fff93bd272a - _pthread_struct_init

Metadata

Metadata

Assignees

No one assigned

    Labels

    I-ICEIssue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions