Skip to content

Internal compiler error for summation of different numerical types. #25373

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
sparrisable opened this issue May 13, 2015 · 3 comments
Closed

Comments

@sparrisable
Copy link

Got an internal compiler error for a small simple program.

I tried this code:

fn minutes_to_hours(minutes:isize) -> (f32) {
let mut hours = minutes/60;
let mut decimal_hours = 0.0;
hours = hours +1;
hours + decimal_hours
}

fn main() {}

I expected to see this happen:
To get a compiler error message or a resulting compiled binary from the compiler.

Instead, this happened:

rustc internal_compiler_error.rs
error: internal compiler error: Impl DefId { krate: 2, node: 21469 } 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', C:/bot/slave/beta-dist-rustc-win-64/build/src/libsyntax\diagnostic.rs:209

rustc --version --verbose
rustc 1.0.0-beta.5 (7b4ef47 2015-05-11) (built 2015-05-11)
binary: rustc
commit-hash: 7b4ef47
commit-date: 2015-05-11
build-date: 2015-05-11
host: x86_64-pc-windows-gnu
release: 1.0.0-beta.5

Backtrace:
This was on a windows pc and I did not manage to get a backtrace.

@econoplas
Copy link
Contributor

Contributing a backtrace using the OP's code in case it proves useful:

Meta

rustc --version --verbose:
rustc 1.0.0-dev (built 2015-05-13)
binary: rustc
commit-hash: unknown
commit-date: unknown
build-date: 2015-05-13
host: x86_64-unknown-linux-gnu
release: 1.0.0-dev

Backtrace:
thread 'rustc' panicked at 'Box', /tmp/build/rustc-1.0.0-beta.5/src/libsyntax/diagnostic.rs:209

stack backtrace:
1: 0x7fdcb8c10109 - sys::backtrace::write::he573c8167e01081cd4r
2: 0x7fdcb8c17e16 - panicking::on_panic::had2e9609e9ec19cdjrw
3: 0x7fdcb8bdb122 - rt::unwind::begin_unwind_inner::h2b37885f8310bdebt6v
4: 0x7fdcb61a9a9d - rt::unwind::begin_unwind::h9513671965667180055
5: 0x7fdcb61aa15b - diagnostic::Handler::bug::h17f6338c5abd9ad8gwB
6: 0x7fdcb6d41e19 - middle::traits::select::SelectionContext<'cx, 'tcx>::rematch_impl::h0fe197b1312ddfc5QXT
7: 0x7fdcb6d418a8 - middle::infer::InferCtxt<'a, 'tcx>::commit_if_ok::h12728828371683694127
8: 0x7fdcb6d2bee1 - middle::traits::select::SelectionContext<'cx, 'tcx>::confirm_candidate::h1a91ee65f37b548cSfT
9: 0x7fdcb6d0b224 - middle::traits::select::SelectionContext<'cx, 'tcx>::select::h3318be58b29b06ecvhR
10: 0x7fdcb6d16085 - middle::traits::project::project_type::h2299b95043dc8d51CYP
11: 0x7fdcb6d14c68 - middle::traits::project::opt_normalize_projection_type::h0aba98dabe25d81feRP
12: 0x7fdcb6d11980 - middle::traits::project::project_and_unify_type::h71f271abe450dd5b8zP
13: 0x7fdcb6d0fd8c - middle::infer::InferCtxt<'a, 'tcx>::commit_if_ok::h14704270297610222976
14: 0x7fdcb6d083ad - middle::traits::fulfill::FulfillmentContext<'tcx>::select::h4ea72577c16ace0bG9O
15: 0x7fdcb6d07ddb - middle::traits::fulfill::FulfillmentContext<'tcx>::select_where_possible::hcaa2f53ce1ed4358U8O
16: 0x7fdcb79d88e8 - check::vtable::select_fcx_obligations_where_possible::h4a3bbd0f0b1109dar5b
17: 0x7fdcb79f695a - check::FnCtxt<'a, 'tcx>::resolve_type_vars_if_possible::h1d2300a64a85ceaaVwo
18: 0x7fdcb7a57ede - check::op::check_binop::hc37315610f504162XMm
19: 0x7fdcb7a955ed - check::check_expr_with_unifier::h1788505187362938359
20: 0x7fdcb7a65bcc - check::check_block_with_expected::h9b5df56861210b9dnUr
21: 0x7fdcb7a483b6 - check::check_fn::ha41cad12b3ab8b73UGn
22: 0x7fdcb7a61284 - check::check_bare_fn::hf00f4144cb54e3b8twn
23: 0x7fdcb7a5f3e2 - check::CheckItemBodiesVisitor<'a, 'tcx>.Visitor<'tcx>::visit_item::h97632d2c1e4ecd72wtn
24: 0x7fdcb7b2338a - check_crate::closure.38021
25: 0x7fdcb7b1e720 - check_crate::h4a34989eac58b4d7XcC
26: 0x7fdcb9153a38 - driver::phase_3_run_analysis_passes::he8a5e6db549c1a9fnGa
27: 0x7fdcb9134b35 - driver::compile_input::h0028b8480dd1e160Qba
28: 0x7fdcb91f6041 - run_compiler::h3ecadef83df8b674z4b
29: 0x7fdcb91f3c92 - boxed::F.FnBox::call_box::h796248444002942158
30: 0x7fdcb91f31c9 - rt::unwind::try::try_fn::h1722916880066884737
31: 0x7fdcb8c8ac08 - rust_try_inner
32: 0x7fdcb8c8abf5 - rust_try
33: 0x7fdcb91f3478 - boxed::F.FnBox::call_box::h17871347209311949743
34: 0x7fdcb8c16d01 - sys::thread::create::thread_start::h775b7ea1b9caf098aqv
35: 0x7fdcb371edf4 - start_thread
36: 0x7fdcb88601ac - __clone
37: 0x0 -

@arielb1
Copy link
Contributor

arielb1 commented May 13, 2015

Fixed by #25344.

@alexcrichton
Copy link
Member

Thanks @arielb1!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants