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

Unstable fingerprints at 'predicates_of(...)' error #84870

Closed
Azgrom opened this issue May 3, 2021 · 2 comments
Closed

Unstable fingerprints at 'predicates_of(...)' error #84870

Azgrom opened this issue May 3, 2021 · 2 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

@Azgrom
Copy link

Azgrom commented May 3, 2021

Hi there! I was practicing this CodeWars kata and stumbled with the following compiler error:

Code

As I was in the middle of the solution, this code's logic does not what it is intended to.

fn counting_duplicates(text: &str) -> u32 {
    let mut occurrence = String::new();
    let mut count: u32 = 0;

    for letter in text.chars() {
        if text.contains(letter) || occurrence.contains(letter) {
            occurrence.push(letter);
        } else {
            count += 1;
        }
    }
    count
}

fn main() {
    // let mut test = String::from("Hello, world!");
    // println!("{}", &test.rev().next());
}

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

    #[test]
    fn test_abcde() {
        assert_eq!(counting_duplicates("abcde"), 0);
    }

    #[test]
    fn test_abcdea() {
        assert_eq!(counting_duplicates("abcdea"), 1);
    }

    #[test]
    fn test_indivisibility() {
        assert_eq!(counting_duplicates("indivisibility"), 1);
    }
}

Meta

rustc --version --verbose:

rustc 1.53.0-nightly (07e0e2ec2 2021-03-24)
binary: rustc
commit-hash: 07e0e2ec268c140e607e1ac7f49f145612d0f597
commit-date: 2021-03-24
host: x86_64-unknown-linux-gnu
release: 1.53.0-nightly
LLVM version: 12.0.0

Don't know if it is relevant, but I have updated rustup. But the problem is the same. Here is the update log:

$ rustup self update
info: checking for self-updates
info: downloading self-update
  rustup updated - 1.24.1 (from 1.23.1)

Error output

$ cargo test
   Compiling counting_duplicates v0.1.0 (/home/rafael/Documents/Repos/CodeArchive/CodeWars/counting_duplicates)
thread 'rustc' panicked at 'found unstable fingerprints for predicates_of(core[3998]::iter::traits::collect::IntoIterator): GenericPredicates { parent: None, predicates: [(Binder(TraitPredicate(<Self as std::iter::IntoIterator>)), /home/rafael/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/collect.rs:202:1: 202:23 (#0))] }', /rustc/07e0e2ec268c140e607e1ac7f49f145612d0f597/compiler/rustc_query_system/src/query/plumbing.rs:593:5
note: run with `RUST_BACKTRACE=1` environment variable to display a 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.53.0-nightly (07e0e2ec2 2021-03-24) 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 `std::iter::IntoIterator`
#1 [typeck] type-checking `counting_duplicates`
end of query stack
error: could not compile `counting_duplicates`

To learn more, run the command again with --verbose.
Backtrace

$ RUST_BACKTRACE=1 cargo test
   Compiling counting_duplicates v0.1.0 (/home/rafael/Documents/Repos/CodeArchive/CodeWars/counting_duplicates)
thread 'rustc' panicked at 'found unstable fingerprints for predicates_of(core[3998]::iter::traits::collect::IntoIterator): GenericPredicates { parent: None, predicates: [(Binder(TraitPredicate(<Self as std::iter::IntoIterator>)), /home/rafael/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/iter/traits/collect.rs:202:1: 202:23 (#0))] }', /rustc/07e0e2ec268c140e607e1ac7f49f145612d0f597/compiler/rustc_query_system/src/query/plumbing.rs:593:5
stack backtrace:
   0: rust_begin_unwind
             at /rustc/07e0e2ec268c140e607e1ac7f49f145612d0f597/library/std/src/panicking.rs:493:5
   1: std::panicking::begin_panic_fmt
             at /rustc/07e0e2ec268c140e607e1ac7f49f145612d0f597/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::fn_ctxt::_impl::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::instantiate_bounds
   9: rustc_typeck::check::fn_ctxt::_impl::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::add_required_obligations
  10: rustc_typeck::check::fn_ctxt::_impl::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::resolve_lang_item_path
  11: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  12: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  13: rustc_typeck::check::callee::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_call
  14: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  15: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  16: rustc_typeck::check::_match::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::demand_scrutinee_type
  17: rustc_typeck::check::_match::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_match
  18: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  19: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  20: rustc_typeck::check::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation
  21: rustc_typeck::check::fn_ctxt::checks::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_stmt
  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::expr::<impl rustc_typeck::check::fn_ctxt::FnCtxt>::check_return_expr
  25: rustc_typeck::check::check::check_fn
  26: rustc_infer::infer::InferCtxtBuilder::enter
  27: rustc_typeck::check::typeck
  28: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  29: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  30: rustc_query_system::query::plumbing::force_query_with_job
  31: rustc_query_system::query::plumbing::get_query_impl
  32: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck
  33: rustc_middle::ty::<impl rustc_middle::ty::context::TyCtxt>::par_body_owners
  34: rustc_typeck::check::typeck_item_bodies
  35: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  36: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  37: rustc_data_structures::stack::ensure_sufficient_stack
  38: rustc_query_system::query::plumbing::force_query_with_job
  39: rustc_query_system::query::plumbing::get_query_impl
  40: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::typeck_item_bodies
  41: rustc_session::utils::<impl rustc_session::session::Session>::time
  42: rustc_typeck::check_crate
  43: rustc_interface::passes::analysis
  44: rustc_middle::dep_graph::<impl rustc_query_system::dep_graph::DepKind for rustc_middle::dep_graph::dep_node::DepKind>::with_deps
  45: rustc_query_system::dep_graph::graph::DepGraph<K>::with_task_impl
  46: rustc_data_structures::stack::ensure_sufficient_stack
  47: rustc_query_system::query::plumbing::force_query_with_job
  48: rustc_query_system::query::plumbing::get_query_impl
  49: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::analysis
  50: rustc_interface::passes::QueryContext::enter
  51: rustc_interface::queries::<impl rustc_interface::interface::Compiler>::enter
  52: rustc_span::with_source_map
  53: rustc_interface::interface::create_compiler_and_run
  54: scoped_tls::ScopedKey<T>::set
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.53.0-nightly (07e0e2ec2 2021-03-24) 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 `std::iter::IntoIterator`
#1 [typeck] type-checking `counting_duplicates`
#2 [typeck_item_bodies] type-checking all item bodies
#3 [analysis] running analysis passes on this crate
end of query stack
error: could not compile `counting_duplicates`

To learn more, run the command again with --verbose.

@Azgrom Azgrom 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 May 3, 2021
@jyn514 jyn514 added the A-incr-comp Area: Incremental compilation label May 3, 2021
@lopopolo
Copy link
Contributor

lopopolo commented May 7, 2021

I got a similar error in Clippy on the new 1.52.0 stable: rust-lang/rust-clippy#7186.

@wesleywiser
Copy link
Member

Thanks for filing the bug report! We are currently triaging issues related to #84970 to ensure each underlying problem gets resolved. Since this appears to be a duplicate of #83259, I'm going to close in favor of that issue.

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

4 participants