rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
98.5k stars 12.74k forks source link

Internal Compiler Error #85134

Closed ezhang7423 closed 3 years ago

ezhang7423 commented 3 years ago

Code

use std::cmp::Ordering;
use std::io;

fn main() {
    println!("Guess my number!");

    let my_num = rand::random::<u8>();

    let mut tries = 0;
    loop {
        let guess = get_guess();
        match guess.cmp(&my_num) {
            Ordering::Less => println!("Guess bigger"),
            Ordering::Equal => {
                println!("You got it! It took you {} tries", tries);
                break;
            }
            Ordering::Greater => println!("Guess smaller"),
        }
        tries += 1;
    }
}

fn get_guess() -> u8 {
    let mut guess = String::new();
    io::stdin()
        .read_line(&mut guess)
        .expect("Failed to read input");

    println!("You entered {}", guess);

    return guess.trim().parse().expect("Please type a number!");
}

Meta

rustc --version --verbose:

rustc 1.52.0 (88f19c6da 2021-05-03)
binary: rustc
commit-hash: 88f19c6dab716c6281af7602e30f413e809c5974
commit-date: 2021-05-03
host: x86_64-pc-windows-msvc
release: 1.52.0
LLVM version: 12.0.0

Error output

PS C:\Users\Eddie\git\rusthello> cargo run --verbose 
       Fresh cfg-if v1.0.0
       Fresh ppv-lite86 v0.2.10
       Fresh getrandom v0.2.2
       Fresh rand_core v0.6.2
       Fresh rand_chacha v0.3.0
       Fresh rand v0.8.3
   Compiling rusthello v0.1.0 (C:\Users\Eddie\git\rusthello)
     Running `rustc --crate-name rusthello --edition=2018 main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C metadata=130a3278fcf10837 --out-dir C:\Users\Eddie\git\rusthello\target\debug\deps -C incremental=C:\Users\Eddie\git\rusthello\target\debug\incremental -L dependency=C:\Users\Eddie\git\rusthello\target\debug\deps --extern rand=C:\Users\Eddie\git\rusthello\target\debug\deps\librand-cf02a276127e463a.rlib`
thread 'rustc' panicked at 'found unstable fingerprints for predicates_of(core[bd3a]::fmt::Debug): GenericPredicates { parent: None, predicates: [(Binder(TraitPredicate(<Self as std::fmt::Debug>)), C:\Users\Eddie\.rustup\toolchains\stable-x0:16 (#0))] }', /rustc/88f19c6dab716c6281af7602e30f413e809c5974\compiler\rustc_query_system\src\query\plumbing.rs:593:5
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

error: internal compiler error: unexpected panic

note: the compiler unexpectedly panicked. this is a bug.

note: we would appreciate a bug report: https://github.com/rust-lang/rust/issues/new?labels=C-bug%2C+I-ICE%2C+T-compiler&template=ice.md

note: rustc 1.52.0 (88f19c6da 2021-05-03) running on x86_64-pc-windows-msvc     

note: compiler flags: -C embed-bitcode=no -C debuginfo=2 -C incremental --crate-type bin

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [predicates_of] computing predicates of `std::fmt::Debug`
#1 [vtable_methods] finding all methods for trait std::fmt::Debug
#2 [collect_and_partition_mono_items] collect_and_partition_mono_items
end of query stack
error: could not compile `rusthello`

Caused by:
  process didn't exit successfully: `rustc --crate-name rusthello --edition=2018 main.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type bin --emit=dep-info,link -C embed-bitcode=no -C debuginfo=2 -C metadata=130a3278fcf10837 --out-dir C:\Users\Eddie\git\rusthello\target\debug\deps -C incremental=C:\Users\Eddie\git\rusthello\target\debug\incremental -L dependency=C:\Users\Eddie\git\rusthello\target\debug\deps --extern rand=C:\Users\Eddie\git\rusthello\target\debug\deps\librand-cf02a276127e463a.rlib` (exit code: 101)
Backtrace

``` query stack during panic: #0 [predicates_of] computing predicates of `std::fmt::Debug` #1 [vtable_methods] finding all methods for trait std::fmt::Debug #2 [collect_and_partition_mono_items] collect_and_partition_mono_items end of query stack ```

wesleywiser commented 3 years ago

Thanks for the bug report! It looks like this is the same issue as #83259 so I'm going to close in favor of that issue.