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

LS: Crashes of language server with corelib mismatch #6420

Closed
Arcticae opened this issue Sep 25, 2024 · 1 comment
Closed

LS: Crashes of language server with corelib mismatch #6420

Arcticae opened this issue Sep 25, 2024 · 1 comment
Assignees
Labels
bug Something isn't working ide This issue refers to CairoLS or editor extensions

Comments

@Arcticae
Copy link
Collaborator

Bug Report

Cairo version:

2.7.1

Current behavior:
with cubit="1.3.0" dep and scarb = "2.7.1" the LS seems to crash in the corelib resolving stage (on goto/opening cubit's files only).

Scarb cache clean + restart does not help (neither does removing it manually)

Example Error message:

Error - 16:17:26] Request textDocument/semanticTokens/full failed.
  Message: Internal error
  Code: -32603 
thread 'main' panicked at /Users/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cairo-lang-semantic-2.7.1/src/corelib.rs:703:32:
Core module `core` is missing an use item for trait `NumericLiteral`.
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: cairo_lang_semantic::corelib::get_core_trait
   3: cairo_lang_semantic::expr::inference::Inference::finalize_without_reporting
   4: cairo_lang_semantic::expr::inference::Inference::finalize
   5: cairo_lang_semantic::items::trt::trait_generic_params_data
   6: salsa::derived::slot::Slot<Q,MP>::read_upgrade
   7: <DB as cairo_lang_semantic::db::SemanticGroup>::trait_generic_params_data
   8: salsa::derived::slot::Slot<Q,MP>::read_upgrade
   9: <DB as cairo_lang_semantic::db::SemanticGroup>::priv_trait_declaration_data
  10: salsa::derived::slot::Slot<Q,MP>::read_upgrade
  11: <DB as cairo_lang_semantic::db::SemanticGroup>::trait_resolver_data
  12: salsa::derived::slot::Slot<Q,MP>::read_upgrade
  13: <DB as cairo_lang_semantic::db::SemanticGroup>::priv_trait_function_generic_params_data
  14: salsa::derived::slot::Slot<Q,MP>::read_upgrade
  15: <DB as cairo_lang_semantic::db::SemanticGroup>::priv_trait_function_declaration_data
  16: salsa::derived::slot::Slot<Q,MP>::read_upgrade
  17: <DB as cairo_lang_semantic::db::SemanticGroup>::trait_function_resolver_data
  18: cairo_lang_semantic::db::get_resolver_data_options
  19: salsa::derived::slot::Slot<Q,MP>::read_upgrade
  20: <DB as cairo_lang_semantic::db::SemanticGroup>::lookup_resolved_generic_item_by_ptr::__shim
  21: cairo_lang_language_server::find_definition
  22: cairo_lang_language_server::ide::hover::render::definition::definition
  23: cairo_lang_language_server::ide::hover::hover
  24: <cairo_lang_language_server::Backend as tower_lsp::LanguageServer>::hover::{{closure}}
  25: tower_lsp::jsonrpc::router::Router<S,E>::method::{{closure}}::{{closure}}::{{closure}}
  26: <futures_util::future::future::Map<Fut,F> as core::future::future::Future>::poll
  27: <futures_util::future::either::Either<A,B> as core::future::future::Future>::poll
  28: <tower_lsp::service::LspService<S> as tower_service::Service<tower_lsp::jsonrpc::request::Request>>::call::{{closure}}
  29: cairo_lang_language_server::start_with_tricks::{{closure}}
  30: cairo_lang_language_server::start_with_tricks
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
   0.709173209s DEBUG hover{uri=file:///Users/timelock/Library/Caches/com.swmansion.scarb/registry/src/scarbs.xyz-9djtpev4jug5q/cubit-1.3.0/src/f64/types/fixed.cairo}: cairo_lang_language_server::ide::hover: close time.busy=2.09ms time.idle=1.96µs

Upgrading to 2.8.0 solves this issue
Expected behavior:

We should propose a solution or feasible workaround for this, or at least try to figure out what went wrong so this doesn't repeat itself in the future.

Steps to reproduce:

Setup explained above, generate a project, add

cubit = "1.3.0" 

to Scarb.toml deps

then in the code:

use cubit::f64::FixedTrait;
// ...
    let one_ln = FixedTrait::ONE().ln();
    one_ln.abs();

And try "goto" on the FixedTrait

@Arcticae Arcticae added bug Something isn't working ide This issue refers to CairoLS or editor extensions labels Sep 25, 2024
@github-project-automation github-project-automation bot moved this to Triage in CairoLS Sep 25, 2024
@mkaput mkaput moved this from Triage to Backlog in CairoLS Oct 14, 2024
@mkaput mkaput moved this from Backlog to Todo in CairoLS Oct 14, 2024
@mkaput
Copy link
Contributor

mkaput commented Oct 14, 2024

Check if this is fixed by #6395

@Arcticae Arcticae closed this as completed Nov 4, 2024
@github-project-automation github-project-automation bot moved this from Todo to Done in CairoLS Nov 4, 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 ide This issue refers to CairoLS or editor extensions
Projects
Archived in project
Development

No branches or pull requests

3 participants