Closed
Description
Test case:
fn main() {
let mut buffer = Vec::new();
std::io::stdin().read_line(&mut buffer);
}
Output:
src/main.rs:3:32: 3:43 error: mismatched types:
expected `&mut collections::string::String`,
found `&mut collections::vec::Vec<_>`
(expected struct `collections::string::String`,
found struct `collections::vec::Vec`) [E0308]
src/main.rs:3 std::io::stdin().read_line(&mut buffer);
^~~~~~~~~~~
src/main.rs:3:32: 3:43 help: run `rustc --explain E0308` to see a detailed explanation
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 4 but the index is 6', ../src/libcollections/vec.rs:1178
stack backtrace:
1: 0x7f4effa18110 - sys::backtrace::tracing::imp::write::h7af3c3cfd3e65a783bv
2: 0x7f4effa2146b - panicking::default_handler::_$u7b$$u7b$closure$u7d$$u7d$::closure.44497
3: 0x7f4effa20fc3 - panicking::default_handler::h75ebcc0c8bcd1085rRz
4: 0x7f4eff9e585c - sys_common::unwind::begin_unwind_inner::hcec45e84262f1855m0t
5: 0x7f4eff9e62f8 - sys_common::unwind::begin_unwind_fmt::h62c174e37e54c321sZt
6: 0x7f4effa15b71 - rust_begin_unwind
7: 0x7f4effa6856f - panicking::panic_fmt::h5f920bbc722cd548lcM
8: 0x7f4effa68752 - panicking::panic_bounds_check::hc7552cae568055c9rbM
9: 0x7f4efcd4069f - middle::infer::InferCtxt<'a, 'tcx>::shallow_resolve::hf6ff75a42cfc2abfCiE
10: 0x7f4efce10abb - middle::traits::fulfill::process_predicate::hba0cba8efbf8acdawyU
11: 0x7f4efce0f7e7 - obligation_forest::ObligationForest<O, T>::process_obligations::h16997701126397106394
12: 0x7f4efce0ae6f - middle::traits::fulfill::FulfillmentContext<'tcx>::select_where_possible::h1b112c81d6b103c5BqU
13: 0x7f4efefa2ed1 - check::FnCtxt<'a, 'tcx>::select_obligations_where_possible::h3110f11e9a68791ajDq
14: 0x7f4efefc9c0c - check::check_argument_types::h3e4bc8dcbdfe3e47j3q
15: 0x7f4efefc8f24 - check::check_method_argument_types::h2b421829214fc9bfK0q
16: 0x7f4efefdc038 - check::check_expr_with_unifier::check_method_call::h40605e88d809513emFr
17: 0x7f4eff00523f - check::check_expr_with_unifier::h7435735517896598653
18: 0x7f4eff018a71 - check::check_stmt::h27f273f9d63167496Vs
19: 0x7f4efefa9303 - check::check_block_with_expected::h6ffc0ae0594a45f7TZs
20: 0x7f4efefa0289 - check::check_fn::h2545140b5fe4a17bYPo
21: 0x7f4efef9d99f - check::check_bare_fn::h92b85a4e7b67d57asFo
22: 0x7f4efef98846 - check::check_item_body::hf143be9d0498177aY4o
23: 0x7f4efef8f2fb - check::check_item_bodies::hfdadc35dd9e39914fDo
24: 0x7f4efef86b83 - check_crate::he92b840a76d6d63cOEC
25: 0x7f4efff43517 - driver::phase_3_run_analysis_passes::_$u7b$$u7b$closure$u7d$$u7d$::closure.28579
26: 0x7f4efff41985 - middle::ty::context::ctxt<'tcx>::create_and_enter::h6681449678745636205
27: 0x7f4efff3e4df - driver::phase_3_run_analysis_passes::h3690321397878926181
28: 0x7f4efff11845 - driver::compile_input::hf5b4c0cfabf44771Hca
29: 0x7f4efff00997 - run_compiler::h382da26f627d0d776Oc
30: 0x7f4effefe111 - sys_common::unwind::try::try_fn::h10497329671291346377
31: 0x7f4effa15afb - __rust_try
32: 0x7f4effa0e0ad - sys_common::unwind::inner_try::h27915955daa5bb0coXt
33: 0x7f4effefe960 - boxed::F.FnBox<A>::call_box::h12722420362853020748
34: 0x7f4effa1fa39 - sys::thread::Thread::new::thread_start::h47cad50136a0a353LOy
35: 0x7f4ef81a5423 - start_thread
36: 0x7f4eff697cbc - clone
37: 0x0 - <unknown>
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
TimNN commentedon Apr 15, 2016
Even smaller test case:
(Edited with more examples).
alexcrichton commentedon Apr 20, 2016
Nominating because this seems to be coming up all over the place, I think we've gotten 3-4 separate reports about this ICE (a regression on beta).
Note that an ICE happens on stable, but a worse ICE happens on beta/nightly...
TimNN commentedon Apr 20, 2016
To be more precise, the regression is that the actual error message about mismatched types only shows up on stable and not on beta or nightly.
nikomatsakis commentedon Apr 21, 2016
related to #25801
nikomatsakis commentedon Apr 21, 2016
triage: P-high
This core issue according to @arielb1 is the problem of the OF not doing snapshotting, but method resolution assumes it does. An older fix was #26324.
arielb1 commentedon Apr 21, 2016
Not method resolution, but rather coercion (
autoderef
in deref-coerce).17 remaining items