File tree Expand file tree Collapse file tree 2 files changed +5
-9
lines changed
lib/codeql/rust/controlflow/internal
test/library-tests/controlflow Expand file tree Collapse file tree 2 files changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -36,13 +36,7 @@ class SimpleCompletion extends NormalCompletion, TSimpleCompletion {
36
36
37
37
// `SimpleCompletion` is the "default" completion type, thus it is valid for
38
38
// any node where there isn't another more specific completion type.
39
- override predicate isValidFor ( AstNode e ) {
40
- not any ( Completion c ) .isValidForSpecific ( e )
41
- or
42
- // A `?` expression can both proceed normally or cause an early return, so
43
- // we explicitly allow the former here.
44
- e instanceof TryExpr
45
- }
39
+ override predicate isValidFor ( AstNode e ) { not any ( Completion c ) .isValidForSpecific ( e ) }
46
40
47
41
override string toString ( ) { result = "simple" }
48
42
}
@@ -177,6 +171,8 @@ class MatchCompletion extends TMatchCompletion, ConditionalCompletion {
177
171
override predicate isValidForSpecific ( AstNode e ) {
178
172
e instanceof Pat and
179
173
if isExhaustiveMatch ( e ) then value = true else any ( )
174
+ or
175
+ e instanceof TryExpr and value = true
180
176
}
181
177
182
178
override MatchSuccessor getAMatchingSuccessorType ( ) { result .getValue ( ) = value }
Original file line number Diff line number Diff line change @@ -575,7 +575,7 @@ edges
575
575
| test.rs:263:9:263:11 | PathExpr | test.rs:263:9:263:26 | MethodCallExpr | |
576
576
| test.rs:263:9:263:26 | MethodCallExpr | test.rs:263:9:263:27 | TryExpr | |
577
577
| test.rs:263:9:263:27 | TryExpr | test.rs:262:5:264:5 | exit test_question_mark_operator_1 (normal) | return |
578
- | test.rs:263:9:263:27 | TryExpr | test.rs:263:31:263:31 | 4 | |
578
+ | test.rs:263:9:263:27 | TryExpr | test.rs:263:31:263:31 | 4 | match |
579
579
| test.rs:263:9:263:31 | ... + ... | test.rs:262:62:264:5 | BlockExpr | |
580
580
| test.rs:263:31:263:31 | 4 | test.rs:263:9:263:31 | ... + ... | |
581
581
| test.rs:266:5:271:5 | enter test_question_mark_operator_2 | test.rs:266:38:266:38 | b | |
@@ -586,7 +586,7 @@ edges
586
586
| test.rs:267:9:270:9 | MatchExpr | test.rs:266:71:271:5 | BlockExpr | |
587
587
| test.rs:267:15:267:15 | b | test.rs:267:15:267:16 | TryExpr | |
588
588
| test.rs:267:15:267:16 | TryExpr | test.rs:266:5:271:5 | exit test_question_mark_operator_2 (normal) | return |
589
- | test.rs:267:15:267:16 | TryExpr | test.rs:268:13:268:16 | LiteralPat | |
589
+ | test.rs:267:15:267:16 | TryExpr | test.rs:268:13:268:16 | LiteralPat | match |
590
590
| test.rs:268:13:268:16 | LiteralPat | test.rs:268:21:268:24 | PathExpr | match |
591
591
| test.rs:268:13:268:16 | LiteralPat | test.rs:269:13:269:17 | LiteralPat | no-match |
592
592
| test.rs:268:21:268:24 | PathExpr | test.rs:268:26:268:30 | false | |
You can’t perform that action at this time.
0 commit comments