Skip to content
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

task 'rustc' panicked at 'assertion failed: (left == right) && (right == left) (left: None, right: Some(()))' #19851

Closed
forgemo opened this issue Dec 14, 2014 · 3 comments
Labels
A-type-system Area: Type system I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@forgemo
Copy link

forgemo commented Dec 14, 2014

when i try to compile my code, i get:

error: the type of this value must be known in this context
/Volumes/secure/rust/ch2/src/main.rs:21         if(c.is_some() && c.unwrap().equiv(v)){
                                                                             ^~~~~~~~
error: internal compiler error: unexpected panic
note: the compiler unexpectedly panicked. this is a bug.
note: we would appreciate a bug report: http://doc.rust-lang.org/complement-bugreport.html
note: run with `RUST_BACKTRACE=1` for a backtrace
task 'rustc' panicked at 'assertion failed: `(left == right) && (right == left)` (left: `None`, right: `Some(())`)', /Users/rustbuild/src/rust-buildbot/slave/nightly-mac/build/src/librustc_typeck/check/method/confirm.rs:153

rustc info

> src: rustc --version=verbose
rustc 0.13.0-nightly (ffc111889 2014-12-12 21:07:19 +0000)
binary: rustc
commit-hash: ffc111889e93bcd38222d9d74a70fdc26a78fcb5
commit-date: 2014-12-12 21:07:19 +0000
host: x86_64-apple-darwin
release: 0.13.0-nightly

my system

Mac OSX 10.10.1 (14B25)
Intel Core 2 Duo    64 bit

the 'bad' code

use std::io;
use std::collections::HashMap;

fn main() {
    let mut input       = io::stdin(); 
    let mut lock        = input.lock(); 
    let mut lines_iter  = lock.lines();

    let mut map         = HashMap::new();

    for line in lines_iter {
        let text = line.ok().unwrap();
        let kv_pair: Vec<&str> = text.words().take(2).collect();

        let k = kv_pair[0].to_string();
        let v = kv_pair[1].to_string();

        let c = map.get(&k);


        if(c.is_some() && c.unwrap().equiv(v)){
            println!("{} {}", k, v);
        }

        map.insert(k, v);
    }

    println!("{}", map.len());
}
@michaelsproul
Copy link
Contributor

I get the same thing on Linux, with the same Rust build as you.

Here's a smaller example and a backtrace:

use std::collections::HashMap;

fn main() {
    let mut map = HashMap::new();
    let key = 7u;
    let item = map.get(&key);
    if (item.is_some() && item.unwrap().eq(8i)) {
        return;
    }
    map.insert(key, 7u);
}
task 'rustc' panicked at 'assertion failed: `(left == right) && (right == left)` (left: `None`, right: `Some(())`)', /home/rustbuild/src/rust-buildbot/slave/nightly-linux/build/src/librustc_typeck/check/method/confirm.rs:153

stack backtrace:
   1:     0x7f5d6bb9d540 - rt::backtrace::imp::write::heed5901f9756dd23BOx
   2:     0x7f5d6bba0780 - failure::on_fail::ha44d264deefff4481fy
   3:     0x7f5d6b7f1a60 - unwind::begin_unwind_inner::hbf982fb3a6122da9CJc
   4:     0x7f5d6b7f1560 - unwind::begin_unwind_fmt::h821ad37001759425ZGc
   5:     0x7f5d6ac4bc50 - check::method::confirm::ConfirmContext<'a, 'tcx>::confirm::hf2e945d9b945d32dwkf
   6:     0x7f5d6ad3a310 - check::check_expr_with_unifier::check_method_call::hee2b27d8726de86drFn
   7:     0x7f5d6ad307a0 - check::check_expr_with_unifier::h422faee1cd496c41EAn
   8:     0x7f5d6ad39260 - check::check_expr_with_unifier::check_binop::h9b948f9bb2e85989qRn
   9:     0x7f5d6ad307a0 - check::check_expr_with_unifier::h422faee1cd496c41EAn
  10:     0x7f5d6ad307a0 - check::check_expr_with_unifier::h422faee1cd496c41EAn
  11:     0x7f5d6ad307a0 - check::check_expr_with_unifier::h422faee1cd496c41EAn
  12:     0x7f5d6ace8810 - check::check_block_with_expected::hf38c5063b6b232d0vtp
  13:     0x7f5d6acb9c20 - check::check_fn::h0ffd34e82269a488jhk
  14:     0x7f5d6ace59f0 - check::check_bare_fn::h80d05a38b73232b5K6j
  15:     0x7f5d6acdda80 - check::check_item::hbaff9fee6f6cec45aqk
  16:     0x7f5d6b095930 - check_crate::closure.43673
  17:     0x7f5d6b092200 - util::common::time::h16516841138721642264
  18:     0x7f5d6b0914d0 - check_crate::h601dd3cedc4d9d9bDUy
  19:     0x7f5d6bfd03f0 - driver::phase_3_run_analysis_passes::h89150347d25ccb80Cta
  20:     0x7f5d6bfbf0b0 - driver::compile_input::hdc87225d47b03d10pba
  21:     0x7f5d6c05de20 - run_compiler::hac4563508ec17f56EYb
  22:     0x7f5d6c05dd10 - run::closure.21548
  23:     0x7f5d6c06f750 - task::TaskBuilder::try_future::closure.23002
  24:     0x7f5d6bb759c0 - task::TaskBuilder::spawn_internal::closure.30612
  25:     0x7f5d6b7ef700 - task::Task::spawn::closure.5729
  26:     0x7f5d6b84cf50 - rust_try_inner
  27:     0x7f5d6b84cf40 - rust_try
  28:     0x7f5d6b7ef7e0 - unwind::try::hd503f9309b2b1ec2Tyc
  29:     0x7f5d6b7ef5a0 - task::Task::run::h7ea5fe2114c20f68fKb
  30:     0x7f5d6b7ef190 - task::Task::spawn::closure.5705
  31:     0x7f5d6b7f0be0 - thread::thread_start::h5e2446fe7cf0a4f1w1b
  32:     0x7f5d66653250 - start_thread
  33:     0x7f5d6b4c5589 - clone
  34:                0x0 - <unknown>

@barosl
Copy link
Contributor

barosl commented Dec 15, 2014

This should be fixed by #19813, I think.

(Wow, there are more and more issues related to that bug!)

@kmcallister kmcallister added I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ A-type-system Area: Type system labels Jan 16, 2015
@kmcallister
Copy link
Contributor

#19813 was merged, and I no longer get the ICE on rustc 1.0.0-dev (896cb36 2015-01-14 12:19:58 +0000).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-type-system Area: Type system I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️
Projects
None yet
Development

No branches or pull requests

4 participants