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 'found unstable fingerprints for predicates_of(core[3998]::cmp::PartialEq)' #83259

Closed
arifd opened this issue Mar 18, 2021 · 8 comments
Labels
A-incr-comp Area: Incremental compilation C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@arifd
Copy link

arifd commented Mar 18, 2021

Code

#[no_mangle]
pub extern "C" fn double(x: i32) -> i32 {
    x * 2
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn double_test() {
        assert_eq!(double(2), 4);
    }
}

Meta

rustc --version --verbose:

rustc 1.52.0-nightly (107896c32 2021-03-15)
binary: rustc
commit-hash: 107896c32d5dda4db508968ff34997a39d286966
commit-date: 2021-03-15
host: x86_64-unknown-linux-gnu
release: 1.52.0-nightly
LLVM version: 12.0.0

Error output

cargo test
   Compiling patientprovider v0.1.0 (/home/arif/rust/patientprovider)
thread 'rustc' panicked at 'found unstable fingerprints for predicates_of(core[3998]::cmp::PartialEq)', /rustc/107896c32d5dda4db508968ff34997a39d286966/compiler/rustc_query_system/src/query/plumbing.rs:593:5
Backtrace

stack backtrace:
   0: rust_begin_unwind
             at /rustc/107896c32d5dda4db508968ff34997a39d286966/library/std/src/panicking.rs:493:5
   1: std::panicking::begin_panic_fmt
             at /rustc/107896c32d5dda4db508968ff34997a39d286966/library/std/src/panicking.rs:435:5
   2: rustc_query_system::query::plumbing::incremental_verify_ich
   3: rustc_query_system::query::plumbing::load_from_disk_and_cache_in_memory
   4: rustc_query_system::query::plumbing::get_query_impl
   5: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::predicates_of
   6: rustc_middle::ty::generics::GenericPredicates::instantiate_into
   7: rustc_middle::ty::generics::GenericPredicates::instantiate
   8: rustc_typeck::check::method::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::lookup_method_in_trait
   9: rustc_typeck::check::op::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::lookup_op_method
  10: rustc_typeck::check::op::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_overloaded_binop
  11: rustc_typeck::check::op::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_binop
  12: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  13: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  14: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  15: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  16: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  17: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected
  18: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  19: rustc_typeck::check::_match::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_match
  20: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  21: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  22: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected
  23: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  24: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_stmt
  25: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected
  26: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  27: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_return_expr
  28: rustc_typeck::check::check::check_fn
  29: rustc_infer::infer::InferCtxtBuilder::enter
  30: rustc_typeck::check::typeck
  31: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  32: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  33: rustc_query_system::query::plumbing::force_query_with_job
  34: rustc_query_system::query::plumbing::get_query_impl
  35: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck
  36: rustc_middle::ty::<impl rustc_middle::ty::context::TyCtxt>::par_body_owners
  37: rustc_typeck::check::typeck_item_bodies
  38: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  39: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  40: rustc_data_structures::stack::ensure_sufficient_stack
  41: rustc_query_system::query::plumbing::force_query_with_job
  42: rustc_query_system::query::plumbing::get_query_impl
  43: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck_item_bodies
  44: rustc_session::utils::<impl rustc_session::session::Session>::time
  45: rustc_typeck::check_crate
  46: rustc_interface::passes::analysis
  47: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  48: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  49: rustc_data_structures::stack::ensure_sufficient_stack
  50: rustc_query_system::query::plumbing::force_query_with_job
  51: rustc_query_system::query::plumbing::get_query_impl
  52: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
  53: rustc_interface::passes::QueryContext::enter
  54: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  55: rustc_span::with_source_map
  56: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Note, this bug does not exist in stable:

rustc 1.49.0 (e1884a8e3 2020-12-29)
binary: rustc
commit-hash: e1884a8e3c3e813aada8254edfa120e85bf5ffca
commit-date: 2020-12-29
host: x86_64-unknown-linux-gnu
release: 1.49.0

And in any case only occurs under cargo test, not cargo build

@arifd arifd added C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Mar 18, 2021
@jonas-schievink jonas-schievink added the A-incr-comp Area: Incremental compilation label Mar 18, 2021
@Aaron1011
Copy link
Member

This should be fixed by #83220

@Aaron1011
Copy link
Member

@arifd: I'm not able to reproduce this locally. Did you make any modifications to the file between the first and second cargo test runs?

@arifd
Copy link
Author

arifd commented Mar 18, 2021

Wow. okay, I just tried:

  • creating a new --lib with cargo
  • switching rustup to nightly (nightly-x86_64-unknown-linux-gnu unchanged - rustc 1.52.0-nightly (107896c 2021-03-15))
  • copy pasting the code and running cargo test

And it now runs fine! Sorry :(

I obviously didn't make up that bug. And I wish I had that project in the state it was then, perhaps a cargo clean would have sorted it?

But you're right, it's not reproducible from a fresh project. So, how do you wish to proceed? (I'm happy to delete this and pretend it never existed!)

Regarding:

Did you make any modifications to the file between the first and second cargo test runs?

I don't quite understand what you mean, but at the moment I was running cargo test and received that bug, that was the code and the only code in the project.

@Aaron1011
Copy link
Member

I don't quite understand what you mean, but at the moment I was running cargo test and received that bug, that was the code and the only code in the project.

The backtrace you posted shows that cargo test was run with a pre-existing incremental cache (specifically, the load_from_disk_and_cache_in_memory line). Since I can't reproduce this issue, I suspect that crash was caused by a previous run of cargo test with a slightly different file.

@Aaron1011
Copy link
Member

This issue is by far the simplest reproduction of the predicates_of crash that I've seen so far.
@arifd Was this snippet minimized from another project? Would you be able to share some previous steps of the minimization (or the original project) - it might allow me to reproduce this crash.

@arifd
Copy link
Author

arifd commented Mar 18, 2021

Umm okay, so, I don't know what minimized means, but what happened was I that I was interested in porting a module that I had written in Python over to Rust, so I was following this tutorial: https://bheisler.github.io/post/calling-rust-in-python/ I really hadn't got much farther than simply copy/pasting that double function and then writing the test for it. It happened REALLY soon after beginning the fresh project. The name of that project (patientprovider) is just what I might likely call it in the future.

I even tried going back into that project as it is now, with the code from above and hitting cargo test, but it tests fine now, even with nightly.

@XAMPPRocky
Copy link
Member

Umm okay, so, I don't know what minimized means

Minimizing is taking a bug encountered in a large codebase, and converting the bug down into the smallest possible version of it. 🙂


FWIW I also just ran into this when working on a proc-macro for rust-gpu, and tested #83220 with rustup-toolchain-install-master and can confirm it did indeed fix the ICE.

@jyn514
Copy link
Member

jyn514 commented May 19, 2021

Fixed in #83220; closing per #84970 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-incr-comp Area: Incremental compilation C-bug Category: This is a bug. I-ICE Issue: The compiler panicked, giving an Internal Compilation Error (ICE) ❄️ T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

5 participants