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

bug: cycle detected with new associated type #6073

Closed
gaetbout opened this issue Jul 26, 2024 · 3 comments · Fixed by #6094
Closed

bug: cycle detected with new associated type #6073

gaetbout opened this issue Jul 26, 2024 · 3 comments · Fixed by #6094
Assignees
Labels
bug Something isn't working

Comments

@gaetbout
Copy link
Contributor

gaetbout commented Jul 26, 2024

Bug Report

Cairo version:

2.7.0-rc.3

Description

Code can be found at:
gaetbout/quaireaux@793a8da
Comes from the file packages/data_structures/src/byte_reader.cairo
Probably at line 177

Just clone the repo and run

scarb test -p alexandria_data_structures

You should run into:

   Compiling test(alexandria_data_structures_unittest) alexandria_data_structures v0.2.0 (/Users/me/quaireaux/packages/data_structures/Scarb.toml)
thread 'main' panicked at /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/salsa-0.16.1/src/lib.rs:490:48:
Internal error, cycle detected:

DatabaseKeyIndex { group_index: 4, query_index: 134, key_index: 375 }
DatabaseKeyIndex { group_index: 4, query_index: 250, key_index: 732 }
DatabaseKeyIndex { group_index: 4, query_index: 74, key_index: 123 }
DatabaseKeyIndex { group_index: 4, query_index: 72, key_index: 123 }
DatabaseKeyIndex { group_index: 4, query_index: 135, key_index: 322 }

stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: core::panicking::panic_display
   3: <DB as cairo_lang_semantic::db::SemanticGroup>::impl_def_generic_params_data::__shim
   4: salsa::derived::slot::Slot<Q,MP>::read_upgrade
   5: <DB as cairo_lang_semantic::db::SemanticGroup>::impl_def_generic_params::__shim
   6: cairo_lang_semantic::resolve::Resolver::specialize_generic_module_item
   7: cairo_lang_semantic::resolve::Resolver::resolve_path_next_segment_concrete
   8: cairo_lang_semantic::resolve::Resolver::resolve_path_inner
   9: cairo_lang_semantic::items::impl_alias::impl_alias_semantic_data_helper
  10: salsa::derived::slot::Slot<Q,MP>::read_upgrade
  11: <DB as cairo_lang_semantic::db::SemanticGroup>::priv_impl_alias_semantic_data::__shim
  12: salsa::derived::slot::Slot<Q,MP>::read_upgrade
  13: <DB as cairo_lang_semantic::db::SemanticGroup>::impl_alias_resolved_impl::__shim
  14: cairo_lang_semantic::resolve::Resolver::specialize_generic_module_item
  15: cairo_lang_semantic::resolve::Resolver::resolve_path_next_segment_concrete
  16: cairo_lang_semantic::resolve::Resolver::resolve_path_inner
  17: cairo_lang_semantic::items::generics::priv_generic_param_data
  18: salsa::derived::slot::Slot<Q,MP>::read_upgrade
  19: <DB as cairo_lang_semantic::db::SemanticGroup>::priv_generic_param_data::__shim
  20: <core::iter::adapters::GenericShunt<I,R> as core::iter::traits::iterator::Iterator>::next
  21: cairo_lang_semantic::items::generics::semantic_generic_params
  22: salsa::derived::slot::Slot<Q,MP>::read_upgrade
  23: <DB as cairo_lang_semantic::db::SemanticGroup>::impl_def_generic_params_data::__shim
  24: cairo_lang_semantic::items::imp::priv_impl_declaration_data_inner
  25: salsa::derived::slot::Slot<Q,MP>::read_upgrade
  26: <DB as cairo_lang_semantic::db::SemanticGroup>::priv_impl_declaration_data::__shim
  27: salsa::derived::slot::Slot<Q,MP>::read_upgrade
  28: <DB as cairo_lang_semantic::db::SemanticGroup>::impl_def_concrete_trait::__shim
  29: salsa::derived::slot::Slot<Q,MP>::read_upgrade
  30: <DB as cairo_lang_semantic::db::SemanticGroup>::module_impl_ids_for_trait_filter::__shim
  31: salsa::derived::slot::Slot<Q,MP>::read_upgrade
  32: <DB as cairo_lang_semantic::db::SemanticGroup>::canonic_trait_solutions::__shim
  33: cairo_lang_semantic::expr::inference::Inference::trait_solution_set
  34: cairo_lang_semantic::expr::compute::compute_method_function_call_data
  35: cairo_lang_semantic::expr::compute::compute_expr_binary_semantic
  36: cairo_lang_semantic::expr::compute::compute_expr_semantic
  37: cairo_lang_semantic::expr::compute::compute_statement_semantic
  38: cairo_lang_semantic::expr::compute::ComputationContext::run_in_subscope
  39: cairo_lang_semantic::expr::compute::compute_root_expr
  40: salsa::derived::slot::Slot<Q,MP>::read_upgrade
  41: <DB as cairo_lang_semantic::db::SemanticGroup>::priv_impl_function_body_data::__shim
  42: salsa::derived::slot::Slot<Q,MP>::read_upgrade
  43: <DB as cairo_lang_semantic::db::SemanticGroup>::impl_function_body_diagnostics::__shim
  44: salsa::derived::slot::Slot<Q,MP>::read_upgrade
  45: <DB as cairo_lang_semantic::db::SemanticGroup>::impl_semantic_definition_diagnostics::__shim
  46: salsa::derived::slot::Slot<Q,MP>::read_upgrade
  47: <DB as cairo_lang_semantic::db::SemanticGroup>::module_semantic_diagnostics::__shim
  48: cairo_lang_compiler::diagnostics::DiagnosticsReporter::check
  49: <scarb::compiler::compilers::test::TestCompiler as scarb::compiler::Compiler>::compile
  50: scarb::ops::compile::compile_unit
  51: scarb::ops::compile::process
  52: scarb::ops::compile::compile
  53: scarb::commands::run
  54: scarb::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Error: `scarb metadata` exited with error

Stack backtrace:
   0: std::backtrace::Backtrace::capture
   1: anyhow::error::<impl core::convert::From<E> for anyhow::Error>::from
   2: scarb_cairo_test::main
   3: std::sys_common::backtrace::__rust_begin_short_backtrace
   4: _main
@gaetbout gaetbout added the bug Something isn't working label Jul 26, 2024
@orizi
Copy link
Collaborator

orizi commented Jul 29, 2024

It seems the issue is having an impl as the value of ab impl param. We will make sure this becomes a diagnostic instead of a crash.

@gaetbout
Copy link
Contributor Author

Will this be shipped with 2.7.0?

@orizi
Copy link
Collaborator

orizi commented Jul 29, 2024

I hope so, but in any case, it won't block anything that should work from working.

@orizi orizi linked a pull request Jul 30, 2024 that will close this issue
@orizi orizi closed this as completed Aug 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants