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

thread 'rustc' panicked at 'Box<Any>', C:/bot/slave/beta-dist-rustc-win-64/build/src/libsyntax\diagnostic.rs:190 #24199

Closed
frast opened this issue Apr 8, 2015 · 4 comments
Labels
I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️

Comments

@frast
Copy link

frast commented Apr 8, 2015

rustc 1.0.0-beta (9854143cb 2015-04-02) (built 2015-04-02)
binary: rustc
commit-hash: 9854143cba679834bc4ef932858cd5303f015a0e
commit-date: 2015-04-02
build-date: 2015-04-02
host: x86_64-pc-windows-gnu
release: 1.0.0-beta

>cargo test
   Compiling maumau v0.0.1 (file:///D:/Frank/wsrust/maumau)
error: internal compiler error: translating unsupported cast: collections::vec::Vec<Card> (cast_other) -> collections::vec::Vec<Card> (cast_other)
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>', C:/bot/slave/beta-dist-rustc-win-64/build/src/libsyntax\diagnostic.rs:190

stack backtrace:
   1:         0x7120a633 - sys::backtrace::write::h25aa4e11fcc2028f1WC
   2:         0x7121fba1 - rt::unwind::register::h9ce64145fe2dc510hwI
   3:         0x71183620 - rt::unwind::begin_unwind_inner::hf236e20eb0b16c32rtI
   4:           0x754cd9 - diagnostic::SpanHandler::span_bug::h88a5d2017e48721bInB
   5:           0x755315 - diagnostic::Handler::bug::h82c8da3961402202otB
   6:           0xee6a59 - session::Session::bug::hb5ab23038284b253BXq
   7:         0x6366fe85 - trans::common::erase_regions::RegionEraser<'a, 'tcx>.TypeFolder<'tcx>::fold_substs::hbbda23566821fce0twk
   8:         0x63658642 - trans::expr::Dest...std..clone..Clone::clone::h11cda8eb15b4885aNdh
   9:         0x63610295 - trans::cleanup::FunctionContext<'blk, 'tcx>.CleanupMethods<'blk, 'tcx>::pop_and_trans_ast_cleanup_scope::hba39b06ec7f781a4ekK
  10:         0x636111c8 - trans::cleanup::FunctionContext<'blk, 'tcx>.CleanupMethods<'blk, 'tcx>::pop_and_trans_ast_cleanup_scope::hba39b06ec7f781a4ekK
  11:         0x636df257 - trans::base::FindNestedReturn.Visitor<'v>::visit_expr::h39e34e4386a53ebct5s
  12:         0x635fadcb - trans::context::CrateContext<'b, 'tcx>::sess::h1d81b1d9bc057ec9B9l
  13:         0x635f5be4 - trans::context::CrateContext<'b, 'tcx>::stats::h16ae95abc845dd19kkm
  14:         0x636e749c - trans::base::trans_crate::h78838eb055cd54ebuZu
  15:         0x652eccf5 - driver::phase_4_translate_to_llvm::hb6104f3c215dde0caOa
  16:         0x652c2e5a - driver::compile_input::hd172863ffe4dd5a9Qba
  17:         0x65376df3 - run_compiler::ha8dc88b187adc4adV4b
  18:         0x65374bff - run::h4d0e6e374a64009fB4b
  19:         0x65373fda - run::h4d0e6e374a64009fB4b
  20:         0x712591fc - rust_try
  21:         0x712591d9 - rust_try
  22:         0x653742c1 - run::h4d0e6e374a64009fB4b
  23:         0x71213914 - sys::tcp::TcpListener::bind::haf20c04cf24cedd8oVG
  24:     0x7ff8849e13d2 - BaseThreadInitThunk

Could not compile `maumau`.

program:

extern crate rand;
use rand::Rng;

#[allow(dead_code)]
fn main() {
    println!("Hello World!");
}

#[derive(PartialEq, Eq, Clone, Copy)]
pub enum Rank {
    R7,
    R8,
    R9,
    R10,
    B,
    Q,
    K,
    A,
}

#[derive(PartialEq, Eq, Clone, Copy)]
pub enum Suit {
    Clubs,
    Diamonds,
    Hearts,
    Spades,
}

#[derive(PartialEq, Eq, Clone, Copy)]
struct Card(i8);

impl Card {
    pub fn rank(&self) -> Rank {
        Rank::R7
    }

    pub fn suit(&self) -> Suit {
        Suit::Clubs
    }
}

pub type Cards = Vec<Card>;

pub fn shuffled_deck() -> Cards {
    let mut rng = rand::thread_rng();
    let mut cds = Vec::with_capacity(10);
    for _ in 0..10 {
        cds.push(Card((rng.gen::<u8>() % 32) as i8));
    }
    cds as Cards
}

#[cfg(test)]
mod test {
    use super::*;

    #[test]
    fn card_test() {
        let c = shuffled_deck()[0];
        assert!(c.rank() == Rank::R7);
        assert!(c.suit() == Suit::Clubs);
    }
}
@steveklabnik steveklabnik added the I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ label Apr 9, 2015
@bytwise
Copy link
Contributor

bytwise commented Apr 20, 2015

Reduced testcase:

type Cards = Vec<u8>;

fn main() {
    let v: Vec<u8> = Vec::new();
    v as Cards;
}

@pmarcelll
Copy link
Contributor

I can't reproduce it with rustc 1.2.0-nightly (20d23d8e5 2015-06-18).

@alexcrichton
Copy link
Member

Agreed, thanks @pmarcelll for the triage!

@pmarcelll
Copy link
Contributor

👍

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

No branches or pull requests

5 participants