Commit Graph

2716 Commits

Author SHA1 Message Date
Tom Hvitved
ebde0bdc47 Rust: Disambiguate calls to associated functions 2025-07-10 13:52:17 +02:00
Tom Hvitved
95c2b9f8f7 Rust: Add more type inference tests 2025-07-10 13:52:09 +02:00
Tom Hvitved
d4de56c157 Rust: Fix bad join
Before
```
Evaluated relational algebra for predicate TypeInference::getRangeType/1#b4219ae9@c15c3f0b with tuple counts:
               1   ~0%    {1} r1 = CONSTANT(unique string)[".."]
             692   ~0%    {1}    | JOIN WITH `RangeExpr::Generated::RangeExpr.getOperatorName/0#dispred#7c90645c_10#join_rhs` ON FIRST 1 OUTPUT Rhs.1

             453   ~0%    {1} r2 = JOIN r1 WITH `RangeExpr::Generated::RangeExpr.getStart/0#dispred#914c8207` ON FIRST 1 OUTPUT Lhs.0

             266   ~1%    {1} r3 = JOIN r2 WITH `RangeExpr::Generated::RangeExpr.getEnd/0#dispred#6c692cfa` ON FIRST 1 OUTPUT Lhs.0
        10684422   ~0%    {3}    | JOIN WITH cached_Synth::Synth::TStruct#c298e97c CARTESIAN PRODUCT OUTPUT Rhs.1, _, Lhs.0
        10684422   ~0%    {3}    | REWRITE WITH Out.1 := "core::ops::range::Range"
             266   ~0%    {2}    | JOIN WITH `Addressable::Addressable.getCanonicalPath/0#dispred#6044348f#bb` ON FIRST 2 OUTPUT Lhs.2, Lhs.0

             363   ~3%    {1} r4 = JOIN r1 WITH `RangeExpr::Generated::RangeExpr.getEnd/0#dispred#6c692cfa` ON FIRST 1 OUTPUT Lhs.0
              97   ~2%    {1}    | AND NOT `RangeExpr::Generated::RangeExpr.getStart/0#dispred#914c8207_0#antijoin_rhs`(FIRST 1)
         3896199   ~0%    {3}    | JOIN WITH cached_Synth::Synth::TStruct#c298e97c CARTESIAN PRODUCT OUTPUT Rhs.1, _, Lhs.0
         3896199   ~0%    {3}    | REWRITE WITH Out.1 := "core::ops::range::RangeTo"
              97   ~1%    {2}    | JOIN WITH `Addressable::Addressable.getCanonicalPath/0#dispred#6044348f#bb` ON FIRST 2 OUTPUT Lhs.2, Lhs.0

             187   ~0%    {1} r5 = r2 AND NOT `RangeExpr::Generated::RangeExpr.getEnd/0#dispred#6c692cfa_0#antijoin_rhs`(FIRST 1)
         7511229   ~2%    {3}    | JOIN WITH cached_Synth::Synth::TStruct#c298e97c CARTESIAN PRODUCT OUTPUT Rhs.1, _, Lhs.0
         7511229   ~0%    {3}    | REWRITE WITH Out.1 := "core::ops::range::RangeFrom"
             187   ~1%    {2}    | JOIN WITH `Addressable::Addressable.getCanonicalPath/0#dispred#6044348f#bb` ON FIRST 2 OUTPUT Lhs.2, Lhs.0

               1   ~0%    {1} r6 = CONSTANT(unique string)["..="]
             138   ~0%    {1}    | JOIN WITH `RangeExpr::Generated::RangeExpr.getOperatorName/0#dispred#7c90645c_10#join_rhs` ON FIRST 1 OUTPUT Rhs.1

             131   ~0%    {1} r7 = JOIN r6 WITH `RangeExpr::Generated::RangeExpr.getStart/0#dispred#914c8207` ON FIRST 1 OUTPUT Lhs.0
             131   ~0%    {1}    | JOIN WITH `RangeExpr::Generated::RangeExpr.getEnd/0#dispred#6c692cfa` ON FIRST 1 OUTPUT Lhs.0
         5261877   ~0%    {3}    | JOIN WITH cached_Synth::Synth::TStruct#c298e97c CARTESIAN PRODUCT OUTPUT Rhs.1, _, Lhs.0
         5261877   ~0%    {3}    | REWRITE WITH Out.1 := "core::ops::range::RangeInclusive"
             131   ~3%    {2}    | JOIN WITH `Addressable::Addressable.getCanonicalPath/0#dispred#6044348f#bb` ON FIRST 2 OUTPUT Lhs.2, Lhs.0

             138   ~0%    {1} r8 = JOIN r6 WITH `RangeExpr::Generated::RangeExpr.getEnd/0#dispred#6c692cfa` ON FIRST 1 OUTPUT Lhs.0
               7   ~0%    {1}    | AND NOT `RangeExpr::Generated::RangeExpr.getStart/0#dispred#914c8207_0#antijoin_rhs`(FIRST 1)
          281169   ~0%    {3}    | JOIN WITH cached_Synth::Synth::TStruct#c298e97c CARTESIAN PRODUCT OUTPUT Rhs.1, _, Lhs.0
          281169   ~2%    {3}    | REWRITE WITH Out.1 := "core::ops::range::RangeToInclusive"
               7   ~0%    {2}    | JOIN WITH `Addressable::Addressable.getCanonicalPath/0#dispred#6044348f#bb` ON FIRST 2 OUTPUT Lhs.2, Lhs.0

             688   ~0%    {2} r9 = r3 UNION r4 UNION r5 UNION r7 UNION r8
                          return r9
```

After
```
Evaluated relational algebra for predicate TypeInference::getRangeType/1#b4219ae9@7d06d41t with tuple counts:
          1   ~0%    {2} r1 = SCAN Stdlib::RangeToStruct#236b6b84 OUTPUT _, In.0
          1   ~0%    {2}    | REWRITE WITH Out.0 := ".."
        692   ~0%    {2}    | JOIN WITH `RangeExpr::Generated::RangeExpr.getOperatorName/0#dispred#7c90645c_10#join_rhs` ON FIRST 1 OUTPUT Rhs.1, Lhs.1
        363   ~0%    {2}    | JOIN WITH `RangeExpr::Generated::RangeExpr.getEnd/0#dispred#6c692cfa` ON FIRST 1 OUTPUT Lhs.0, Lhs.1
         97   ~0%    {2}    | AND NOT `RangeExpr::Generated::RangeExpr.getStart/0#dispred#914c8207_0#antijoin_rhs`(FIRST 1)

          1   ~0%    {2} r2 = SCAN Stdlib::RangeFromStruct#8edcefe7 OUTPUT _, In.0
          1   ~0%    {2}    | REWRITE WITH Out.0 := ".."
        692   ~0%    {2}    | JOIN WITH `RangeExpr::Generated::RangeExpr.getOperatorName/0#dispred#7c90645c_10#join_rhs` ON FIRST 1 OUTPUT Rhs.1, Lhs.1
        453   ~0%    {2}    | JOIN WITH `RangeExpr::Generated::RangeExpr.getStart/0#dispred#914c8207` ON FIRST 1 OUTPUT Lhs.0, Lhs.1
        187   ~0%    {2}    | AND NOT `RangeExpr::Generated::RangeExpr.getEnd/0#dispred#6c692cfa_0#antijoin_rhs`(FIRST 1)

          1   ~0%    {2} r3 = SCAN Stdlib::RangeToInclusiveStruct#fe43a433 OUTPUT _, In.0
          1   ~0%    {2}    | REWRITE WITH Out.0 := "..="
        138   ~0%    {2}    | JOIN WITH `RangeExpr::Generated::RangeExpr.getOperatorName/0#dispred#7c90645c_10#join_rhs` ON FIRST 1 OUTPUT Rhs.1, Lhs.1
        138   ~0%    {2}    | JOIN WITH `RangeExpr::Generated::RangeExpr.getEnd/0#dispred#6c692cfa` ON FIRST 1 OUTPUT Lhs.0, Lhs.1
          7   ~0%    {2}    | AND NOT `RangeExpr::Generated::RangeExpr.getStart/0#dispred#914c8207_0#antijoin_rhs`(FIRST 1)

          1   ~0%    {2} r4 = SCAN Stdlib::RangeStruct#0fabc810 OUTPUT _, In.0
          1   ~0%    {2}    | REWRITE WITH Out.0 := ".."
        692   ~3%    {2}    | JOIN WITH `RangeExpr::Generated::RangeExpr.getOperatorName/0#dispred#7c90645c_10#join_rhs` ON FIRST 1 OUTPUT Rhs.1, Lhs.1
        453   ~4%    {2}    | JOIN WITH `RangeExpr::Generated::RangeExpr.getStart/0#dispred#914c8207` ON FIRST 1 OUTPUT Lhs.0, Lhs.1
        266   ~2%    {2}    | JOIN WITH `RangeExpr::Generated::RangeExpr.getEnd/0#dispred#6c692cfa` ON FIRST 1 OUTPUT Lhs.0, Lhs.1

          1   ~0%    {2} r5 = SCAN Stdlib::RangeInclusiveStruct#a869750a OUTPUT _, In.0
          1   ~0%    {2}    | REWRITE WITH Out.0 := "..="
        138   ~0%    {2}    | JOIN WITH `RangeExpr::Generated::RangeExpr.getOperatorName/0#dispred#7c90645c_10#join_rhs` ON FIRST 1 OUTPUT Rhs.1, Lhs.1
        131   ~0%    {2}    | JOIN WITH `RangeExpr::Generated::RangeExpr.getStart/0#dispred#914c8207` ON FIRST 1 OUTPUT Lhs.0, Lhs.1
        131   ~0%    {2}    | JOIN WITH `RangeExpr::Generated::RangeExpr.getEnd/0#dispred#6c692cfa` ON FIRST 1 OUTPUT Lhs.0, Lhs.1

        688   ~7%    {2} r6 = r1 UNION r2 UNION r3 UNION r4 UNION r5
                     return r6
```
2025-07-10 12:34:08 +02:00
Geoffrey White
4dea5eef70 Rust: Fix futures_io models. 2025-07-10 10:41:09 +01:00
Arthur Baars
cc5e6b2195 Rust: add test cases for basic unwrapping and pattern matching 2025-07-10 11:15:07 +02:00
Arthur Baars
7c5cdd9a9b Merge pull request #20001 from github/aibaars/trait-impl-int
Rust: fix missing canonical paths for trait impls on builtin numeric types
2025-07-10 10:53:01 +02:00
Geoffrey White
8177b0938d Merge branch 'main' into models5 2025-07-10 09:41:48 +01:00
Geoffrey White
36720ca4dd Rust: Update .expected file after autoformat. 2025-07-09 21:52:23 +01:00
Arthur Baars
d20bc98363 Rust: fix missing canonical paths 2025-07-09 21:42:53 +02:00
Geoffrey White
6c9c8904d7 Rust: Autoformat. 2025-07-09 18:43:33 +01:00
Geoffrey White
dfbdd2bd02 Rust: Add type inference test cases for tuples. 2025-07-09 16:54:24 +01:00
Geoffrey White
47a4ba33a4 Rust: Fix typo in models (also fixed in another open PR). 2025-07-09 16:00:35 +01:00
Geoffrey White
a034e29040 Rust: Simplify the test a little. 2025-07-09 15:52:54 +01:00
Geoffrey White
097ac69207 Rust: Current sources test regressions. 2025-07-09 15:52:19 +01:00
Geoffrey White
8d0c14ca4e Merge branch 'main' into models3b 2025-07-09 15:25:16 +01:00
Geoffrey White
4281fe74bd Rust: We don't really need the split into two test cases any more. 2025-07-09 15:22:04 +01:00
Geoffrey White
4397863586 Rust: Update after merge with main. 2025-07-09 15:17:31 +01:00
Geoffrey White
597f678978 Merge branch 'main' into models1 2025-07-09 14:48:32 +01:00
Geoffrey White
3bb3fccfdb Rust: Accept consistency check changes. 2025-07-09 12:02:30 +01:00
Geoffrey White
22aa7f378a Rust: Expand the test cases around IDs as sensitive data. 2025-07-09 11:33:47 +01:00
Geoffrey White
1124355cdb Rust: Add a test case for 'from_trusted_iterator' as sensitive data FP. 2025-07-09 11:26:59 +01:00
Arthur Baars
5b7485d11d Rust: add testcase for impl trait on i32 2025-07-08 21:36:37 +02:00
Geoffrey White
b1d5b8175c Rust: Add the original test back as well. 2025-07-08 15:10:55 +01:00
Geoffrey White
d19259e6bb Update rust/ql/test/library-tests/frameworks/postgres/main.rs
Co-authored-by: Arthur Baars <aibaars@github.com>
2025-07-08 15:03:44 +01:00
Geoffrey White
7211f4ace3 Update rust/ql/lib/codeql/rust/frameworks/rustcrypto/rustcrypto.model.yml
Co-authored-by: Arthur Baars <aibaars@github.com>
2025-07-08 15:01:43 +01:00
Tom Hvitved
22b833fbda Rust: Fix bad join 2025-07-08 16:00:36 +02:00
Tom Hvitved
2a207f9f6f Rust: Update inline expectations 2025-07-08 13:03:16 +02:00
Tom Hvitved
73f854f073 Rust: Adjust the inferred type of string literals 2025-07-08 13:03:12 +02:00
Geoffrey White
3dabd51cf7 Rust: Fix a summaryModelDeprecated that was causing problems. 2025-07-08 11:24:57 +01:00
Tom Hvitved
1518cade7b Address review comments 2025-07-08 11:29:24 +02:00
Tom Hvitved
6876838dd1 Rust: Add change note 2025-07-08 11:20:45 +02:00
Tom Hvitved
7701a31f4a Rust: Improve type inference for for loops and range expressions 2025-07-08 11:20:42 +02:00
Geoffrey White
f57d691424 Rust: Fix typo in model. 2025-07-08 09:51:20 +01:00
Geoffrey White
c7de873a22 Rust: Update the libc models. 2025-07-08 08:44:44 +01:00
Geoffrey White
a1e9a4eddf Rust: Accept test .expected changes. 2025-07-08 08:44:24 +01:00
Geoffrey White
2195f0bb78 Merge branch 'main' into models5 2025-07-08 08:41:43 +01:00
Ian Lynagh
e5b4a15e35 Merge pull request #19994 from github/post-release-prep/codeql-cli-2.22.2
Post-release preparation for codeql-cli-2.22.2
2025-07-07 19:44:16 +01:00
Tom Hvitved
33e63109bb Merge pull request #19993 from hvitved/rust/type-inference-function-call-expectations
Rust: Add type inference inline expectations for all function calls
2025-07-07 20:40:57 +02:00
github-actions[bot]
24a0ac1223 Post-release preparation for codeql-cli-2.22.2 2025-07-07 18:15:04 +00:00
Arthur Baars
8114071804 Merge branch 'main' into models1 2025-07-07 19:47:53 +02:00
Arthur Baars
7721d14314 Rust: use getADescendant instead of getAnItem
This should handle all cases where items contained in intermediate nodes, such as MacroCall,
ExternBlock and MacroItem nodes.
2025-07-07 18:04:00 +02:00
Arthur Baars
da2f0f6069 Rust: remove MacroCallItemNode
Macro calls are not really items, so they can just be skipped
2025-07-07 18:03:02 +02:00
Arthur Baars
7556d7b57b Rust: add test with extern block 2025-07-07 18:02:58 +02:00
Tom Hvitved
fad5e0daa8 Rust: Add type inference inline expectations for all function calls 2025-07-07 17:20:15 +02:00
Geoffrey White
a25330e6ed Rust: Update rustcrypto models. 2025-07-07 15:10:59 +01:00
github-actions[bot]
f12daefabe Release preparation for version 2.22.2 2025-07-07 14:00:26 +00:00
Geoffrey White
a486549956 Update rust/ql/lib/codeql/rust/frameworks/tokio/io.model.yml
Co-authored-by: Arthur Baars <aibaars@github.com>
2025-07-07 14:01:00 +01:00
Tom Hvitved
8c90250dfc Merge pull request #19577 from hvitved/rust/remove-library-source-dedup-logic
Rust: Remove source vs library deduplication logic
2025-07-07 11:25:33 +02:00
Tom Hvitved
6a9ed88d6e Merge pull request #19975 from hvitved/rust/ssa-phi-in-capture
Rust: Fix SSA inconsistencies
2025-07-07 09:21:57 +02:00
Arthur Baars
84e5f2846b Merge branch 'main' into nickrolfe/overlay-deleted-files 2025-07-04 16:19:59 +02:00