Skip to content

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

Closed
@sparrisable

Description

@sparrisable

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions