Closed
Description
This code causes ICE after recent rust changes:
use std::default::Default;
pub trait Message {
fn new() -> Self { panic!(); }
}
fn new_instance<M : 'static + Message>() -> Box<Message + 'static> {
let m: M = Default::default();
box m as Box<Message>
}
fn main() {}
This is minimal example I can think of.
Error is:
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: *start <= *end', /Users/rustbuild/src/rust-buildbot/slave/nightly-mac/build/src/libcore/slice.rs:396
stack backtrace:
1: 0x10c899619 - rt::backtrace::imp::write::h03fee16d4a0b6b41moq
2: 0x10c89c85c - failure::on_fail::h3e0f6b3c6c4bbcc3VEq
3: 0x10caf9f05 - unwind::begin_unwind_inner::h6c7f4532e72658d7SJd
4: 0x10caf9b9f - unwind::begin_unwind_fmt::h9863b25c438d6314kHd
5: 0x10caf98f2 - rust_begin_unwind
6: 0x10cb5053c - panicking::panic_fmt::hc53a414d3d53805bi7j
7: 0x10cb46f6f - panicking::panic::h5cf45d77d6cb56acm4j
8: 0x109a8f83b - middle::typeck::check::vtable::check_object_safety::h3ee32f70bc2a6910cvN
9: 0x109a8eab4 - middle::typeck::check::vtable::check_object_cast::ha17cfa6c915c29failN
10: 0x109af7954 - middle::typeck::check::check_cast::h212d4526506e607bdwW
11: 0x109b1fae4 - middle::typeck::check::check_expr_with_unifier::h153e2ccf9b0cb061XCY
12: 0x109aeb2d1 - middle::typeck::check::check_block_with_expected::heb9a0fb2300c4559PJ0
13: 0x109ae6d42 - middle::typeck::check::check_fn::h0449d63e5b4f3e3a9oV
14: 0x109ae626f - middle::typeck::check::check_bare_fn::hf2de12c52654551eoeV
15: 0x109ae218d - middle::typeck::check::check_item::hfaeea23703d7dd28xyV
16: 0x109ae60bf - middle::typeck::check::check_item_types::haaff85b74e988d92ydV
17: 0x1095fc556 - util::common::time::h11920059333862041717
18: 0x109da659e - middle::typeck::check_crate::h50fcc5c8b39993f4LVn
19: 0x109e0ebcf - driver::driver::phase_3_run_analysis_passes::h1425a4ca465c7b097DA
20: 0x109e092b8 - driver::driver::compile_input::h60bc42ef7fabbfd4SkA
21: 0x109e86ca8 - driver::run_compiler::h4031243f49082a9fw7D
22: 0x109e84ece - driver::run::closure.145349
23: 0x10961481b - task::TaskBuilder<S>::try_future::closure.103709
24: 0x109614713 - task::TaskBuilder<S>::spawn_internal::closure.103680
25: 0x10959798d - task::NativeSpawner.Spawner::spawn::closure.8526
26: 0x10cb6020c - rust_try_inner
27: 0x10cb601f6 - rust_try
28: 0x10caf7677 - unwind::try::hab84862d0081b274cyd
29: 0x10caf750c - task::Task::run::h39093ecd59554b49ZJc
30: 0x1095977b3 - task::NativeSpawner.Spawner::spawn::closure.8463
31: 0x10caf8d37 - thread::thread_start::h589be8c0a398d299e5c
32: 0x7fff993572fc - _pthread_body
33: 0x7fff99357279 - _pthread_body
% rustc --version
rustc 0.13.0-nightly (88b6e93d3 2014-10-31 23:36:48 +0000)
% uname
Darwin