Skip to content

Commit 92e9469

Browse files
committed
Rust: add ForBinder case in ClosureExpr and accept test changes
1 parent fbc81cb commit 92e9469

File tree

14 files changed

+66
-38
lines changed

14 files changed

+66
-38
lines changed

rust/ql/.generated.list

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/ql/lib/codeql/rust/elements/ClosureExpr.qll

Lines changed: 6 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/ql/lib/codeql/rust/elements/internal/ClosureExprImpl.qll

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,13 @@ module Impl {
1818
* |x| x + 1;
1919
* move |x: i32| -> i32 { x + 1 };
2020
* async |x: i32, y| x + y;
21-
* #[coroutine]
21+
* #[coroutine]
2222
* |x| yield x;
23-
* #[coroutine]
24-
* static |x| yield x;
23+
* #[coroutine]
24+
* static |x| yield x;
25+
* for<T: std::fmt::Debug> |x: T| {
26+
* println!("{:?}", x);
27+
* };
2528
* ```
2629
*/
2730
class ClosureExpr extends Generated::ClosureExpr {

rust/ql/lib/codeql/rust/elements/internal/generated/ClosureExpr.qll

Lines changed: 6 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/ql/lib/codeql/rust/elements/internal/generated/Raw.qll

Lines changed: 6 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/ql/test/extractor-tests/generated/.generated_tests.list

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rust/ql/test/extractor-tests/generated/AsmExpr/AsmExpr.expected

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
instances
22
| gen_asm_expr.rs:6:9:7:59 | AsmExpr |
3+
getExtendedCanonicalPath
4+
getCrateOrigin
5+
getAttributeMacroExpansion
36
getAsmPiece
47
| gen_asm_expr.rs:6:9:7:59 | AsmExpr | 0 | gen_asm_expr.rs:7:39:7:47 | AsmOperandNamed |
58
| gen_asm_expr.rs:6:9:7:59 | AsmExpr | 1 | gen_asm_expr.rs:7:50:7:58 | AsmOperandNamed |

rust/ql/test/extractor-tests/generated/ClosureExpr/ClosureExpr.expected

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,35 @@ instances
22
| gen_closure_expr.rs:5:5:5:13 | \|...\| ... | isAsync: | no | isConst: | no | isGen: | no | isMove: | no | isStatic: | no |
33
| gen_closure_expr.rs:6:5:6:34 | \|...\| ... | isAsync: | no | isConst: | no | isGen: | no | isMove: | yes | isStatic: | no |
44
| gen_closure_expr.rs:7:5:7:27 | \|...\| ... | isAsync: | yes | isConst: | no | isGen: | no | isMove: | no | isStatic: | no |
5-
| gen_closure_expr.rs:8:6:9:15 | \|...\| ... | isAsync: | no | isConst: | no | isGen: | no | isMove: | no | isStatic: | no |
6-
| gen_closure_expr.rs:10:6:11:23 | \|...\| ... | isAsync: | no | isConst: | no | isGen: | no | isMove: | no | isStatic: | yes |
5+
| gen_closure_expr.rs:8:5:9:15 | \|...\| ... | isAsync: | no | isConst: | no | isGen: | no | isMove: | no | isStatic: | no |
6+
| gen_closure_expr.rs:10:5:11:22 | \|...\| ... | isAsync: | no | isConst: | no | isGen: | no | isMove: | no | isStatic: | yes |
7+
| gen_closure_expr.rs:12:5:14:5 | \|...\| ... | isAsync: | no | isConst: | no | isGen: | no | isMove: | no | isStatic: | no |
78
getParamList
89
| gen_closure_expr.rs:5:5:5:13 | \|...\| ... | gen_closure_expr.rs:5:5:5:7 | ParamList |
910
| gen_closure_expr.rs:6:5:6:34 | \|...\| ... | gen_closure_expr.rs:6:10:6:17 | ParamList |
1011
| gen_closure_expr.rs:7:5:7:27 | \|...\| ... | gen_closure_expr.rs:7:11:7:21 | ParamList |
11-
| gen_closure_expr.rs:8:6:9:15 | \|...\| ... | gen_closure_expr.rs:9:5:9:7 | ParamList |
12-
| gen_closure_expr.rs:10:6:11:23 | \|...\| ... | gen_closure_expr.rs:11:13:11:15 | ParamList |
12+
| gen_closure_expr.rs:8:5:9:15 | \|...\| ... | gen_closure_expr.rs:9:5:9:7 | ParamList |
13+
| gen_closure_expr.rs:10:5:11:22 | \|...\| ... | gen_closure_expr.rs:11:12:11:14 | ParamList |
14+
| gen_closure_expr.rs:12:5:14:5 | \|...\| ... | gen_closure_expr.rs:12:29:12:34 | ParamList |
1315
getAttr
14-
| gen_closure_expr.rs:8:6:9:15 | \|...\| ... | 0 | gen_closure_expr.rs:8:6:8:17 | Attr |
15-
| gen_closure_expr.rs:10:6:11:23 | \|...\| ... | 0 | gen_closure_expr.rs:10:6:10:17 | Attr |
16+
| gen_closure_expr.rs:8:5:9:15 | \|...\| ... | 0 | gen_closure_expr.rs:8:5:8:16 | Attr |
17+
| gen_closure_expr.rs:10:5:11:22 | \|...\| ... | 0 | gen_closure_expr.rs:10:5:10:16 | Attr |
1618
getParam
1719
| gen_closure_expr.rs:5:5:5:13 | \|...\| ... | 0 | gen_closure_expr.rs:5:6:5:6 | ... |
1820
| gen_closure_expr.rs:6:5:6:34 | \|...\| ... | 0 | gen_closure_expr.rs:6:11:6:16 | ...: i32 |
1921
| gen_closure_expr.rs:7:5:7:27 | \|...\| ... | 0 | gen_closure_expr.rs:7:12:7:17 | ...: i32 |
2022
| gen_closure_expr.rs:7:5:7:27 | \|...\| ... | 1 | gen_closure_expr.rs:7:20:7:20 | ... |
21-
| gen_closure_expr.rs:8:6:9:15 | \|...\| ... | 0 | gen_closure_expr.rs:9:6:9:6 | ... |
22-
| gen_closure_expr.rs:10:6:11:23 | \|...\| ... | 0 | gen_closure_expr.rs:11:14:11:14 | ... |
23+
| gen_closure_expr.rs:8:5:9:15 | \|...\| ... | 0 | gen_closure_expr.rs:9:6:9:6 | ... |
24+
| gen_closure_expr.rs:10:5:11:22 | \|...\| ... | 0 | gen_closure_expr.rs:11:13:11:13 | ... |
25+
| gen_closure_expr.rs:12:5:14:5 | \|...\| ... | 0 | gen_closure_expr.rs:12:30:12:33 | ...: T |
2326
getBody
2427
| gen_closure_expr.rs:5:5:5:13 | \|...\| ... | gen_closure_expr.rs:5:9:5:13 | ... + ... |
2528
| gen_closure_expr.rs:6:5:6:34 | \|...\| ... | gen_closure_expr.rs:6:26:6:34 | { ... } |
2629
| gen_closure_expr.rs:7:5:7:27 | \|...\| ... | gen_closure_expr.rs:7:23:7:27 | ... + ... |
27-
| gen_closure_expr.rs:8:6:9:15 | \|...\| ... | gen_closure_expr.rs:9:9:9:15 | YieldExpr |
28-
| gen_closure_expr.rs:10:6:11:23 | \|...\| ... | gen_closure_expr.rs:11:17:11:23 | YieldExpr |
29-
getClosureBinder
30+
| gen_closure_expr.rs:8:5:9:15 | \|...\| ... | gen_closure_expr.rs:9:9:9:15 | YieldExpr |
31+
| gen_closure_expr.rs:10:5:11:22 | \|...\| ... | gen_closure_expr.rs:11:16:11:22 | YieldExpr |
32+
| gen_closure_expr.rs:12:5:14:5 | \|...\| ... | gen_closure_expr.rs:12:36:14:5 | { ... } |
33+
getForBinder
34+
| gen_closure_expr.rs:12:5:14:5 | \|...\| ... | gen_closure_expr.rs:12:5:12:27 | ForBinder |
3035
getRetType
3136
| gen_closure_expr.rs:6:5:6:34 | \|...\| ... | gen_closure_expr.rs:6:19:6:24 | RetTypeRepr |

rust/ql/test/extractor-tests/generated/ClosureExpr/gen_closure_expr.rs

Lines changed: 6 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
instances
2+
| gen_for_binder.rs:7:21:7:43 | ForBinder |
3+
getGenericParamList
4+
| gen_for_binder.rs:7:21:7:43 | ForBinder | gen_for_binder.rs:7:24:7:43 | <...> |

0 commit comments

Comments
 (0)