Closed huachaohuang closed 9 years ago
I've also just run into this, here's the error and the backtrace.
error: internal compiler error: Impl DefId { krate: 2, node: 34078 } was matchable against Obligation(predicate=Binder(TraitPredicate(core::ops::Add<_>)),depth=1) but now is not
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 'Box<Any>', /Users/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-mac/build/src/libsyntax/diagnostic.rs:190
stack backtrace:
1: 0x1121339f4 - sys::backtrace::write::h79b5fc37599ff6dfazD
2: 0x1121614b0 - panicking::on_panic::h56cd7321a5392f568oJ
3: 0x112071c8e - rt::unwind::begin_unwind_inner::h9b1dd02e7e9b2523i7I
4: 0x1118565ce - rt::unwind::begin_unwind::h5359193300489870763
5: 0x111856e19 - diagnostic::Handler::bug::h0696301796c915b4ShB
6: 0x10f3ae6be - middle::traits::select::SelectionContext<'cx, 'tcx>::rematch_impl::h00877b9f7d68b755V3R
7: 0x10f3ae008 - middle::infer::InferCtxt<'a, 'tcx>::try::h1635483048343115861
8: 0x10f38f454 - middle::traits::select::SelectionContext<'cx, 'tcx>::confirm_candidate::h2b843f592bb3d1ebJlR
9: 0x10f3638e3 - middle::traits::select::SelectionContext<'cx, 'tcx>::select::h48941a5b9b6aeafbApP
10: 0x10f37363a - middle::traits::project::project_type::h27f6c84f9a43d3fbK5N
11: 0x10f371017 - middle::traits::project::opt_normalize_projection_type::h7647720dfb8d8959mYN
12: 0x10f36aa36 - middle::traits::project::poly_project_and_unify_type::closure.81002
13: 0x10f368a40 - middle::traits::project::poly_project_and_unify_type::h14c21863493f04758EN
14: 0x10f3602e6 - middle::traits::fulfill::FulfillmentContext<'tcx>::select::hd40ad264985439f7hhN
15: 0x10f35f928 - middle::traits::fulfill::FulfillmentContext<'tcx>::select_where_possible::h0ebb717f715533c9vgN
16: 0x10e724d63 - check::vtable::select_fcx_obligations_where_possible::hbca02d457f2550e2r4b
17: 0x10e75d48d - check::FnCtxt<'a, 'tcx>::resolve_type_vars_if_possible::h4ae213f9cb49bdadLYo
18: 0x10e7d91ae - check::op::check_binop::h03b611fd681fb03fM6m
19: 0x10e81e5cc - check::check_expr_with_unifier::h17623262095715920792
20: 0x10e8484f2 - check::check_decl_local::hceee65fb94b47336eis
21: 0x10e7e8ad1 - check::check_block_with_expected::ha2448513d5fb9fb9kos
22: 0x10e82bf51 - check::check_expr_with_unifier::h15858122413925670105
23: 0x10e713b05 - check::_match::check_match::closure.28752
24: 0x10e713811 - check::_match::check_match::h6e204581d7b2887c9mb
25: 0x10e81eba4 - check::check_expr_with_unifier::h17623262095715920792
26: 0x10e7e8e0b - check::check_block_with_expected::ha2448513d5fb9fb9kos
27: 0x10e803584 - check::check_block_no_value::he84d13599fd37c5alns
28: 0x10e82be51 - check::check_expr_with_unifier::h15858122413925670105
29: 0x10e713b05 - check::_match::check_match::closure.28752
30: 0x10e713811 - check::_match::check_match::h6e204581d7b2887c9mb
31: 0x10e81eba4 - check::check_expr_with_unifier::h17623262095715920792
32: 0x10e8484f2 - check::check_decl_local::hceee65fb94b47336eis
33: 0x10e7e8ad1 - check::check_block_with_expected::ha2448513d5fb9fb9kos
34: 0x10e81ec21 - check::check_expr_with_unifier::h17623262095715920792
35: 0x10e7e8e0b - check::check_block_with_expected::ha2448513d5fb9fb9kos
36: 0x10e82bf51 - check::check_expr_with_unifier::h15858122413925670105
37: 0x10e713b05 - check::_match::check_match::closure.28752
38: 0x10e713811 - check::_match::check_match::h6e204581d7b2887c9mb
39: 0x10e81eba4 - check::check_expr_with_unifier::h17623262095715920792
40: 0x10e7e8e0b - check::check_block_with_expected::ha2448513d5fb9fb9kos
41: 0x10e82bf51 - check::check_expr_with_unifier::h15858122413925670105
42: 0x10e713b05 - check::_match::check_match::closure.28752
43: 0x10e713811 - check::_match::check_match::h6e204581d7b2887c9mb
44: 0x10e81eba4 - check::check_expr_with_unifier::h17623262095715920792
45: 0x10e7e8e0b - check::check_block_with_expected::ha2448513d5fb9fb9kos
46: 0x10e7c33e5 - check::check_fn::h7a50c890b5419d55G1n
47: 0x10e7e395e - check::check_bare_fn::hb7403022fad4c11dfRn
48: 0x10e7db85f - check::check_item::hede794dfa708b89909n
49: 0x10e7e1ec2 - visit::walk_item::h9731833736362995753
50: 0x10e8b8ff1 - check_crate::closure.36204
51: 0x10e8b3437 - check_crate::h2a80ddc71481fbe04wC
52: 0x10e5d7287 - driver::phase_3_run_analysis_passes::h6b1a4d735c5454a3oGa
53: 0x10e5bb9c5 - driver::compile_input::hc433cbaf5268b434Qba
54: 0x10e679b75 - run_compiler::hfdf6389c24d7bf2fp2b
55: 0x10e67748f - thunk::F.Invoke<A, R>::invoke::h17962875359394492347
56: 0x10e6765b7 - rt::unwind::try::try_fn::h2161268800680238185
57: 0x1121e8028 - rust_try_inner
58: 0x1121e8015 - rust_try
59: 0x10e676988 - thunk::F.Invoke<A, R>::invoke::h12486231582466062018
60: 0x11214a91d - sys::thread::create::thread_start::h5cc5a46a7850c86a84H
61: 0x7fff82c3e267 - _pthread_body
62: 0x7fff82c3e1e4 - _pthread_start
Could not compile `elmesque`.
I haven't yet been able to isolate the culprit code, I'll keep searching and post it if I come across it. Just thought I'd share this first.
This occurred on rustc 1.0.0-nightly (6cf3b0b74 2015-03-30) (built 2015-03-30)
Not sure if this helps at all, but I was able to side-step this ICE in my own code by changing an incorrect generic integer to a correct generic float.
To be exact, I changed this (which should have been a compile error, but ICEd):
let mut half_prev_width = 0;
to this (which compiles fine):
let mut half_prev_width = 0.0;
The following is the block of code in which this occurred:
let multi = if let Direction::Right = direction { 1.0 } else { -1.0 };
let mut half_prev_width = 0;
for element in elements.into_iter() {
let element = element.opacity(props.opacity * element.props.opacity);
let half_width = width_of(&element) as f64 / 2.0;
draw_element(element, matrix, g, draw_state);
let x_trans = half_width + half_prev_width;
let Transform2D(new_matrix) = Transform2D(matrix)
.multiply(transform_2d::translation(x_trans * multi, 0.0));
matrix = new_matrix;
half_prev_width = half_width;
}
I think the error that rustc should have given was
error: mismatched types:
expected `_`,
found `f64`
Perhaps the ICE is related to the way this error is detected, or perhaps the way the generic number's type is inferred?
I tried recreating the ICE in a simpler playpen example to no avail. Hopefully this helps point someone in the right direction though!
I can reproduce this error with the following test case (playpen):
fn main() {
let _ = 0f32 * 0.0 * 0;
}
The ICE also happens with the operators + - / %
.
Adding or removing any type suffix, changing the operand order or using two different operators fixes the ICE.
Version: rustc 1.0.0-nightly (00978a987 2015-04-18) (built 2015-04-18)
on OS X
Backtrace:
error: internal compiler error: Impl DefId { krate: 2, node: 41567 } was matchable against Obligation(predicate=Binder(TraitPredicate(<f32 as core::ops::Mul<_>>)),depth=1) but now is not
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 'Box<Any>', /Users/rustbuild/src/rust-buildbot/slave/nightly-dist-rustc-mac/build/src/libsyntax/diagnostic.rs:230
stack backtrace:
1: 0x103bf907f - sys::backtrace::write::h652639cd75f0c63cnSs
2: 0x103c01612 - panicking::on_panic::h669c4ea43c1379a9CPw
3: 0x103bb7815 - rt::unwind::begin_unwind_inner::h3fc7f8f4791b4491lxw
4: 0x1033b700e - rt::unwind::begin_unwind::h3264207737224415616
5: 0x1033b77b2 - diagnostic::Handler::bug::h43c0dbadc7c09da91wB
6: 0x100f43f4b - middle::traits::select::SelectionContext<'cx, 'tcx>::rematch_impl::hdaa10e90cc7f94c6fyS
7: 0x100f43ad8 - middle::infer::InferCtxt<'a, 'tcx>::commit_if_ok::h12400076273368149998
8: 0x100f2dc2d - middle::traits::select::SelectionContext<'cx, 'tcx>::confirm_candidate::h287b4d911777ca83hQR
9: 0x100f09198 - middle::traits::select::SelectionContext<'cx, 'tcx>::select::h4326d6c2fd759146URP
10: 0x100f151dd - middle::traits::project::project_type::heec759ea04573f931yO
11: 0x100f13b8b - middle::traits::project::opt_normalize_projection_type::h854a36e9d7fdc4baDrO
12: 0x100f1033b - middle::traits::project::project_and_unify_type::h01572a7c3a6427d9xaO
13: 0x100f0e5df - middle::infer::InferCtxt<'a, 'tcx>::commit_if_ok::h9136385102605535755
14: 0x100f06519 - middle::traits::fulfill::FulfillmentContext<'tcx>::select::h8e12571e1c1d6e2a5JN
15: 0x100f05f38 - middle::traits::fulfill::FulfillmentContext<'tcx>::select_where_possible::ha144bba9596c77dbjJN
16: 0x1009a32a3 - check::vtable::select_fcx_obligations_where_possible::h11116134018e3c7eI0b
17: 0x1009caef1 - check::FnCtxt<'a, 'tcx>::resolve_type_vars_if_possible::h2e09c238ad2631efOUo
18: 0x100a2ba98 - check::op::check_binop::h63d2d3bb28d51501Qan
19: 0x100a6a67e - check::check_expr_with_unifier::h13774552146527501464
20: 0x100a911ab - check::check_decl_local::h05c9fe2a0c0769088bs
21: 0x100a39bfa - check::check_block_with_expected::h638aab069ab365beeis
22: 0x100a1b378 - check::check_fn::h9fa3978846dc7de3N4n
23: 0x100a35379 - check::check_bare_fn::h43ce861f2a41909amUn
24: 0x100a33466 - check::CheckItemBodiesVisitor<'a, 'tcx>.Visitor<'tcx>::visit_item::h9ea50cb814d6f016pRn
25: 0x100afccea - check_crate::closure.38351
26: 0x100af80f7 - check_crate::hb20169de249f4e69pCC
27: 0x1003463c2 - driver::phase_3_run_analysis_passes::h48e7216953f4195erGa
28: 0x10032819c - driver::compile_input::h8c0d6e2f0389eda0Qba
29: 0x1003ef903 - run_compiler::h318b4521e91f682fD4b
30: 0x1003ed42a - boxed::F.FnBox<A>::call_box::h15521220820018991817
31: 0x1003ec8c7 - rt::unwind::try::try_fn::h6267384748210286924
32: 0x103c8b3d8 - rust_try_inner
33: 0x103c8b3c5 - rust_try
34: 0x1003ecba0 - boxed::F.FnBox<A>::call_box::h12285395525992985164
35: 0x103c0017d - sys::thread::create::thread_start::hbbc60a5321f29f07eVv
36: 0x7fff932fe267 - _pthread_body
37: 0x7fff932fe1e4 - _pthread_start
Duplicate of #24325
error: internal compiler error: Impl DefId { krate: 0, node: 12 }:u32.Stringify was matchable against Obligation(predicate=Binder(TraitPredicate(Stringify)),depth=0) but now is not 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 backtraceMeta
rustc 1.0.0-nightly (199bdcfef 2015-03-26) (built 2015-03-26) binary: rustc commit-hash: 199bdcfeff5cfafd1f8e8ff583d7209272469879 commit-date: 2015-03-26 build-date: 2015-03-26 host: x86_64-apple-darwin release: 1.0.0-nightly