Closed
Description
Meta
$ rustc +nightly --version --verbose
rustc 1.33.0-nightly (60e825389 2018-12-28)
binary: rustc
commit-hash: 60e825389db3cb7421afb7015b28cb9436c79bba
commit-date: 2018-12-28
host: x86_64-unknown-linux-gnu
release: 1.33.0-nightly
LLVM version: 8.0
Code Sample
cargo.toml
[package]
name = "bug"
[dependencies]
src/main.rs
trait Scan<T> {
fn scan(&mut self) -> Option<T>;
}
impl<'a, T> Scan<T> for Iterator<Item=T> {
fn scan(&mut self) -> Option<T> {
self.next()
}
}
fn wrap_scanner<'a, T>(s: &'a mut Scan<T>) -> (impl FnMut() -> Option<T> + 'a) {
move || { s.scan() }
}
fn main() {
let scanner = &mut wrap_scanner(&mut "buggy".chars() as &mut Iterator<Item=char>);
}
Compiler flags
RUST_BACKTRACE=full cargo +nightly run --verbose
Backtrace
Compiling bug v0.1.0 (/home/jonne/bug)
Running `rustc --crate-name bug src/main.rs --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=f60f04bfbdb5bf06 -C extra-filename=-f60f04bfbdb5bf06 --out-dir /home/jonne/bug/target/debug/deps -C incremental=/home/jonne/bug/target/debug/incremental -L dependency=/home/jonne/bug/target/debug/deps`
thread 'rustc' panicked at 'index out of bounds: the len is 533 but the index is 533', /rustc/60e825389db3cb7421afb7015b28cb9436c79bba/src/libcore/slice/mod.rs:2455:10
stack backtrace:
0: 0x7fe6ff227663 - std::sys::unix::backtrace::tracing::imp::unwind_backtrace::ha048ab13d89f3a09
at src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:39
1: 0x7fe6ff21fcc8 - std::sys_common::backtrace::_print::hdc3d6ec6d0c40360
at src/libstd/sys_common/backtrace.rs:70
2: 0x7fe6ff2237f2 - std::panicking::default_hook::{{closure}}::h7acca10a85297ad4
at src/libstd/sys_common/backtrace.rs:58
at src/libstd/panicking.rs:200
3: 0x7fe6ff223564 - std::panicking::default_hook::h0269753a0683b10e
at src/libstd/panicking.rs:215
4: 0x7fe6fb2c2f2f - rustc::util::common::panic_hook::h1695c95b4d531ed2
5: 0x7fe6ff223fd9 - std::panicking::rust_panic_with_hook::h9c5e819f879ce50a
at src/libstd/panicking.rs:482
6: 0x7fe6ff223a81 - std::panicking::continue_panic_fmt::hc486db806482bb1d
at src/libstd/panicking.rs:385
7: 0x7fe6ff223965 - rust_begin_unwind
at src/libstd/panicking.rs:312
8: 0x7fe6ff24dc7c - core::panicking::panic_fmt::h47839c417f27461d
at src/libcore/panicking.rs:85
9: 0x7fe6ff24dc30 - core::panicking::panic_bounds_check::h61628935017e404a
at src/libcore/panicking.rs:61
10: 0x7fe6fae4aeb7 - <ena::unify::UnificationTable<S>>::get_root_key::h54b43cd349b1d84c
11: 0x7fe6fb054318 - rustc::infer::InferCtxt::shallow_resolve::h72d4e24505d52216
12: 0x7fe6fb49871c - <rustc::infer::resolve::OpportunisticTypeResolver<'a, 'gcx, 'tcx> as rustc::ty::fold::TypeFolder<'gcx, 'tcx>>::fold_ty::h3df340bcefea71c6
13: 0x7fe6fd74c6d4 - rustc::infer::InferCtxt::probe::haef55bcadde8315d
14: 0x7fe6fd92b601 - <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter::h4465b21670ac69fc
15: 0x7fe6fd90037b - rustc_typeck::check::method::probe::ProbeContext::pick_method::h3084489de37473fb
16: 0x7fe6fd8ff950 - rustc_typeck::check::method::probe::ProbeContext::pick_core::h6bcb6ee844014648
17: 0x7fe6fd93675e - <core::iter::FilterMap<I, F> as core::iter::iterator::Iterator>::next::h885bd6d0582f6e15
18: 0x7fe6fd92b2d3 - <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter::h3f9649def844822f
19: 0x7fe6fd74a473 - rustc::infer::InferCtxt::probe::h69effbf9671f3ad3
20: 0x7fe6fd8ff31b - rustc_typeck::check::method::probe::ProbeContext::pick::hf4be5658576b8647
21: 0x7fe6fd74d723 - rustc::infer::InferCtxt::probe::hfc12c7dd9980b78d
22: 0x7fe6fd7ff882 - rustc_typeck::check::method::probe::<impl rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx>>::probe_op::hdb7ddbc1ebaa5b1d
23: 0x7fe6fd92632e - <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T, I>>::from_iter::h1075ce2f37577934
24: 0x7fe6fd831e28 - rustc_typeck::check::FnCtxt::suggest_ref_or_into::hf3d0404a8be0d11f
25: 0x7fe6fd7fd948 - rustc_typeck::check::demand::<impl rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx>>::demand_coerce::h1115fac74c7ebec3
26: 0x7fe6fd81db15 - rustc_typeck::check::FnCtxt::check_argument_types::h8d0262e5ccd1eadb
27: 0x7fe6fd809c64 - rustc_typeck::check::callee::<impl rustc_typeck::check::FnCtxt<'a, 'gcx, 'tcx>>::confirm_builtin_call::h3559f919d63a244b
28: 0x7fe6fd82650f - rustc_typeck::check::FnCtxt::check_expr_kind::hd58fd448e44d5764
29: 0x7fe6fd820520 - rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_needs::h9f2763fcc5139c57
30: 0x7fe6fd8267cf - rustc_typeck::check::FnCtxt::check_expr_kind::hd58fd448e44d5764
31: 0x7fe6fd820520 - rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_needs::h9f2763fcc5139c57
32: 0x7fe6fd82ec19 - rustc_typeck::check::FnCtxt::check_decl_local::h0cf9f8849fb9ea48
33: 0x7fe6fd82f1b4 - rustc_typeck::check::FnCtxt::check_block_with_expected::h8f701afea4ff4f9d
34: 0x7fe6fd820e51 - rustc_typeck::check::FnCtxt::check_expr_kind::hd58fd448e44d5764
35: 0x7fe6fd820520 - rustc_typeck::check::FnCtxt::check_expr_with_expectation_and_needs::h9f2763fcc5139c57
36: 0x7fe6fd81f729 - rustc_typeck::check::FnCtxt::check_return_expr::hd59b265a860efc30
37: 0x7fe6fd80fe3c - rustc_typeck::check::check_fn::h76d7437b6ade8cba
38: 0x7fe6fd8c91c9 - rustc::ty::context::GlobalCtxt::enter_local::hd6501c6e488678af
39: 0x7fe6fd80eb16 - rustc_typeck::check::typeck_tables_of::h10efc5b3a8f1b01a
40: 0x7fe6fae3aa3c - rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::typeck_tables_of<'tcx>>::compute::h435fb0347d553697
41: 0x7fe6fb450a33 - rustc::dep_graph::graph::DepGraph::with_task_impl::hb4a58a0b2aa1e4e0
42: 0x7fe6fadfa3e1 - <rustc::ty::query::plumbing::JobOwner<'a, 'tcx, Q>>::start::h554bc5fb05753448
43: 0x7fe6fb16b590 - rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_with_job::h0005598c45c306a5
44: 0x7fe6fb15f533 - rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_get_with::hf3c19a1f27a1d380
45: 0x7fe6fb1a2804 - rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::ensure_query::h5e1d9ab0477d63eb
46: 0x7fe6fd6b818c - rustc::session::Session::track_errors::h4498f2993bed0651
47: 0x7fe6fd80e5fe - rustc_typeck::check::typeck_item_bodies::hc8c51eb3fd4f00ec
48: 0x7fe6fd7730e6 - rustc::ty::query::__query_compute::typeck_item_bodies::h25849d3e9df44c07
49: 0x7fe6fd771b18 - rustc::ty::query::<impl rustc::ty::query::config::QueryAccessors<'tcx> for rustc::ty::query::queries::typeck_item_bodies<'tcx>>::compute::hc2b47b6e6c3e8533
50: 0x7fe6fd70f7af - rustc::dep_graph::graph::DepGraph::with_task_impl::h102c01efa786843a
51: 0x7fe6fd78fc1c - <rustc::ty::query::plumbing::JobOwner<'a, 'tcx, Q>>::start::h54d4ba74bafe6933
52: 0x7fe6fd8b5977 - rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::force_query_with_job::hd6834514b10be281
53: 0x7fe6fd86c566 - rustc::ty::query::plumbing::<impl rustc::ty::context::TyCtxt<'a, 'gcx, 'tcx>>::try_get_with::h11a804961bda941c
54: 0x7fe6fd6c96c4 - rustc_typeck::check_crate::ha6849350ff284a8d
55: 0x7fe6ff5cfe96 - <std::thread::local::LocalKey<T>>::with::h5b1d17641d082546
56: 0x7fe6ff57da60 - rustc::ty::context::TyCtxt::create_and_enter::haf4f12b4da36ea42
57: 0x7fe6ff59df9a - rustc_driver::driver::compile_input::ha861e86974807b4d
58: 0x7fe6ff51db30 - rustc_driver::run_compiler_with_pool::h094540acf0a58157
59: 0x7fe6ff528b35 - <scoped_tls::ScopedKey<T>>::set::haf59a094991db106
60: 0x7fe6ff51c97a - rustc_driver::run_compiler::h51c542194a1aa7e5
61: 0x7fe6ff528cea - <scoped_tls::ScopedKey<T>>::set::hcf03caad7f1e4ad3
62: 0x7fe6ff5dae32 - std::sys_common::backtrace::__rust_begin_short_backtrace::hc15361ac1cb68e6c
63: 0x7fe6ff235569 - __rust_maybe_catch_panic
at src/libpanic_unwind/lib.rs:92
64: 0x7fe6ff5ee460 - <F as alloc::boxed::FnBox<A>>::call_box::h2da068bc8228d7c0
65: 0x7fe6ff23434d - std::sys::unix::thread::Thread::new::thread_start::h568fd870028046e0
at /rustc/60e825389db3cb7421afb7015b28cb9436c79bba/src/liballoc/boxed.rs:734
at src/libstd/sys_common/thread.rs:14
at src/libstd/sys/unix/thread.rs:81
66: 0x7fe6f8f8f6da - start_thread
67: 0x7fe6feeef88e - __clone
68: 0x0 - <unknown>
query stack during panic:
#0 [typeck_tables_of] processing `main`
#1 [typeck_item_bodies] type-checking all item bodies
end of query stack
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: rustc 1.33.0-nightly (60e825389 2018-12-28) running on x86_64-unknown-linux-gnu
note: compiler flags: -C debuginfo=2 -C incremental --crate-type bin
note: some of the compiler flags provided by cargo are hidden
error: Could not compile `bug`.
Caused by:
process didn't exit successfully: `rustc --crate-name bug src/main.rs --color always --crate-type bin --emit=dep-info,link -C debuginfo=2 -C metadata=f60f04bfbdb5bf06 -C extra-filename=-f60f04bfbdb5bf06 --out-dir /home/jonne/bug/target/debug/deps -C incremental=/home/jonne/bug/target/debug/incremental -L dependency=/home/jonne/bug/target/debug/deps` (exit code: 101)