Commit Graph

3488 Commits

Author SHA1 Message Date
Paolo Tranquilli
0f28502e68 Merge branch 'main' into redsun82/just2 2025-11-14 12:28:00 +01:00
Tom Hvitved
8668473916 Merge pull request #20683 from hvitved/rust/type-inference-arg-target-typed
Rust: Restrict type propagation into arguments
2025-11-14 10:46:04 +01:00
Tom Hvitved
4c7f9c0144 Rust: Rename ContextType -> UnknownType 2025-11-14 10:16:21 +01:00
Tom Hvitved
79bdf897d7 Rust: Context typing for constructors 2025-11-14 09:45:03 +01:00
Tom Hvitved
c16b42119d Rust: More type inference tests 2025-11-14 09:45:02 +01:00
Tom Hvitved
e69ff0d5e8 Rust: Restrict type propagation into arguments 2025-11-14 09:44:58 +01:00
Tom Hvitved
72b7dd8955 Rust: Add more type inference tests 2025-11-14 09:41:30 +01:00
Tom Hvitved
f926a076b8 Rust: Fix bad join
Before
```
Evaluated relational algebra for predicate TypeMention::NonAliasPathTypeMention.getTypeMentionForTypeParameter/1#f0c507c8@d7d71dnu with tuple counts:
            12496   ~2%    {3} r1 = SCAN `TypeMention::NonAliasPathTypeMention.getAnAssocTypeArgument/1#c61d1deb` OUTPUT In.2, In.0, In.1
            12421   ~0%    {3}    | JOIN WITH TypeMention::TypeMention#3ab935d1 ON FIRST 1 OUTPUT Lhs.1, Lhs.2, Lhs.0
            12421   ~0%    {3}    | JOIN WITH TypeMention::NonAliasPathTypeMention#9123dc7e ON FIRST 1 OUTPUT Lhs.1, Lhs.0, Lhs.2
            12421   ~0%    {3}    | JOIN WITH cached_Type::TAssociatedTypeTypeParameter#14a276f6 ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.2
            12421   ~0%    {3}    | JOIN WITH Type::TypeParameter#f85657da ON FIRST 1 OUTPUT Lhs.1, Lhs.0, Lhs.2

                1   ~0%    {2} r2 = SCAN `Stdlib::FnOnceTrait.getTypeParam/0#dispred#93f20bbc` OUTPUT In.1, In.0
                1   ~0%    {2}    | JOIN WITH cached_Type::TTypeParamTypeParameter#868c69a5 ON FIRST 1 OUTPUT Rhs.1, Lhs.1
                1   ~0%    {2}    | JOIN WITH Type::TypeParameter#f85657da ON FIRST 1 OUTPUT Lhs.1, Lhs.0
             3216   ~0%    {2}    | JOIN WITH TypeMention::NonAliasPathTypeMention#9123dc7e_10#join_rhs ON FIRST 1 OUTPUT Rhs.1, Lhs.1
             3216   ~0%    {3}    | JOIN WITH `Path::Generated::Path.getSegment/0#dispred#1c7ef50f` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.0
             3201   ~0%    {3}    | JOIN WITH `PathSegment::Generated::PathSegment.getParenthesizedArgList/0#dispred#cd573956` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.2
             3201   ~0%    {3}    | JOIN WITH TypeMention::TypeMention#3ab935d1 ON FIRST 1 OUTPUT Lhs.2, Lhs.1, Lhs.0

                1   ~0%    {2} r3 = SCAN `Stdlib::FnOnceTrait.getOutputType/0#0d2e9ef1` OUTPUT In.1, In.0
                1   ~0%    {2}    | JOIN WITH cached_Type::TAssociatedTypeTypeParameter#14a276f6 ON FIRST 1 OUTPUT Rhs.1, Lhs.1
                1   ~0%    {2}    | JOIN WITH Type::TypeParameter#f85657da ON FIRST 1 OUTPUT Lhs.1, Lhs.0
             3216   ~3%    {2}    | JOIN WITH TypeMention::NonAliasPathTypeMention#9123dc7e_10#join_rhs ON FIRST 1 OUTPUT Rhs.1, Lhs.1
             3216   ~0%    {3}    | JOIN WITH `Path::Generated::Path.getSegment/0#dispred#1c7ef50f` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.0
             2958   ~0%    {3}    | JOIN WITH `PathSegment::Generated::PathSegment.getRetType/0#dispred#9d400241` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.2
             2958   ~0%    {3}    | JOIN WITH `RetTypeRepr::Generated::RetTypeRepr.getTypeRepr/0#dispred#fd85a980` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.2
             2944   ~0%    {3}    | JOIN WITH TypeMention::TypeMention#3ab935d1 ON FIRST 1 OUTPUT Lhs.2, Lhs.1, Lhs.0

            54186   ~3%    {2} r4 = JOIN `TypeAlias::Generated::TypeAlias.getTypeRepr/0#dispred#5fd7e521_10#join_rhs` WITH TypeMention::TypeMention#3ab935d1 ON FIRST 1 OUTPUT Lhs.1, Lhs.0
          1446369  ~12%    {3}    | JOIN WITH `PathResolution::ItemNode.getASuccessor/1#8f430f71_201#join_rhs` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Rhs.2
            36945   ~0%    {3}    | JOIN WITH `PathResolution::ImplItemNode.getTraitPath/0#dispred#3b7d1cb6` ON FIRST 1 OUTPUT Lhs.2, Lhs.1, Rhs.1
        377232832   ~1%    {4}    | JOIN WITH `Name::Generated::Name.getText/0#dispred#107a5a39_10#join_rhs` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.2, Lhs.0
        370815806   ~5%    {4}    | JOIN WITH `TypeAlias::Generated::TypeAlias.getName/0#dispred#bf886045_10#join_rhs` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.2, Lhs.3
          1490317   ~0%    {4}    | JOIN WITH cached_Type::TAssociatedTypeTypeParameter#14a276f6 ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.2, Lhs.3
          1490317   ~0%    {4}    | JOIN WITH `Type::AssociatedTypeTypeParameter.getTrait/0#dispred#41eb3020` ON FIRST 1 OUTPUT Lhs.2, Rhs.1, Lhs.1, Lhs.3
            36413   ~1%    {4}    | JOIN WITH TypeMention::NonAliasPathTypeMention#9123dc7e ON FIRST 2 OUTPUT Lhs.1, Lhs.3, Lhs.2, Lhs.0
            36413   ~1%    {3}    | JOIN WITH `PathResolution::ImplOrTraitItemNode.getAssocItem/1#f77bb9ed` ON FIRST 2 OUTPUT Rhs.2, Lhs.2, Lhs.3
            36413   ~0%    {3}    | JOIN WITH cached_Type::TAssociatedTypeTypeParameter#14a276f6 ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.2
            36413   ~0%    {3}    | JOIN WITH Type::TypeParameter#f85657da ON FIRST 1 OUTPUT Lhs.2, Lhs.0, Lhs.1

            54979   ~3%    {3} r5 = r1 UNION r2 UNION r3 UNION r4
                           return r5
```

After
```
Evaluated relational algebra for predicate TypeMention::NonAliasPathTypeMention.getTypeMentionForTypeParameter/1#f0c507c8@a37ac19m with tuple counts:
          12496   ~2%    {3} r1 = SCAN `TypeMention::NonAliasPathTypeMention.getAnAssocTypeArgument/1#c61d1deb` OUTPUT In.2, In.0, In.1
          12421   ~0%    {3}    | JOIN WITH TypeMention::TypeMention#3ab935d1 ON FIRST 1 OUTPUT Lhs.1, Lhs.2, Lhs.0
          12421   ~0%    {3}    | JOIN WITH TypeMention::NonAliasPathTypeMention#9123dc7e ON FIRST 1 OUTPUT Lhs.1, Lhs.0, Lhs.2
          12421   ~0%    {3}    | JOIN WITH Type::TAssociatedTypeTypeParameter#14a276f6 ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.2
          12421   ~0%    {3}    | JOIN WITH Type::TypeParameter#f85657da ON FIRST 1 OUTPUT Lhs.1, Lhs.0, Lhs.2

              1   ~0%    {2} r2 = SCAN `Stdlib::FnOnceTrait.getTypeParam/0#dispred#93f20bbc` OUTPUT In.1, In.0
              1   ~0%    {2}    | JOIN WITH Type::TTypeParamTypeParameter#868c69a5 ON FIRST 1 OUTPUT Rhs.1, Lhs.1
              1   ~0%    {2}    | JOIN WITH Type::TypeParameter#f85657da ON FIRST 1 OUTPUT Lhs.1, Lhs.0
           3216   ~0%    {2}    | JOIN WITH TypeMention::NonAliasPathTypeMention#9123dc7e_10#join_rhs ON FIRST 1 OUTPUT Rhs.1, Lhs.1
           3216   ~0%    {3}    | JOIN WITH `Path::Generated::Path.getSegment/0#dispred#1c7ef50f` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.0
           3201   ~0%    {3}    | JOIN WITH `PathSegment::Generated::PathSegment.getParenthesizedArgList/0#dispred#cd573956` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.2
           3201   ~0%    {3}    | JOIN WITH TypeMention::TypeMention#3ab935d1 ON FIRST 1 OUTPUT Lhs.2, Lhs.1, Lhs.0

              1   ~0%    {2} r3 = SCAN `Stdlib::FnOnceTrait.getOutputType/0#0d2e9ef1` OUTPUT In.1, In.0
              1   ~0%    {2}    | JOIN WITH Type::TAssociatedTypeTypeParameter#14a276f6 ON FIRST 1 OUTPUT Rhs.1, Lhs.1
              1   ~0%    {2}    | JOIN WITH Type::TypeParameter#f85657da ON FIRST 1 OUTPUT Lhs.1, Lhs.0
           3216   ~3%    {2}    | JOIN WITH TypeMention::NonAliasPathTypeMention#9123dc7e_10#join_rhs ON FIRST 1 OUTPUT Rhs.1, Lhs.1
           3216   ~0%    {3}    | JOIN WITH `Path::Generated::Path.getSegment/0#dispred#1c7ef50f` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.0
           2958   ~0%    {3}    | JOIN WITH `PathSegment::Generated::PathSegment.getRetType/0#dispred#9d400241` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.2
           2958   ~0%    {3}    | JOIN WITH `RetTypeRepr::Generated::RetTypeRepr.getTypeRepr/0#dispred#fd85a980` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.2
           2944   ~0%    {3}    | JOIN WITH TypeMention::TypeMention#3ab935d1 ON FIRST 1 OUTPUT Lhs.2, Lhs.1, Lhs.0

          54186   ~3%    {2} r4 = JOIN `TypeAlias::Generated::TypeAlias.getTypeRepr/0#dispred#5fd7e521_10#join_rhs` WITH TypeMention::TypeMention#3ab935d1 ON FIRST 1 OUTPUT Lhs.1, Lhs.0
        1446369  ~12%    {3}    | JOIN WITH `PathResolution::ItemNode.getASuccessor/1#8f430f71_201#join_rhs` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Rhs.2
          36945   ~2%    {3}    | JOIN WITH `PathResolution::ImplItemNode.getTraitPath/0#dispred#3b7d1cb6` ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.2
          36398   ~3%    {3}    | JOIN WITH TypeMention::NonAliasPathTypeMention#9123dc7e ON FIRST 1 OUTPUT Lhs.0, Lhs.2, Lhs.1
          36413   ~1%    {3}    | JOIN WITH `TypeMention::NonAliasPathTypeMention.getResolvedAlias/1#c48b878e` ON FIRST 2 OUTPUT Rhs.2, Lhs.2, Lhs.0
          36413   ~0%    {3}    | JOIN WITH Type::TAssociatedTypeTypeParameter#14a276f6 ON FIRST 1 OUTPUT Rhs.1, Lhs.1, Lhs.2
          36413   ~0%    {3}    | JOIN WITH Type::TypeParameter#f85657da ON FIRST 1 OUTPUT Lhs.2, Lhs.0, Lhs.1

          54979   ~3%    {3} r5 = r1 UNION r2 UNION r3 UNION r4
                         return r5
```
2025-11-13 21:31:32 +01:00
Tom Hvitved
1b6b1e56ed Rust: Fix bad join
Before
```
Pipeline standard for ElementImpl::Impl::MacroExpansion::isFromMacroExpansion/1#69965d18@7580bdbj was evaluated in 205 iterations totaling 49106ms (delta sizes total: 1254645).
        8014745124  ~4%    {1} r1 = AstNodeImpl::Impl::AstNode#22e758cf AND NOT `ElementImpl::Impl::MacroExpansion::isFromMacroExpansion/1#69965d18#prev`(FIRST 1)
         822416474  ~0%    {2}    | JOIN WITH `ElementImpl::Impl::MacroExpansion::getImmediatelyEnclosingMacroInvocation/1#1eb32ecc` ON FIRST 1 OUTPUT Rhs.1, Lhs.0
           1254645  ~0%    {1}    | JOIN WITH `ElementImpl::Impl::MacroExpansion::isFromMacroExpansion/1#69965d18#prev_delta` ON FIRST 1 OUTPUT Lhs.1
                           return r1
```

After
```
Pipeline standard for ElementImpl::Impl::MacroExpansion::isFromMacroExpansion/1#69965d18@f39b84ka was evaluated in 205 iterations totaling 138ms (delta sizes total: 1254645).
        4675568  ~0%    {1} r1 = JOIN `ElementImpl::Impl::MacroExpansion::isFromMacroExpansion/1#69965d18#prev_delta` WITH `ElementImpl::Impl::MacroExpansion::getImmediatelyEnclosingMacroInvocation/1#1eb32ecc_10#join_rhs` ON FIRST 1 OUTPUT Rhs.1
        4672186  ~0%    {1}    | JOIN WITH AstNodeImpl::Impl::AstNode#22e758cf ON FIRST 1 OUTPUT Lhs.0
        1254645  ~0%    {1}    | AND NOT `ElementImpl::Impl::MacroExpansion::isFromMacroExpansion/1#69965d18#prev`(FIRST 1)
                        return r1
```
2025-11-13 15:26:01 +01:00
Tom Hvitved
bfa35629ac Merge pull request #20744 from hvitved/rust/path-resolution-unqualified-use-tree
Rust: Handle unqualified `UseTree`s in path resolution
2025-11-13 11:18:41 +01:00
Tom Hvitved
c6164b33e5 Address review comment 2025-11-13 10:47:04 +01:00
Tom Hvitved
467bd541d2 Merge pull request #20770 from hvitved/rust/attribute-macro-expansion-filter
Rust: Remove elements superseded by attribute macro expansions
2025-11-12 19:52:09 +01:00
Geoffrey White
8624f9c660 Merge pull request #20749 from github/copilot/add-secure-cookie-test-cases
Add test coverage for actix-web, poem, and http-types cookie secure attribute
2025-11-11 09:26:26 +00:00
Tom Hvitved
de367eaad6 Update rust/ql/lib/codeql/rust/elements/internal/ElementImpl.qll
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-11-10 12:42:28 +01:00
Tom Hvitved
c81f5f5190 Rust: Remove elements superseded by attribute macro expansions 2025-11-10 09:18:58 +01:00
Tom Hvitved
0bf458a56f Rust: Run codegen 2025-11-09 20:40:13 +01:00
Tom Hvitved
000f33fcbf Merge pull request #20765 from hvitved/rust/variable-if-let-guard
Rust: Handle variables introduced in if-let guards
2025-11-06 13:49:38 +01:00
Geoffrey White
b4b444de48 Merge pull request #20746 from geoffw0/mv3
Rust: Clean up some models
2025-11-06 10:07:43 +00:00
Geoffrey White
680870dbf3 Rust: Fix after merge. 2025-11-06 09:39:51 +00:00
Tom Hvitved
f8cde74eac Merge pull request #20736 from github/copilot/add-constaccess-class
Rust: Add ConstAccess class with getConst() predicate
2025-11-06 10:25:06 +01:00
Geoffrey White
1ce787a185 Merge branch 'main' into mv3 2025-11-06 09:23:01 +00:00
Tom Hvitved
c80301d58a Rust: Handle variables introduced in if-let guards 2025-11-05 19:46:54 +01:00
Geoffrey White
1e7acc5e1a Merge branch 'main' into copilot/add-secure-cookie-test-cases 2025-11-05 17:53:02 +00:00
Geoffrey White
62e77687ca Rust: Move async_std::io models. 2025-11-05 15:09:39 +00:00
Tom Hvitved
db7b187961 Rust: Add more variables tests 2025-11-05 15:32:24 +01:00
Geoffrey White
e78018769b Rust: Add the model file (missed on previous commits). 2025-11-05 12:50:26 +00:00
Geoffrey White
6e35cb9748 Rust: Change note. 2025-11-05 11:36:04 +00:00
Geoffrey White
ad24b7414e Rust: Fix for Poem cookies defaulting secure. 2025-11-05 11:32:30 +00:00
Geoffrey White
99a369228b Rust: Model poem cookie methods. 2025-11-05 11:14:40 +00:00
Michael B. Gale
046db0419f Merge pull request #20758 from github/post-release-prep/codeql-cli-2.23.4
Post-release preparation for codeql-cli-2.23.4
2025-11-05 10:45:51 +00:00
Geoffrey White
ff06181e4b Rust: We actually want barriers on set_secure(false) as well as set_secure(true), to prevent excessive flow paths. 2025-11-04 19:30:35 +00:00
Geoffrey White
5fed5a278e Rust: It turns out Poem defaults 'secure' to true. 2025-11-04 18:37:20 +00:00
Geoffrey White
7383e4ff23 Rust: Test for another edge cases supported by two of the libraries. 2025-11-04 18:25:02 +00:00
github-actions[bot]
4014df9a6e Post-release preparation for codeql-cli-2.23.4 2025-11-04 17:57:52 +00:00
Geoffrey White
21274d3d76 Rust: Add tests of poem CookieConfig. 2025-11-04 15:14:00 +00:00
Geoffrey White
e5933d0c54 Rust: Add test cases with cookie builders. 2025-11-04 15:13:31 +00:00
Geoffrey White
55cf375886 Rust: Add the cookies to jars, indicating that they're ready for use. 2025-11-04 13:10:33 +00:00
Tom Hvitved
50552da4d8 Rust: Handle unqualified UseTrees in path resolution 2025-11-04 13:57:33 +01:00
Geoffrey White
7fe4877ddd Rust: Update test annotations. 2025-11-04 12:36:56 +00:00
Geoffrey White
077bcf6b92 Merge pull request #20740 from geoffw0/rustbarriers
Rust: Add numeric type barriers for three queries
2025-11-04 10:08:46 +00:00
copilot-swe-agent[bot]
ee3d57ef3c Update test cases with correct APIs and run CodeQL test
Co-authored-by: geoffw0 <40627776+geoffw0@users.noreply.github.com>
2025-11-03 17:38:25 +00:00
copilot-swe-agent[bot]
8f02ab107c Add test cases for actix-web, poem, and http-types cookie secure attribute
Co-authored-by: geoffw0 <40627776+geoffw0@users.noreply.github.com>
2025-11-03 17:16:04 +00:00
Geoffrey White
56e98c45ec Rust: Accept trivial changes to test .expected files. 2025-11-03 17:08:22 +00:00
Geoffrey White
687cc6f544 Rust: Re-arrange models slightly. 2025-11-03 14:54:13 +00:00
github-actions[bot]
64fcdd1f2f Release preparation for version 2.23.4 2025-11-03 14:52:23 +00:00
Geoffrey White
5af83787d8 Rust: Move a few more models. 2025-11-03 13:35:27 +00:00
Geoffrey White
144fa7dd39 Rust: Deduplicate some models. 2025-11-03 13:33:37 +00:00
Geoffrey White
8a2c117a0e Rust: Move models between core.model.yml and alloc.model.yml. 2025-11-03 13:31:25 +00:00
Geoffrey White
1b435ed07d Rust: Move another model file into subdirectory. 2025-11-03 13:26:37 +00:00
Geoffrey White
4b3a1c5abb Rust: Move a model file into subdirectory. 2025-11-03 13:24:28 +00:00