profile
viewpoint

Ask questionserror: internal compiler error: encountered incremental compilation error with predicates_of(bitpacking[28cc]::BitPacker)

<!-- Thank you for finding an Internal Compiler Error! 🧊 If possible, try to provide a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for how to create smaller examples.

http://blog.pnkfx.org/blog/2019/11/18/rust-bug-minimization-patterns/

-->

Code

Ran the fn num_bits_pkg() from VSCode "Run test"


#[cfg(test)]
mod test {
  extern crate bitpacking;
  use bitpacking::{BitPacker, BitPacker8x};
  use core_simd::*;

  #[test]
  fn delta() {
    let a = u32x4::splat(10);
    let b = u32x4::from_array([1, 2, 3, 4]);
    println!("{:?}", a + b);
  }

  #[test]
  fn hello_simd_u32() {
    let a = u32x4::splat(10);
    let b = u32x4::from_array([1, 2, 3, 4]);
    println!("{:?}", a + b);
  }

  #[test]
  fn hello_simd() {
    let a = f32x4::splat(10.0);
    let b = f32x4::from_array([1.0, 2.0, 3.0, 4.0]);
    println!("{:?}", a + b);
  }

  #[test]
  fn num_bits_pkg() {
    let src = blk();
    let bitpacker = BitPacker8x::new();
    let initial_value = 0u32;
    let num_bits_sorted: u8 = bitpacker.num_bits_sorted(src[0], &src);
    println!("num_bits_sorted {}", num_bits_sorted);
  }

  fn blk() -> Vec<u32> {
    // first 256 goog timestamps
    // sorted ascending u32
    return vec![
      509, 610, 711, 1096, 1147, 2019, 2069, 2124, 2445, 2495, 2635, 2686, 2789, 3570, 3621, 4616,
      4668, 5120, 5171, 5221, 5531, 6025, 9047, 9265, 9496, 9547, 9905, 10203, 11091, 11379, 12156,
      12257, 12372, 12487, 12596, 12646, 12697, 13094, 13580, 13630, 13781, 14458, 14508, 14713,
      14763, 14831, 15270, 15381, 15527, 15683, 15784, 15934, 17160, 17211, 17261, 17392, 17584,
      17690, 17791, 17900, 18094, 18685, 20052, 20324, 20375, 25580, 26979, 27286, 28619, 28669,
      30662, 31585, 31635, 32337, 33434, 34933, 35051, 35176, 35277, 35423, 35577, 35728, 35871,
      36055, 36105, 36960, 37074, 37200, 37347, 37475, 37593, 37724, 37873, 37923, 37974, 38024,
      38075, 38211, 39060, 43483, 43533, 45739, 47901, 48028, 48226, 48361, 50448, 50651, 50786,
      50936, 51054, 51238, 51486, 51656, 51839, 51941, 51991, 52042, 52144, 52247, 52349, 52453,
      53551, 53601, 55059, 55110, 55196, 55720, 57773, 58271, 58383, 58487, 58588, 58727, 58777,
      59093, 59143, 60587, 60834, 61239, 61971, 63395, 63445, 63546, 63687, 65027, 65491, 66139,
      66610, 71431, 71541, 71654, 71758, 71859, 71963, 72013, 72063, 72164, 72536, 72657, 72847,
      72948, 73422, 73954, 74124, 74225, 74325, 74535, 74635, 74723, 74830, 74880, 74930, 74981,
      75031, 75178, 75329, 75458, 75559, 75641, 75821, 76116, 76166, 76927, 77133, 77184, 77700,
      77838, 77944, 78095, 78205, 78306, 78488, 78589, 78700, 78801, 78913, 79044, 79094, 79206,
      79307, 79408, 79522, 79658, 79794, 79944, 80047, 80201, 80302, 80410, 80511, 80703, 80804,
      80937, 81850, 81900, 82120, 82221, 82736, 82787, 82837, 82887, 82950, 83051, 83153, 83203,
      83263, 85183, 85284, 85412, 85584, 85634, 85700, 86615, 86720, 86866, 86966, 87017, 87214,
      87334, 87511, 87615, 88706, 88807, 89535, 89585, 89703, 90132, 90538, 90639, 90747, 90942,
      91093, 91194, 91338, 91448,
    ];
  }
}


Meta

<!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. -->

rustc --version --verbose:

rana@aum:~/prj/tsr$ rustc --version --verbose
rustc 1.55.0-nightly (539d7bd39 2021-06-14)
binary: rustc
commit-hash: 539d7bd3998d9bfed14c264eacda30097a4ea768
commit-date: 2021-06-14
host: x86_64-unknown-linux-gnu
release: 1.55.0-nightly
LLVM version: 12.0.1

Error output

> Executing task: cargo test -- --nocapture num_bits_pkg <

   Compiling tsr v0.1.0 (/home/rana/prj/tsr)
error: internal compiler error: encountered incremental compilation error with predicates_of(bitpacking[28cc]::BitPacker)
  |
  = help: This is a known issue with the compiler. Run `cargo clean -p tsr` or `cargo clean` to allow your project to compile
  = note: Please follow the instructions below to create a bug report with the provided information
  = note: See <https://github.com/rust-lang/rust/issues/84970> for more information



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.55.0-nightly (539d7bd39 2021-06-14) running on x86_64-unknown-linux-gnu

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

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

query stack during panic:
#0 [predicates_of] computing predicates of `pck::test::bitpacking::BitPacker`
#1 [typeck] type-checking `pck::test::num_bits_pkg`
#2 [typeck_item_bodies] type-checking all item bodies
#3 [analysis] running analysis passes on this crate
end of query stack
error: aborting due to previous error

error: could not compile `tsr`

To learn more, run the command again with --verbose.
The terminal process "bash '-c', 'cargo test -- --nocapture num_bits_pkg'" terminated with exit code: 101.

Terminal will be reused by tasks, press any key to close it.

<!-- Include a backtrace in the code block by setting RUST_BACKTRACE=1 in your environment. E.g. RUST_BACKTRACE=1 cargo build. --> <details><summary><strong>Backtrace</strong></summary> <p>

thread 'rustc' panicked at 'Found unstable fingerprints for predicates_of(bitpacking[28cc]::BitPacker): GenericPredicates { parent: None, predicates: [(Binder(TraitPredicate(<Self as std::marker::Sized>), []), /home/rana/.cargo/registry/src/github.com-1ecc6299db9ec823/bitpacking-0.8.4/src/lib.rs:162:22: 162:27 (#0)), (Binder(TraitPredicate(<Self as std::clone::Clone>), []), /home/rana/.cargo/registry/src/github.com-1ecc6299db9ec823/bitpacking-0.8.4/src/lib.rs:162:30: 162:35 (#0)), (Binder(TraitPredicate(<Self as std::marker::Copy>), []), /home/rana/.cargo/registry/src/github.com-1ecc6299db9ec823/bitpacking-0.8.4/src/lib.rs:162:38: 162:42 (#0)), (Binder(TraitPredicate(<Self as pck::test::bitpacking::BitPacker>), []), /home/rana/.cargo/registry/src/github.com-1ecc6299db9ec823/bitpacking-0.8.4/src/lib.rs:162:1: 263:2 (#0))] }', /rustc/539d7bd3998d9bfed14c264eacda30097a4ea768/compiler/rustc_query_system/src/query/plumbing.rs:620:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/539d7bd3998d9bfed14c264eacda30097a4ea768/library/std/src/panicking.rs:515:5
   1: std::panicking::begin_panic_fmt
             at /rustc/539d7bd3998d9bfed14c264eacda30097a4ea768/library/std/src/panicking.rs:457: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_data_structures::stack::ensure_sufficient_stack
   5: rustc_query_system::query::plumbing::get_query_impl
   6: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::predicates_of
   7: rustc_middle::ty::generics::GenericPredicates::instantiate_into
   8: rustc_middle::ty::generics::GenericPredicates::instantiate
   9: rustc_typeck::check::fn_ctxt::_impl::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::instantiate_bounds
  10: rustc_typeck::check::fn_ctxt::_impl::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::add_required_obligations
  11: rustc_typeck::check::fn_ctxt::_impl::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::instantiate_value_path
  12: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  13: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  14: rustc_typeck::check::callee::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_call
  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_decl_initializer
  18: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_decl_local
  19: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_stmt
  20: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected
  21: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  22: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_return_expr
  23: rustc_typeck::check::check::check_fn
  24: rustc_typeck::check::inherited::InheritedBuilder::enter
  25: rustc_typeck::check::typeck
  26: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  27: rustc_data_structures::stack::ensure_sufficient_stack
  28: rustc_query_system::query::plumbing::force_query_with_job
  29: rustc_query_system::query::plumbing::get_query_impl
  30: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck
  31: rustc_middle::ty::<impl rustc_middle::ty::context::TyCtxt>::par_body_owners
  32: rustc_typeck::check::typeck_item_bodies
  33: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  34: rustc_data_structures::stack::ensure_sufficient_stack
  35: rustc_query_system::query::plumbing::force_query_with_job
  36: rustc_query_system::query::plumbing::get_query_impl
  37: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck_item_bodies
  38: rustc_session::utils::<impl rustc_session::session::Session>::time
  39: rustc_typeck::check_crate
  40: rustc_interface::passes::analysis
  41: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  42: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  43: rustc_query_system::dep_graph::graph::DepGraph<K>::with_eval_always_task
  44: rustc_data_structures::stack::ensure_sufficient_stack
  45: rustc_query_system::query::plumbing::force_query_with_job
  46: rustc_query_system::query::plumbing::get_query_impl
  47: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
  48: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  49: rustc_span::with_source_map
  50: rustc_interface::interface::create_compiler_and_run
  51: scoped_tls::ScopedKey<T>::set
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

</p> </details>

rust-lang/rust

Answer questions Aaron1011

The last predicate listed in the error message is interesting: Binder(TraitPredicate(<Self as pck::test::bitpacking::BitPacker>), []), /home/rana/.cargo/registry/src/github.com-1ecc6299db9ec823/bitpacking-0.8.4/src/lib.rs:162:1: 263:2 (#0))

It appears to be generated here:

https://github.com/rust-lang/rust/blob/f639657fe4a16ec7704e0af77d0e5d5f587b59df/compiler/rustc_typeck/src/collect.rs#L1919-L1924

The fact that we call guess_head_span means that the span should be a single line (containing pub trait BitPacker: Sized + Clone + Copy). However, the span is for the entire definition of the BitPacker trait, indicating that guess_head_span failed.

The file in question is part of a dependency, so it shouldn't have changed between compilation sessions (if the version number changed, then we would be dealing with a different file, since the version number is included in the directory name bitpacking-0.8.4). I suspect that there's a bug in some of the filesystem-loading code involved in guess_head_span - I'll investigate further.

useful!
source:https://uonfu.com/
Github User Rank List