-
-
Notifications
You must be signed in to change notification settings - Fork 14.3k
Closed
Description
Using either rust-stable or rust-nightly, this very short program crashes the compiler.
The program:
use std::io::Read;
fn main() {
let mut file = std::fs::File::open("foobar").unwrap();
let mut data = Vec::new();
file.read_to_string(&mut data);
}
Note that replacing Vec::new() by String::new() prevents the crash.
Rust stable:
~ $ rustc --version
rustc 1.8.0 (db2939409 2016-04-11)
Rust nightly:
~ $ rustc --version
rustc 1.10.0-nightly (c2aaad4e2 2016-04-19)
The output:
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
thread 'rustc' panicked at 'index out of bounds: the len is 11 but the index is 13', ../src/libcollections/vec.rs:1167
note: Run with `RUST_BACKTRACE=1` for a backtrace.
The full backtrace (with rust-nightly):
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: https://github.com/rust-lang/rust/blob/master/CONTRIBUTING.md#bug-reports
note: run with `RUST_BACKTRACE=1` for a backtrace
thread 'rustc' panicked at 'index out of bounds: the len is 11 but the index is 13', ../src/libcollections/vec.rs:1167
stack backtrace:
1: 0x7fa968befa30 - std::sys::backtrace::tracing::imp::write::h9fb600083204ae7f
2: 0x7fa968bfd15b - std::panicking::default_hook::_$u7b$$u7b$closure$u7d$$u7d$::hca543c34f11229ac
3: 0x7fa968bfccfc - std::panicking::default_hook::hc2c969e7453d080c
4: 0x7fa968bc1caf - std::sys_common::unwind::begin_unwind_inner::h30e12d15ce2b2e25
5: 0x7fa968bc3d98 - std::sys_common::unwind::begin_unwind_fmt::hb2de8a9968d38523
6: 0x7fa968bed241 - rust_begin_unwind
7: 0x7fa968c46c2f - core::panicking::panic_fmt::h257ceb0aa351d801
8: 0x7fa968c46e12 - core::panicking::panic_bounds_check::h3956fdcea61ff421
9: 0x7fa9625b8c1d - _<rustc_data_structures..unify..UnificationTable<K>>::get::h8ff555081abcc760
10: 0x7fa96254eeb0 - rustc::infer::InferCtxt::shallow_resolve::hfc381191678ece49
11: 0x7fa9626b09ac - rustc::traits::fulfill::process_predicate::h50d92c736b2117cd
12: 0x7fa9626af667 - _<rustc_data_structures..obligation_forest..ObligationForest<O, T>>::process_obligations::h801b999b695da4c6
13: 0x7fa9626aabff - rustc::traits::fulfill::FulfillmentContext::select_where_possible::hc6625a5b67377669
14: 0x7fa963326fb1 - rustc_typeck::check::FnCtxt::select_obligations_where_possible::h876c2a416d1ee524
15: 0x7fa963338733 - rustc_typeck::check::FnCtxt::resolve_type_vars_if_possible::h44ddab2310adb98d
16: 0x7fa96334d286 - rustc_typeck::check::demand::coerce::hc53f70b253f2bed8
17: 0x7fa96334a996 - rustc_typeck::check::check_argument_types::h68c1a3ccd137ffc6
18: 0x7fa9633499cf - rustc_typeck::check::check_method_argument_types::h6b7c687d48244f8c
19: 0x7fa96334fed9 - rustc_typeck::check::check_expr_with_expectation_and_lvalue_pref::hdaa9a3d5d214eeb7
20: 0x7fa963385b46 - rustc_typeck::check::check_stmt::h7b32d7406e628d2a
21: 0x7fa96332c8c8 - rustc_typeck::check::check_block_with_expected::hc05ff1e7fff64a1e
22: 0x7fa963324559 - rustc_typeck::check::check_fn::hb43882d54094ac4a
23: 0x7fa963321e0c - rustc_typeck::check::check_bare_fn::h7e4c2ad58d1814dd
24: 0x7fa96331ccc6 - rustc_typeck::check::check_item_body::h7ffec660fc242796
25: 0x7fa963314a51 - rustc_typeck::check::check_item_bodies::ha729008a2e67410e
26: 0x7fa96330bfbf - rustc_typeck::check_crate::hb08ba31a6a5f65b5
27: 0x7fa96914c910 - rustc_driver::driver::phase_3_run_analysis_passes::_$u7b$$u7b$closure$u7d$$u7d$::h5a042a091cd7658c
28: 0x7fa96914ab1b - rustc::ty::context::TyCtxt::create_and_enter::h3f9051bcccbd93e4
29: 0x7fa9691475ce - rustc_driver::driver::phase_3_run_analysis_passes::h9c723484c588a35b
30: 0x7fa969119f6f - rustc_driver::driver::compile_input::h0629572e6f316b31
31: 0x7fa9691004d4 - rustc_driver::run_compiler::h8902aebf8b1849a8
32: 0x7fa9690fd941 - std::sys_common::unwind::try::try_fn::h4c74456035d0fcc7
33: 0x7fa968bed1cb - __rust_try
34: 0x7fa968bed15d - std::sys_common::unwind::inner_try::h47a4d9cd4a369dcd
35: 0x7fa9690fe18a - _<F as std..boxed..FnBox<A>>::call_box::h27f542a39f1d61ef
36: 0x7fa968bfb2f4 - std::sys::thread::Thread::new::thread_start::h6f266e069bf4ec2b
37: 0x7fa960a4c423 - start_thread
38: 0x7fa968859cbc - clone
39: 0x0 - <unknown>
Metadata
Metadata
Assignees
Labels
No labels