@@ -11,6 +11,20 @@ private import codeql.rust.dataflow.FlowSummary
1111private import codeql.rust.dataflow.Ssa
1212private import Content
1313
14+ predicate encodeContentTupleField ( TupleFieldContent c , string arg ) {
15+ exists ( Addressable a , int pos , string prefix |
16+ arg = prefix + "(" + pos + ")" and prefix = a .getCanonicalPath ( )
17+ |
18+ c .isStructField ( a , pos ) or c .isVariantField ( a , pos )
19+ )
20+ }
21+
22+ predicate encodeContentStructField ( StructFieldContent c , string arg ) {
23+ exists ( Addressable a , string field | arg = a .getCanonicalPath ( ) + "::" + field |
24+ c .isStructField ( a , field ) or c .isVariantField ( a , field )
25+ )
26+ }
27+
1428module Input implements InputSig< Location , RustDataFlow > {
1529 private import codeql.rust.elements.internal.CallExprBaseImpl:: Impl as CallExprBaseImpl
1630 private import codeql.rust.frameworks.stdlib.Stdlib
@@ -61,24 +75,11 @@ module Input implements InputSig<Location, RustDataFlow> {
6175 exists ( Content c | cs = TSingletonContentSet ( c ) |
6276 result = "Field" and
6377 (
64- exists ( Addressable a , int pos , string prefix |
65- arg = prefix + "(" + pos + ")" and prefix = a .getCanonicalPath ( )
66- |
67- c .( TupleFieldContent ) .isStructField ( a , pos )
68- or
69- c .( TupleFieldContent ) .isVariantField ( a , pos )
70- )
78+ encodeContentTupleField ( c , arg )
7179 or
72- exists ( Addressable a , string field | arg = a .getCanonicalPath ( ) + "::" + field |
73- c .( StructFieldContent ) .isStructField ( a , field )
74- or
75- c .( StructFieldContent ) .isVariantField ( a , field )
76- )
80+ encodeContentStructField ( c , arg )
7781 or
78- exists ( int pos |
79- c = TTuplePositionContent ( pos ) and
80- arg = pos .toString ( )
81- )
82+ exists ( int pos | c = TTuplePositionContent ( pos ) and arg = pos .toString ( ) )
8283 )
8384 or
8485 result = "Reference" and
0 commit comments