Rust: add ForBinder case in ClosureExpr and accept test changes

This commit is contained in:
Paolo Tranquilli
2025-08-12 17:29:11 +02:00
parent fbc81cbb18
commit 92e94695e7
14 changed files with 66 additions and 38 deletions

View File

@@ -36,7 +36,7 @@ lib/codeql/rust/elements/CallExpr.qll f336500ca7a611b164d48b90e80edb0c0d3816792b
lib/codeql/rust/elements/CallExprBase.qll 2846202b5208b541977500286951d96487bf555838c6c16cdd006a71e383745a c789d412bf099c624329379e0c7d94fa0d23ae2edea7a25a2ea0f3c0042ccf62
lib/codeql/rust/elements/Callable.qll 0f7f78c3bfabbe24962f6232b0440d27e51f06d2b8d341fc623ffbfbff173f47 5fd13aaa0eaf76ea0b47fa0641bd23eea20a069f0b3cbc1ee4e290e88321008a
lib/codeql/rust/elements/CastExpr.qll 2fe1f36ba31fa29de309baf0a665cfcae67b61c73345e8f9bbd41e8c235fec45 c5b4c1e9dc24eb2357799defcb2df25989075e3a80e8663b74204a1c1b70e29a
lib/codeql/rust/elements/ClosureExpr.qll d122c769abc6c832dd1ad1b55d00aabc2f9029dd786f30905ac019e9e18517c0 56288c841c5e88cb603acb0d078ddeab8166f435b9545598293c0a59e9e84457
lib/codeql/rust/elements/ClosureExpr.qll 69e0b7a7c7a4c348fcada5ad4da22dd2f51747109f856be239cede315a56d695 93400650282e2d4e682b826e9f5f844aa893dda126548e41ea1c703d2bf209ca
lib/codeql/rust/elements/Comment.qll fedad50575125e9a64a8a8776a8c1dbf1e76df990f01849d9f0955f9d74cb2a6 8eb1afad1e1007a4f0090fdac65d81726b23eda6517d067fd0185f70f17635ab
lib/codeql/rust/elements/Const.qll 5f4d11e01162a06127ba56519efd66d1ecfb5de7c1792fc1c283a56cf2127373 8c618ac774267d25db70cc05a080f8a408dc23ab7e88c0fc543eda8b4d4cb995
lib/codeql/rust/elements/ConstArg.qll 01865b3be4790c627a062c59ea608462931abcb2f94a132cf265318664fd1251 a2c6bbf63dbfa999e511b6941143a51c9392477d8ccd25e081f85475936ff558
@@ -492,7 +492,7 @@ lib/codeql/rust/elements/internal/generated/CallExpr.qll f1b8dae487077cc9d1dccf8
lib/codeql/rust/elements/internal/generated/CallExprBase.qll 2268e01d65015014c05166161bb28e5a1e78164d525ca16fc1e3106866cf231d b2f9b912153ba4d3e3612df4f74ac0e83077c31d5b31383bd277974081417a56
lib/codeql/rust/elements/internal/generated/Callable.qll 9a8661aa018fd90a21529760c1dbc46c1ad3649e17b030e59ced0683fbf83f8a 8b573adfc23ec0ac91949da415e6a0c988fa02cbce9534d45ac98a5512d7b1ca
lib/codeql/rust/elements/internal/generated/CastExpr.qll ddc20054b0b339ad4d40298f3461490d25d00af87c876da5ffbc6a11c0832295 f4247307afcd74d80e926f29f8c57e78c50800984483e6b6003a44681e4a71f3
lib/codeql/rust/elements/internal/generated/ClosureExpr.qll d5deef5d257b313e3fa3ad292c8af26db32f45446dc88009515435344aed1efc eb8d0394255e7dc005ef5c729ae851b78b4a0d838c3ac2460b4e715bbdb5e97f
lib/codeql/rust/elements/internal/generated/ClosureExpr.qll 1f77ea8ec01366f8027fa36793f7de5a74f562a1af1bf6954410e68670e6f68a bd61457093dcfc3985e6e526d4582299f29421bc7d3e9818e530152ac8ad8bed
lib/codeql/rust/elements/internal/generated/Comment.qll cd1ef861e3803618f9f78a4ac00516d50ecfecdca1c1d14304dc5327cbe07a3b 8b67345aeb15beb5895212228761ea3496297846c93fd2127b417406ae87c201
lib/codeql/rust/elements/internal/generated/Const.qll 3e606f0198b6461a94964dba7a4d386408f01651d75378eeab251dfceccf49c8 20fe276cded4764bdb1cd50de956bea88d7cd731909c0b84b4abb972b3094959
lib/codeql/rust/elements/internal/generated/ConstArg.qll c52bf746f2dc89b8d71b8419736707bfcbb09cca424c3ba76e888e2add415bf6 89309a9df4fde23cfd3d8492908ccec4d90cc8457d35c507ef81371a369941b4
@@ -590,7 +590,7 @@ lib/codeql/rust/elements/internal/generated/PtrTypeRepr.qll 8d0ea4f6c7f8203340bf
lib/codeql/rust/elements/internal/generated/PureSynthConstructors.qll e5b8e69519012bbaae29dcb82d53f7f7ecce368c0358ec27ef6180b228a0057f e5b8e69519012bbaae29dcb82d53f7f7ecce368c0358ec27ef6180b228a0057f
lib/codeql/rust/elements/internal/generated/RangeExpr.qll 23cca03bf43535f33b22a38894f70d669787be4e4f5b8fe5c8f7b964d30e9027 18624cef6c6b679eeace2a98737e472432e0ead354cca02192b4d45330f047c9
lib/codeql/rust/elements/internal/generated/RangePat.qll 80826a6a6868a803aa2372e31c52a03e1811a3f1f2abdb469f91ca0bfdd9ecb6 34ee1e208c1690cba505dff2c588837c0cd91e185e2a87d1fe673191962276a9
lib/codeql/rust/elements/internal/generated/Raw.qll 3c38cd761b847ba5744810479901692fe1a28759d8305f828ff535c034f21f97 56f75a0589112d66f234c99b0c3798ed928b3a808ebb7d37590cf5868aad9c10
lib/codeql/rust/elements/internal/generated/Raw.qll 5de291e604fbeb5a4536eeb2a417f95b227a600bb589f7aab075971cd1cbfc67 22e5b41fba360781f354edb72dbc8f53b9d7434c30d3e3bac4c22f1faa72b8ed
lib/codeql/rust/elements/internal/generated/RefExpr.qll 7d995884e3dc1c25fc719f5d7253179344d63650e217e9ff6530285fe7a57f64 f2c3c12551deea4964b66553fb9b6423ee16fec53bd63db4796191aa60dc6c66
lib/codeql/rust/elements/internal/generated/RefPat.qll 456ede39837463ee22a630ec7ab6c8630d3664a8ea206fcc6e4f199e92fa564c 5622062765f32930465ba6b170e986706f159f6070f48adee3c20e24e8df4e05
lib/codeql/rust/elements/internal/generated/RefTypeRepr.qll 5b0663a6d234572fb3e467e276d019415caa95ef006438cc59b7af4e1783161e 0e27c8a8f0e323c0e4d6db01fca821bf07c0864d293cdf96fa891b10820c1e4b

View File

@@ -19,6 +19,9 @@ import codeql.rust.elements.RetTypeRepr
* |x| yield x;
* #[coroutine]
* static |x| yield x;
* for<T: std::fmt::Debug> |x: T| {
* println!("{:?}", x);
* };
* ```
*/
final class ClosureExpr = Impl::ClosureExpr;

View File

@@ -22,6 +22,9 @@ module Impl {
* |x| yield x;
* #[coroutine]
* static |x| yield x;
* for<T: std::fmt::Debug> |x: T| {
* println!("{:?}", x);
* };
* ```
*/
class ClosureExpr extends Generated::ClosureExpr {

View File

@@ -27,6 +27,9 @@ module Generated {
* |x| yield x;
* #[coroutine]
* static |x| yield x;
* for<T: std::fmt::Debug> |x: T| {
* println!("{:?}", x);
* };
* ```
* INTERNAL: Do not reference the `Generated::ClosureExpr` class directly.
* Use the subclass `ClosureExpr`, where the following predicates are available.

View File

@@ -1906,6 +1906,9 @@ module Raw {
* |x| yield x;
* #[coroutine]
* static |x| yield x;
* for<T: std::fmt::Debug> |x: T| {
* println!("{:?}", x);
* };
* ```
*/
class ClosureExpr extends @closure_expr, Expr, Callable {

View File

@@ -25,7 +25,7 @@ BoxPat/gen_box_pat.rs 1493e24b732370b577ade38c47db17fa157df19f5390606a67a6040e49
BreakExpr/gen_break_expr.rs aacdf9df7fc51d19742b9e813835c0bd0913017e8d62765960e06b27d58b9031 aacdf9df7fc51d19742b9e813835c0bd0913017e8d62765960e06b27d58b9031
CallExpr/gen_call_expr.rs 013a7c878996aefb25b94b68eebc4f0b1bb74ccd09e91c491980817a383e2401 013a7c878996aefb25b94b68eebc4f0b1bb74ccd09e91c491980817a383e2401
CastExpr/gen_cast_expr.rs c3892211fbae4fed7cb1f25ff1679fd79d2878bf0bf2bd4b7982af23d00129f5 c3892211fbae4fed7cb1f25ff1679fd79d2878bf0bf2bd4b7982af23d00129f5
ClosureExpr/gen_closure_expr.rs 15bd9abdb8aaffabb8bb335f8ebd0571eb5f29115e1dc8d11837aa988702cd80 15bd9abdb8aaffabb8bb335f8ebd0571eb5f29115e1dc8d11837aa988702cd80
ClosureExpr/gen_closure_expr.rs bd95408103b7f2084e526e6d35cf3319b2e9d7219aff4c80e4e6691180c549b4 bd95408103b7f2084e526e6d35cf3319b2e9d7219aff4c80e4e6691180c549b4
Comment/gen_comment.rs 1e1f9f43161a79c096c2056e8b7f5346385ab7addcdec68c2d53b383dd3debe6 1e1f9f43161a79c096c2056e8b7f5346385ab7addcdec68c2d53b383dd3debe6
Const/gen_const.rs a3b971134a4204d0da12563fcefa9ab72f3f2f2e957e82b70c8548b5807f375f a3b971134a4204d0da12563fcefa9ab72f3f2f2e957e82b70c8548b5807f375f
ConstArg/gen_const_arg.rs 6a15d099c61ffa814e8e0e0fca2d8ff481d73ad81959064e0a214d3172a9d49e 6a15d099c61ffa814e8e0e0fca2d8ff481d73ad81959064e0a214d3172a9d49e

View File

@@ -1,5 +1,8 @@
instances
| gen_asm_expr.rs:6:9:7:59 | AsmExpr |
getExtendedCanonicalPath
getCrateOrigin
getAttributeMacroExpansion
getAsmPiece
| gen_asm_expr.rs:6:9:7:59 | AsmExpr | 0 | gen_asm_expr.rs:7:39:7:47 | AsmOperandNamed |
| gen_asm_expr.rs:6:9:7:59 | AsmExpr | 1 | gen_asm_expr.rs:7:50:7:58 | AsmOperandNamed |

View File

@@ -2,30 +2,35 @@ instances
| gen_closure_expr.rs:5:5:5:13 | \|...\| ... | isAsync: | no | isConst: | no | isGen: | no | isMove: | no | isStatic: | no |
| gen_closure_expr.rs:6:5:6:34 | \|...\| ... | isAsync: | no | isConst: | no | isGen: | no | isMove: | yes | isStatic: | no |
| gen_closure_expr.rs:7:5:7:27 | \|...\| ... | isAsync: | yes | isConst: | no | isGen: | no | isMove: | no | isStatic: | no |
| gen_closure_expr.rs:8:6:9:15 | \|...\| ... | isAsync: | no | isConst: | no | isGen: | no | isMove: | no | isStatic: | no |
| gen_closure_expr.rs:10:6:11:23 | \|...\| ... | isAsync: | no | isConst: | no | isGen: | no | isMove: | no | isStatic: | yes |
| gen_closure_expr.rs:8:5:9:15 | \|...\| ... | isAsync: | no | isConst: | no | isGen: | no | isMove: | no | isStatic: | no |
| gen_closure_expr.rs:10:5:11:22 | \|...\| ... | isAsync: | no | isConst: | no | isGen: | no | isMove: | no | isStatic: | yes |
| gen_closure_expr.rs:12:5:14:5 | \|...\| ... | isAsync: | no | isConst: | no | isGen: | no | isMove: | no | isStatic: | no |
getParamList
| gen_closure_expr.rs:5:5:5:13 | \|...\| ... | gen_closure_expr.rs:5:5:5:7 | ParamList |
| gen_closure_expr.rs:6:5:6:34 | \|...\| ... | gen_closure_expr.rs:6:10:6:17 | ParamList |
| gen_closure_expr.rs:7:5:7:27 | \|...\| ... | gen_closure_expr.rs:7:11:7:21 | ParamList |
| gen_closure_expr.rs:8:6:9:15 | \|...\| ... | gen_closure_expr.rs:9:5:9:7 | ParamList |
| gen_closure_expr.rs:10:6:11:23 | \|...\| ... | gen_closure_expr.rs:11:13:11:15 | ParamList |
| gen_closure_expr.rs:8:5:9:15 | \|...\| ... | gen_closure_expr.rs:9:5:9:7 | ParamList |
| gen_closure_expr.rs:10:5:11:22 | \|...\| ... | gen_closure_expr.rs:11:12:11:14 | ParamList |
| gen_closure_expr.rs:12:5:14:5 | \|...\| ... | gen_closure_expr.rs:12:29:12:34 | ParamList |
getAttr
| gen_closure_expr.rs:8:6:9:15 | \|...\| ... | 0 | gen_closure_expr.rs:8:6:8:17 | Attr |
| gen_closure_expr.rs:10:6:11:23 | \|...\| ... | 0 | gen_closure_expr.rs:10:6:10:17 | Attr |
| gen_closure_expr.rs:8:5:9:15 | \|...\| ... | 0 | gen_closure_expr.rs:8:5:8:16 | Attr |
| gen_closure_expr.rs:10:5:11:22 | \|...\| ... | 0 | gen_closure_expr.rs:10:5:10:16 | Attr |
getParam
| gen_closure_expr.rs:5:5:5:13 | \|...\| ... | 0 | gen_closure_expr.rs:5:6:5:6 | ... |
| gen_closure_expr.rs:6:5:6:34 | \|...\| ... | 0 | gen_closure_expr.rs:6:11:6:16 | ...: i32 |
| gen_closure_expr.rs:7:5:7:27 | \|...\| ... | 0 | gen_closure_expr.rs:7:12:7:17 | ...: i32 |
| gen_closure_expr.rs:7:5:7:27 | \|...\| ... | 1 | gen_closure_expr.rs:7:20:7:20 | ... |
| gen_closure_expr.rs:8:6:9:15 | \|...\| ... | 0 | gen_closure_expr.rs:9:6:9:6 | ... |
| gen_closure_expr.rs:10:6:11:23 | \|...\| ... | 0 | gen_closure_expr.rs:11:14:11:14 | ... |
| gen_closure_expr.rs:8:5:9:15 | \|...\| ... | 0 | gen_closure_expr.rs:9:6:9:6 | ... |
| gen_closure_expr.rs:10:5:11:22 | \|...\| ... | 0 | gen_closure_expr.rs:11:13:11:13 | ... |
| gen_closure_expr.rs:12:5:14:5 | \|...\| ... | 0 | gen_closure_expr.rs:12:30:12:33 | ...: T |
getBody
| gen_closure_expr.rs:5:5:5:13 | \|...\| ... | gen_closure_expr.rs:5:9:5:13 | ... + ... |
| gen_closure_expr.rs:6:5:6:34 | \|...\| ... | gen_closure_expr.rs:6:26:6:34 | { ... } |
| gen_closure_expr.rs:7:5:7:27 | \|...\| ... | gen_closure_expr.rs:7:23:7:27 | ... + ... |
| gen_closure_expr.rs:8:6:9:15 | \|...\| ... | gen_closure_expr.rs:9:9:9:15 | YieldExpr |
| gen_closure_expr.rs:10:6:11:23 | \|...\| ... | gen_closure_expr.rs:11:17:11:23 | YieldExpr |
getClosureBinder
| gen_closure_expr.rs:8:5:9:15 | \|...\| ... | gen_closure_expr.rs:9:9:9:15 | YieldExpr |
| gen_closure_expr.rs:10:5:11:22 | \|...\| ... | gen_closure_expr.rs:11:16:11:22 | YieldExpr |
| gen_closure_expr.rs:12:5:14:5 | \|...\| ... | gen_closure_expr.rs:12:36:14:5 | { ... } |
getForBinder
| gen_closure_expr.rs:12:5:14:5 | \|...\| ... | gen_closure_expr.rs:12:5:12:27 | ForBinder |
getRetType
| gen_closure_expr.rs:6:5:6:34 | \|...\| ... | gen_closure_expr.rs:6:19:6:24 | RetTypeRepr |

View File

@@ -9,4 +9,7 @@ fn test_closure_expr() -> () {
|x| yield x;
#[coroutine]
static |x| yield x;
for<T: std::fmt::Debug> |x: T| {
println!("{:?}", x);
};
}

View File

@@ -0,0 +1,4 @@
instances
| gen_for_binder.rs:7:21:7:43 | ForBinder |
getGenericParamList
| gen_for_binder.rs:7:21:7:43 | ForBinder | gen_for_binder.rs:7:24:7:43 | <...> |

View File

@@ -1,6 +1,3 @@
instances
| gen_for_type_repr.rs:9:12:9:41 | ForTypeRepr |
getGenericParamList
| gen_for_type_repr.rs:9:12:9:41 | ForTypeRepr | gen_for_type_repr.rs:9:15:9:18 | <...> |
getForBinder
getTypeRepr
| gen_for_type_repr.rs:9:12:9:41 | ForTypeRepr | gen_for_type_repr.rs:9:20:9:41 | Fn |

View File

@@ -1,5 +1,6 @@
instances
| gen_type_bound.rs:7:15:7:19 | TypeBound | isAsync: | no | isConst: | no |
getForBinder
getLifetime
getTypeRepr
| gen_type_bound.rs:7:15:7:19 | TypeBound | gen_type_bound.rs:7:15:7:19 | Debug |

View File

@@ -1,7 +1,7 @@
instances
| gen_where_pred.rs:7:36:7:43 | WherePred |
| gen_where_pred.rs:7:46:7:53 | WherePred |
getGenericParamList
getForBinder
getLifetime
getTypeRepr
| gen_where_pred.rs:7:36:7:43 | WherePred | gen_where_pred.rs:7:36:7:36 | T |

View File

@@ -551,6 +551,9 @@ class _:
|x| yield x;
#[coroutine]
static |x| yield x;
for<T: std::fmt::Debug> |x: T| {
println!("{:?}", x);
};
```
"""