cognitive-engineering-lab/argus

Assertion during ArgusCallbacks::after_expansion()

Opened this issue · 2 comments

djc commented

Problem

Encountered this while working on https://github.com/KumoCorp/kumomta, in this branch. (I think this is the one I was mentioning earlier in my conversation with @gavinleroy.)

Logs

OS: darwin (24.0.0)
VSCode: 1.93.1
Error message

[INFO src/plugin.rs:238] - Starting rustc analysis...
[INFO src/timer.rs:8] - rustc took 0.0206s
[INFO src/timer.rs:8] - global_ctxt took 0.0000s
[INFO src/find_bodies.rs:52] - Starting find_bodies...
[INFO src/timer.rs:8] - find_bodies took 0.0028s
[INFO src/plugin.rs:315] - analyzing BodyId { hir_id: HirId(DefId(0:109 ~ kumo_spf[8991]::record::starts_with_number).13) }
[INFO src/plugin.rs:315] - analyzing BodyId { hir_id: HirId(DefId(0:109 ~ kumo_spf[8991]::record::starts_with_number).26) }
[INFO src/plugin.rs:315] - analyzing BodyId { hir_id: HirId(DefId(0:109 ~ kumo_spf[8991]::record::starts_with_number).69) }
[INFO src/plugin.rs:315] - analyzing BodyId { hir_id: HirId(DefId(0:109 ~ kumo_spf[8991]::record::starts_with_number).146) }
[INFO src/plugin.rs:315] - analyzing BodyId { hir_id: HirId(DefId(0:113 ~ kumo_spf[8991]::record::starts_with_ident).60) }
[INFO src/plugin.rs:315] - analyzing BodyId { hir_id: HirId(DefId(0:129 ~ kumo_spf[8991]::record::{impl#9}::parse::add_literal).44) }
[INFO src/plugin.rs:315] - analyzing BodyId { hir_id: HirId(DefId(0:130 ~ kumo_spf[8991]::record::{impl#9}::parse::is_macro_literal).31) }
[INFO src/plugin.rs:315] - analyzing BodyId { hir_id: HirId(DefId(0:167 ~ kumo_spf[8991]::record::{impl#13}::fmt).23) }
[INFO src/plugin.rs:315] - analyzing BodyId { hir_id: HirId(DefId(0:87 ~ kumo_spf[8991]::record::{impl#0}::parse).30) }
[INFO src/plugin.rs:315] - analyzing BodyId { hir_id: HirId(DefId(0:87 ~ kumo_spf[8991]::record::{impl#0}::parse).243) }
[INFO src/plugin.rs:315] - analyzing BodyId { hir_id: HirId(DefId(0:89 ~ kumo_spf[8991]::record::{impl#0}::evaluate).158) }
[INFO src/plugin.rs:315] - analyzing BodyId { hir_id: HirId(DefId(0:89 ~ kumo_spf[8991]::record::{impl#0}::evaluate).159) }
[INFO src/plugin.rs:315] - analyzing BodyId { hir_id: HirId(DefId(0:176 ~ kumo_spf[8991]::record::{impl#14}::fmt).47) }
[INFO src/plugin.rs:315] - analyzing BodyId { hir_id: HirId(DefId(0:181 ~ kumo_spf[8991]::record::{impl#15}::fmt).28) }
[INFO src/plugin.rs:315] - analyzing BodyId { hir_id: HirId(DefId(0:92 ~ kumo_spf[8991]::record::{impl#1}::parse).93) }
[INFO src/plugin.rs:315] - analyzing BodyId { hir_id: HirId(DefId(0:93 ~ kumo_spf[8991]::record::{impl#1}::evaluate).307) }
thread 'rustc' panicked at compiler/rustc_infer/src/infer/opaque_types/mod.rs:497:9:
assertion `left == right` failed
  left: Some(?4t)
 right: None
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::assert_failed_inner
   3: core::panicking::assert_failed::<core::option::Option<rustc_middle::ty::Ty>, core::option::Option<rustc_middle::ty::Ty>>
   4: <rustc_trait_selection::solve::eval_ctxt::EvalCtxt>::evaluate_goal_raw
   5: <rustc_trait_selection::solve::eval_ctxt::EvalCtxt>::enter_root::<core::result::Result<(bool, rustc_type_ir::solve::Certainty), rustc_type_ir::solve::NoSolution>, <rustc_infer::infer::InferCtxt as rustc_trait_selection::solve::eval_ctxt::InferCtxtEvalExt>::evaluate_root_goal::{closure#0}>
   6: <rustc_trait_selection::solve::fulfill::FulfillmentCtxt as rustc_infer::traits::engine::TraitEngine>::select_where_possible
   7: <rustc_hir_typeck::fn_ctxt::FnCtxt>::type_inference_fallback
   8: rustc_hir_typeck::typeck
      [... omitted 2 frames ...]
   9: rustc_middle::query::plumbing::query_get_at::<rustc_query_system::query::caches::VecCache<rustc_span::def_id::LocalDefId, rustc_middle::query::erase::Erased<[u8; 8]>>>
  10: rustc_hir_typeck::inspect_typeck
  11: argus_lib::analysis::obligations
  12: <argus_cli::plugin::ArgusCallbacks<A,T,F> as rustc_driver_impl::Callbacks>::after_expansion::{{closure}}::{{closure}}
  13: alloc::vec::in_place_collect::<impl alloc::vec::spec_from_iter::SpecFromIter<T,I> for alloc::vec::Vec<T>>::from_iter
  14: rustc_middle::ty::context::GlobalCtxt::enter
  15: <argus_cli::plugin::ArgusCallbacks<A,T,F> as rustc_driver_impl::Callbacks>::after_expansion
  16: <rustc_interface::interface::Compiler>::enter::<rustc_driver_impl::run_compiler::{closure#0}::{closure#1}, core::result::Result<core::option::Option<rustc_interface::queries::Linker>, rustc_span::ErrorGuaranteed>>
  17: <scoped_tls::ScopedKey<rustc_span::SessionGlobals>>::set::<rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>
  18: rustc_span::create_session_globals_then::<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_interface::util::run_in_thread_with_globals<rustc_interface::util::run_in_thread_pool_with_globals<rustc_interface::interface::run_compiler<core::result::Result<(), rustc_span::ErrorGuaranteed>, rustc_driver_impl::run_compiler::{closure#0}>::{closure#1}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}, core::result::Result<(), rustc_span::ErrorGuaranteed>>::{closure#0}::{closure#0}::{closure#0}>
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
error: could not compile `kumo-spf` (lib)

Full log: https://paste.rs/HCkYZ

Thank you for tracking that down!

I believe this is a problem with how Argus invokes some rustc APIs, I'll need to investigate further

djc commented

It's weird because it seems very intermittent, happens seemingly randomly while switching tabs to another file. (I do have autosaving enabled so could maybe be triggered by a change? But I don't think I was making a change at the time.)