Commit Graph

1961 Commits

Author SHA1 Message Date
Geoffrey White
e5885f65db Rust: Add more test cases for unused variables and unreachable code. 2024-10-14 16:25:18 +01:00
Geoffrey White
528641c55a Rust: Test spacing. 2024-10-14 16:25:17 +01:00
Geoffrey White
134539060d Rust: correct some 'spurious' annotations that are off by one line. 2024-10-14 16:24:44 +01:00
Geoffrey White
25b592fc89 Merge pull request #17744 from geoffw0/unusedvar5
Rust: Unused variable follow-up work
2024-10-14 16:20:52 +01:00
Arthur Baars
ae7afa7aff Update rust/ql/lib/codeql/rust/controlflow/internal/Completion.qll
Co-authored-by: Simon Friis Vindum <simonfv@gmail.com>
2024-10-14 15:20:43 +02:00
Arthur Baars
493a68a232 Rust: add MacroPat to isExhaustiveMatch 2024-10-14 13:55:59 +02:00
Simon Friis Vindum
22261c1480 Rust: Rename isIrrefutablePattern to isExhaustiveMatch 2024-10-14 13:43:57 +02:00
Simon Friis Vindum
e83f1d17bf Rust: Simplify return implementation in CFG 2024-10-14 11:40:35 +02:00
Simon Friis Vindum
8e4e663739 Rust: Handle question mark operator in CFG 2024-10-14 11:38:35 +02:00
Simon Friis Vindum
2f07f1c730 Rust: Abnormal completion in scrutinee does not continue to match arms 2024-10-14 11:32:22 +02:00
Simon Friis Vindum
23ee7b955c Rust: Add CFG tests for question mark operator and scrutinee with return 2024-10-14 11:27:32 +02:00
Tom Hvitved
6290be2922 Rust: Initial SSA implementation 2024-10-11 19:39:28 +02:00
Tom Hvitved
b0ea175021 Rust: Add more variables tests 2024-10-11 19:36:04 +02:00
Geoffrey White
c4256f21c7 Rust: Fix out-of-date spurious tags. 2024-10-11 17:18:41 +01:00
Geoffrey White
ac9a8d602c Rust: Add metadata to the original CFG consistency query. 2024-10-11 17:01:47 +01:00
Geoffrey White
d4c3e3323f Rust: Add diagnostic query for CFG inconsistency counts. 2024-10-11 17:01:46 +01:00
Geoffrey White
7b712f3d65 Rust: Calculate a total of CFG inconsistencies. 2024-10-11 17:01:41 +01:00
Geoffrey White
4398c83a67 Rust: Add more QLDoc to the CFG consistency library. 2024-10-11 16:53:46 +01:00
Geoffrey White
85f2582afd Rust: Move CFG consistency logic into a library. 2024-10-11 16:53:45 +01:00
Arthur Baars
fc298b23c9 Rust: address comment 2024-10-11 16:01:13 +02:00
Arthur Baars
5f45402cf7 Merge remote-tracking branch 'upstream/main' into aibaars/rust-macros 2024-10-11 15:40:07 +02:00
Tom Hvitved
ac8b9739c5 Merge pull request #17686 from hvitved/rust/cfg-patterns
Rust: Include parameters and patterns in the CFG
2024-10-11 14:45:27 +02:00
Tom Hvitved
ffd6b9864c Address review comments 2024-10-11 14:27:42 +02:00
Arthur Baars
659ce6f1ca Rust: fix CodeQL alert 2024-10-11 13:45:10 +02:00
Arthur Baars
b4bb24aa43 Merge remote-tracking branch 'upstream/main' into aibaars/rust-macros 2024-10-11 13:33:50 +02:00
Arthur Baars
6ade2a8054 Rust: address comments 2024-10-11 13:11:12 +02:00
Tom Hvitved
0ec40afa4c Rust: Update expected test output 2024-10-11 12:44:35 +02:00
Tom Hvitved
8cc349e85f Rust: Run codegen 2024-10-11 12:01:16 +02:00
Tom Hvitved
b284a2a7c0 Rust: Add Callable as a base class of Function and ClosureExpr 2024-10-11 12:00:30 +02:00
Paolo Tranquilli
f3bf347bd6 Merge branch 'main' into redsun82/codegen-annotate 2024-10-11 10:38:02 +02:00
Arthur Baars
9fad5410c0 Rust: implement CFG for macros 2024-10-11 10:37:24 +02:00
Paolo Tranquilli
c66bd72620 Rust: rename to CallExprBase 2024-10-11 09:52:30 +02:00
Tom Hvitved
756affa4aa Rust: Fix bugs in LetExprTree and MethodCallExprTree 2024-10-10 21:05:01 +02:00
Tom Hvitved
2f14ec9f2a Rust: Include patterns in the CFG 2024-10-10 21:05:00 +02:00
Tom Hvitved
f6f54c6e3b Rust: Include parameters in the CFG 2024-10-10 21:04:58 +02:00
Tom Hvitved
665da3958a Rust: Add CFG test for nested function 2024-10-10 21:04:57 +02:00
Tom Hvitved
5f353b72cd Merge pull request #17727 from github/aibaars/modifiers
Rust: add extraction of all sorts of modifier tokens
2024-10-10 18:00:21 +02:00
Simon Friis Vindum
1398575b97 Merge pull request #17728 from paldepind/rust-remove-unused-types
Rust: Remove unused types
2024-10-10 17:33:59 +02:00
Geoffrey White
04c7319b6b Merge pull request #17647 from geoffw0/warnings
Rust: More information about extractor errors and warnings
2024-10-10 16:19:15 +01:00
Arthur Baars
6d43eed1e6 Rust: add QL doc for MacroStmts and MacroItems 2024-10-10 16:28:10 +02:00
Arthur Baars
f97a159163 Rust: clippy fixes 2024-10-10 15:53:16 +02:00
Arthur Baars
88e5ce3cf8 Rust: lower default verbosity to WARN 2024-10-10 15:53:15 +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
db28f1b29e Rust: use macro to inject extraction functions for detached properties 2024-10-10 15:53:13 +02:00
Arthur Baars
8372a2e562 Rust: ensure error and token locations are valid
The locations are "clipped" to the ranges of the parent node of a token,
and the root node of the parse tree for errors.
2024-10-10 15:53:12 +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
f70f8a3536 Rust: fix utf8 test 2024-10-10 15:53:10 +02:00
Arthur Baars
1135bf6bcd Rust: improve QL test script 2024-10-10 15:53:09 +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