Commit Graph

32 Commits

Author SHA1 Message Date
Paolo Tranquilli
d0461e2c08 Merge branch 'main' into redsun82/rust-config 2025-02-19 17:09:04 +01:00
Paolo Tranquilli
755140152c Rust: support glob members in workspaces 2025-02-17 15:09:35 +01:00
Paolo Tranquilli
a6f58c9fd2 Rust: add option for proc macro server 2025-02-13 15:37:54 +01:00
Arthur Baars
0442d24204 Rust: drop tracing:: qualifiers 2025-02-12 10:27:30 +01:00
Arthur Baars
c602e82ac4 Rust: use tracing-subscriber 2025-02-12 10:27:29 +01:00
Paolo Tranquilli
e6cb376ad8 Rust: fix typo 2025-01-17 12:31:48 +01:00
Paolo Tranquilli
bbaff8b199 Rust: cleanup workspace aggregation 2025-01-17 12:19:56 +01:00
Paolo Tranquilli
3c064284b0 Rust: aggregate projects into workspaces 2025-01-15 17:17:19 +01:00
Paolo Tranquilli
4f79199498 Rust: replace std::fs::canonicalize with dunce::canonicalize
Rust-analyzer turned out to be quite picky about paths, where
`//?/`-prefixed paths can lead to flaky failures. See

https://github.com/rust-lang/rust-analyzer/issues/18894

for details.

This makes paths always be canonicalized with `dunce`. Previously,
`dunce` was used as a fallback, but that stopped working somewhere
after version 0.0.248 of rust-analyzer.
2025-01-09 15:43:15 +01:00
Paolo Tranquilli
9486e8b734 Rust: elaborate on path_to_file_id comment
This is a follow up to https://github.com/github/codeql/pull/18167, addressing a
review comment from @paldepind.
2024-12-02 08:16:52 +01:00
Paolo Tranquilli
488903280f Rust: tentative windows fix 2024-11-29 17:23:30 +01:00
Paolo Tranquilli
abd73e16d4 Revert "Revert "Rust: allow to specify more cargo configuration options"" 2024-11-18 15:52:03 +01:00
Paolo Tranquilli
04072591c4 Revert "Rust: allow to specify more cargo configuration options" 2024-11-18 15:36:06 +01:00
Paolo Tranquilli
be45e3deed Rust: allow to specify more cargo configuration options
This allows to tweak via extractor options some aspects of the cargo
configuration:
* the target architecture
* features (including `*` for all, which we must understand whether to
  set by default)
* cfg overrides

Integration tests will be added in a follow-up commit.
2024-11-08 12:23:16 +01:00
Paolo Tranquilli
4f6fda0100 Rust: allow to specify the target directory 2024-11-07 12:45:20 +01:00
Paolo Tranquilli
64d522e447 Rust: address review 2024-11-07 09:39:44 +01:00
Paolo Tranquilli
200715773f Rust: fix no_semantics_reason 2024-11-06 17:19:06 +01:00
Paolo Tranquilli
2987743e44 Rust: exclude uncompiled files from semantics and surface semanticless reason 2024-11-06 15:22:28 +01:00
Arthur Baars
0e511d640b Rust: avoid panics
If:
* the text for a file_id is not found (likely non-utf data in file)
* path does not appear in Vfs, in which case we fall back on loading the file from disk with no "semantics" available
2024-10-30 13:18:36 +01:00
Arthur Baars
c87f2c4eb1 Rust: remove unnecessary field 2024-10-28 18:56:20 +01:00
Arthur Baars
b6c26debef Rust: create single Semantics object for each workspace 2024-10-28 13:29:04 +01:00
Arthur Baars
57cdda3405 Rust: no longer reload files into the RootDatabase
Files were reloaded to handle cases were there was no content
for a file_id, causing a panic. Missing contents was caused by
files that did not contain valid UTF-8 data. These are skipped
by rust-analyzer when it is loading data into the RootDatabase.
2024-10-28 13:29:03 +01:00
Paolo Tranquilli
a760b89895 Rust: small tweaks 2024-10-25 14:13:27 +02:00
Paolo Tranquilli
5230b7b041 Rust: reduce log spam and skip debug diagnostics in the DB 2024-10-25 13:47:13 +02:00
Arthur Baars
6ade2a8054 Rust: address comments 2024-10-11 13:11:12 +02:00
Arthur Baars
ca27785ace Rust: extract files on a per-project basis
This way we have only one "project" database in-memory at a time. This
should avoid running out of memory when analyzing large mono-repos.
2024-10-10 15:53:14 +02:00
Arthur Baars
58d2c71c20 Rust: load files from disk ourselves
This avoids problems with files containing invalid utf-8 data, which may cause
panic's like:
```
 thread 'main' panicked at external/rules_rust~~_crate~ql~~r~r__ra_ap_salsa-0.0.232/src/input.rs:91:32:
   no value set for CompressedFileTextQuery(FileId(2429))
   stack backtrace:
      0: rust_begin_unwind
                at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/std/src/panicking.rs:665:5
      1: core::panicking::panic_fmt
                at /rustc/eeb90cda1969383f56a2637cbd3037bdf598841c/library/core/src/panicking.rs:74:14
      2: <salsa::input::InputStorage<Q> as salsa::plumbing::QueryStorageOps<Q>>::fetch
      3: <DB as ra_ap_base_db::SourceDatabase>::compressed_file_text::__shim
      4: <ra_ap_base_db::FileTextQuery as salsa::plumbing::QueryFunction>::execute
      5: salsa::Cycle::catch
      6: salsa::derived_lru::slot::Slot<Q,MP>::execute
      7: salsa::derived_lru::slot::Slot<Q,MP>::read
      8: <salsa::derived_lru::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::fetch
      9: <DB as ra_ap_base_db::SourceDatabase>::file_text::__shim
     10: <DB as ra_ap_base_db::SourceDatabase>::file_text
     11: <ra_ap_base_db::ParseQuery as salsa::plumbing::QueryFunction>::execute
     12: salsa::Cycle::catch
     13: salsa::derived_lru::slot::Slot<Q,MP>::execute
     14: salsa::derived_lru::slot::Slot<Q,MP>::read
     15: <salsa::derived_lru::DerivedStorage<Q,MP> as salsa::plumbing::QueryStorageOps<Q>>::fetch
     16: <DB as ra_ap_base_db::SourceDatabase>::parse::__shim
     17: <DB as ra_ap_base_db::SourceDatabase>::parse
     18: ra_ap_hir::semantics::SemanticsImpl::parse
     19: single_arch_extractor::main
```
2024-10-10 15:53:11 +02:00
Arthur Baars
3e877ffaac Rust: do not fail on bad Cargo.toml files 2024-10-10 15:53:08 +02:00
Arthur Baars
ae19b2fd89 Rust: check that TextRanges are for the correct file 2024-10-10 15:53:07 +02:00
Arthur Baars
faa168993c Rust: reduce log output 2024-10-10 15:53:06 +02:00
Arthur Baars
0b3b95ab54 Rust: macro expansion 2024-10-10 15:19:47 +02:00
Arthur Baars
cad2b74137 Rust: integrate Rust Analyzer's Semantic module into extractor 2024-10-10 15:19:46 +02:00