Repository: rust
Issue: ICE on 1.63 stable
Labels: I-ICE,T-compiler,A-incr-comp,C-bug

<!--
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

The code I'm working at the moment is closed source, so I can't share the repo but the function being pointed as the one failing the fingerprint check is an implementation of function defined in trait that I owned over a type I don't (from a 3rd party dependency). The problematic function as pointed out by the stacktrace bellow is `parse_object_id` in file `lib.rs` line 707.

```Rust
trait FieldExt {
    fn parse_object_id(&self) -> OperationResult<Uuid>;
    fn into_create_mutation(
        self,
        mutation_resolver: Rc<ObjectResolver>,
    ) -> OperationResult<Mutation>;
}

impl FieldExt for Field<'static, String> {
    fn parse_object_id(&self) -> OperationResult<Uuid> {
        for (arg_name, arg_type) in &self.arguments {
            if !arg_name.eq("id") {
                continue;
            }
            if let Value::String(id) = arg_type {
                return Uuid::parse_str(id).map_err(|_| {
                    OperationError::Translation(TranslationError::QueryTranslation(
                        QueryTranslationError::InvalidIDValue(self.name.to_owned(), id.to_owned()),
                    ))
                });
            }
        }

        // We haven't found an argument id: UUID!
        Err(OperationError::Translation(
            TranslationError::QueryTranslation(QueryTranslationError::MissingIDArgument(
                self.name.to_owned(),
            )),
        ))
    }

    fn into_create_mutation(
        self,
        mutation_resolver: Rc<ObjectResolver>,
    ) -> OperationResult<Mutation> {
        let input = into_input_object(self.arguments, &self.name, mutation_resolver.type_name())?;
        let mutation = CreateObjectMutation {
            selector: Rc::from(self.name),
            object_resolver: mutation_resolver,
            selection_set: self.selection_set.items,
            input,
        };
        Ok(Mutation::CreateObject(mutation))
    }
}
```

`OperationResult` is defined as:

```rust
pub type OperationResult<T> = Result<T, OperationError>;
```

and the type `Field` is from the [graphql-parser](https://github.com/graphql-rust/graphql-parser) crate defined [here](https://docs.rs/graphql-parser/latest/graphql_parser/query/struct.Field.html).


### 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`:
```
rustc 1.63.0 (4b91a6ea7 2022-08-08)
binary: rustc
commit-hash: 4b91a6ea7258a947e59c6522cd5898e7c0a6a88f
commit-date: 2022-08-08
host: x86_64-apple-darwin
release: 1.63.0
LLVM version: 14.0.5
```

### Error output

```
error: internal compiler error: encountered incremental compilation error with evaluate_obligation(16fc490c12343ae9-13c3ae70d12ea196)
  |
  = help: This is a known issue with the compiler. Run `cargo clean -p bifrost` 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
```

<!--
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 evaluate_obligation(16fc490c12343ae9-13c3ae70d12ea196): Ok(EvaluatedToOk)', compiler/rustc_query_system/src/query/plumbing.rs:628:9
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: rustc_query_system::query::plumbing::incremental_verify_ich_cold
   3: rustc_query_system::query::plumbing::incremental_verify_ich::<rustc_query_impl::plumbing::QueryCtxt, rustc_middle::infer::canonical::Canonical<rustc_middle::ty::ParamEnvAnd<rustc_middle::ty::Predicate>>, core::result::Result<rustc_middle::traits::select::EvaluationResult, rustc_middle::traits::select::OverflowError>>
   4: rustc_query_system::query::plumbing::try_load_from_disk_and_cache_in_memory::<rustc_query_impl::plumbing::QueryCtxt, rustc_middle::infer::canonical::Canonical<rustc_middle::ty::ParamEnvAnd<rustc_middle::ty::Predicate>>, core::result::Result<rustc_middle::traits::select::EvaluationResult, rustc_middle::traits::select::OverflowError>>
   5: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::evaluate_obligation, rustc_query_impl::plumbing::QueryCtxt>
   6: <rustc_query_impl::Queries as rustc_middle::ty::query::QueryEngine>::evaluate_obligation
   7: <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation
   8: <rustc_infer::infer::InferCtxt as rustc_trait_selection::traits::query::evaluate_obligation::InferCtxtExt>::evaluate_obligation_no_overflow
   9: <rustc_trait_selection::traits::fulfill::FulfillProcessor>::process_trait_obligation
  10: <rustc_trait_selection::traits::fulfill::FulfillProcessor as rustc_data_structures::obligation_forest::ObligationProcessor>::process_obligation
  11: <rustc_data_structures::obligation_forest::ObligationForest<rustc_trait_selection::traits::fulfill::PendingPredicateObligation>>::process_obligations::<rustc_trait_selection::traits::fulfill::FulfillProcessor, rustc_data_structures::obligation_forest::Outcome<rustc_trait_selection::traits::fulfill::PendingPredicateObligation, rustc_infer::traits::FulfillmentErrorCode>>
  12: <rustc_trait_selection::traits::fulfill::FulfillmentContext as rustc_infer::traits::engine::TraitEngine>::select_where_possible
  13: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_argument_types
  14: <rustc_typeck::check::fn_ctxt::FnCtxt>::confirm_builtin_call
  15: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_call
  16: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  17: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  18: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_match
  19: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  20: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  21: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  22: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  23: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_stmt
  24: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_block_with_expected
  25: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_kind
  26: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_expr_with_expectation_and_args
  27: <rustc_typeck::check::fn_ctxt::FnCtxt>::check_return_expr
  28: rustc_typeck::check::check::check_fn
  29: <rustc_infer::infer::InferCtxtBuilder>::enter::<&rustc_middle::ty::context::TypeckResults, <rustc_typeck::check::inherited::InheritedBuilder>::enter<rustc_typeck::check::typeck_with_fallback<rustc_typeck::check::typeck::{closure#0}>::{closure#1}, &rustc_middle::ty::context::TypeckResults>::{closure#0}>
  30: rustc_typeck::check::typeck
  31: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, rustc_span::def_id::LocalDefId, &rustc_middle::ty::context::TypeckResults>
  32: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<rustc_span::def_id::LocalDefId, &rustc_middle::ty::context::TypeckResults>>
  33: rustc_query_system::query::plumbing::force_query::<rustc_query_impl::queries::typeck, rustc_query_impl::plumbing::QueryCtxt>
  34: rustc_query_impl::query_callbacks::typeck::force_from_dep_node
  35: <rustc_middle::ty::context::TyCtxt as rustc_query_system::dep_graph::DepContext>::try_force_from_dep_node
  36: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::try_mark_previous_green::<rustc_query_impl::plumbing::QueryCtxt>
  37: rustc_query_system::query::plumbing::ensure_must_run::<rustc_query_impl::plumbing::QueryCtxt, rustc_span::def_id::LocalDefId, rustc_span::def_id::LocalDefId>
  38: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::typeck, rustc_query_impl::plumbing::QueryCtxt>
  39: <rustc_middle::hir::map::Map>::par_body_owners::<rustc_typeck::check::typeck_item_bodies::{closure#0}>
  40: rustc_typeck::check::typeck_item_bodies
  41: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, (), ()>
  42: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<(), ()>>
  43: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::typeck_item_bodies, rustc_query_impl::plumbing::QueryCtxt>
  44: <rustc_session::session::Session>::time::<(), rustc_typeck::check_crate::{closure#7}>
  45: rustc_typeck::check_crate
  46: rustc_interface::passes::analysis
  47: <rustc_query_system::dep_graph::graph::DepGraph<rustc_middle::dep_graph::dep_node::DepKind>>::with_task::<rustc_middle::ty::context::TyCtxt, (), core::result::Result<(), rustc_errors::ErrorGuaranteed>>
  48: rustc_query_system::query::plumbing::try_execute_query::<rustc_query_impl::plumbing::QueryCtxt, rustc_query_system::query::caches::DefaultCache<(), core::result::Result<(), rustc_errors::ErrorGuaranteed>>>
  49: rustc_query_system::query::plumbing::get_query::<rustc_query_impl::queries::analysis, rustc_query_impl::plumbing::QueryCtxt>
  50: <rustc_interface::passes::QueryContext>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}::{closure#3}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
  51: <rustc_interface::interface::Compiler>::enter::<rustc_driver::run_compiler::{closure#1}::{closure#2}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_errors::ErrorGuaranteed>>
  52: rustc_span::with_source_map::<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_interface::interface::create_compiler_and_run<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#1}>
  53: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_errors::ErrorGuaranteed>, rustc_driver::run_compiler::{closure#1}>::{closure#0}, core::result::Result<(), rustc_errors::ErrorGuaranteed>>
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.63.0 (4b91a6ea7 2022-08-08) running on x86_64-apple-darwin

note: compiler flags: --crate-type lib -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 -C incremental

note: some of the compiler flags provided by cargo are hidden

query stack during panic:
#0 [evaluate_obligation] evaluating trait selection obligation `(alloc::string::String, graphql_parser::common::Value<'static, alloc::string::String>): core::marker::Sized`
#1 [typeck] type-checking `<impl at src/lib.rs:707:1: 743:2>::parse_object_id`
#2 [typeck_item_bodies] type-checking all item bodies
#3 [analysis] running analysis passes on this crate
end of query stack

```

</p>
</details>