Skip to content

assertion failed: end <= self.len(), slice.rs:432 #19772

Closed
@graue

Description

@graue

Got this compiler panic on some (probably badly-typed or otherwise bogus) code while I was playing around with Iron.

$ RUST_BACKTRACE=1 cargo run
   Compiling respin v0.0.1 (file:///home/sf/code/respin)
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. 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' panicked at 'assertion failed: end <= self.len()', /build/buildd/rust-nightly-201412110407~c38e73f~trusty/src/libcore/slice.rs:432

stack backtrace:
   1:     0x7f28ee9444a0 - rt::backtrace::imp::write::h55de1d8099e4900eGOx
   2:     0x7f28ee9476e0 - <unknown>
   3:     0x7f28ee598730 - unwind::begin_unwind_inner::h883d9d0bc1a42020CJc
   4:     0x7f28ee598230 - unwind::begin_unwind_fmt::h8f8e4ba4676dfd67ZGc
   5:     0x7f28ee5981f0 - rust_begin_unwind
   6:     0x7f28ee5e0d00 - panicking::panic_fmt::h1f5e8516e9378c44Rtl
   7:     0x7f28ee5dea00 - panicking::panic::h32a2f1670d6e76bbhrl
   8:     0x7f28ece75810 - <unknown>
   9:     0x7f28ece6e480 - <unknown>
  10:     0x7f28ece69c80 - metadata::loader::Context<'a>::load_library_crate::h7d265ef09dd588e4Rew
  11:     0x7f28ece64a00 - <unknown>
  12:     0x7f28ece5ef90 - metadata::creader::Env<'a>.visit..Visitor<'v>::visit_view_item::h62ac4fa3f4f6b218pzu
  13:     0x7f28ece5e3b0 - metadata::creader::read_crates::hf06f8f790089383djyu
  14:     0x7f28eedb47c0 - <unknown>
  15:     0x7f28eed75180 - driver::phase_3_run_analysis_passes::hf054103c6dc131a2Cta
  16:     0x7f28eed63f10 - driver::compile_input::h88782f52f60d8ddfpba
  17:     0x7f28eee00b70 - <unknown>
  18:     0x7f28eee00a60 - <unknown>
  19:     0x7f28eee12440 - <unknown>
  20:     0x7f28ee91c920 - <unknown>
  21:     0x7f28ee5963d0 - <unknown>
  22:     0x7f28ee5f3b20 - <unknown>
  23:     0x7f28ee5f3b10 - rust_try
  24:     0x7f28ee5964b0 - unwind::try::h11e0e7a86a15bb76Tyc
  25:     0x7f28ee596270 - task::Task::run::ha12fe9def6cd7cccfKb
  26:     0x7f28ee595e60 - <unknown>
  27:     0x7f28ee5978b0 - <unknown>
  28:     0x7f28e95c20c0 - start_thread
  29:     0x7f28ee25bec9 - __clone
  30:                0x0 - <unknown>

Could not compile `respin`.

To learn more, run the command again with --verbose.
$ rustc --version=verbose
rustc 0.13.0-dev
binary: rustc
commit-hash: unknown
commit-date: unknown
host: x86_64-unknown-linux-gnu
release: 0.13.0-dev

(on Ubuntu 14.04.1, if that makes a difference)

The code (main.rs), depending on iron 0.0.7:

#![feature(globs)]

extern crate iron;

use iron::prelude::*;
use iron::status;
use iron::response::modifiers::{Status, Body};
use iron::lib::Router;
use iron::method::Method::Get;

fn main() {
    fn hello_world(_: &mut Request) -> IronResult<Response> {
        Ok(Response::new()
            .set(Status(status::Ok))
            .set(Body("Hello, respinners!"))
        )
    }

    fn hello_name(req: &mut Request) -> IronResult<Response> {
        let name = "foobar";
        Ok(Response::new()
            .set(Status(status::Ok))
            .set(Body(format!("Hello, {}!", name))))
    }

    let handler = Router::new()
        .route(Get, "/", hello_world)
        .route(Get, "/hello/to/:name", hello_name);

    Iron::new(handler).listen("localhost:3000").unwrap();
    println!("Running on http://localhost:3000");
}

Full command-line (from rerunning cargo with --verbose):

rustc /home/sf/code/respin/src/main.rs --crate-name respin --crate-type bin -g --out-dir /home/sf/code/respin/target --dep-info /home/sf/code/respin/target/.fingerprint/respin-a6dd2b0ba6279ec4/dep-bin-respin -L /home/sf/code/respin/target -L /home/sf/code/respin/target/deps --extern iron=/home/sf/code/respin/target/deps/libiron-e87c72731129dad5.rlib --extern sqlite3=/home/sf/code/respin/target/deps/libsqlite3-6fbe643ffe0fcd2b.rlib -L /usr/lib/x86_64-linux-gnu -L /home/sf/code/respin/target/build/time-e4630d556186c523/out

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