@@ -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.frameworks.stdlib.Stdlib
1630
@@ -58,24 +72,11 @@ module Input implements InputSig<Location, RustDataFlow> {
5872 exists ( Content c | cs = TSingletonContentSet ( c ) |
5973 result = "Field" and
6074 (
61- exists ( Addressable a , int pos , string prefix |
62- arg = prefix + "(" + pos + ")" and prefix = a .getCanonicalPath ( )
63- |
64- c .( TupleFieldContent ) .isStructField ( a , pos )
65- or
66- c .( TupleFieldContent ) .isVariantField ( a , pos )
67- )
75+ encodeContentTupleField ( c , arg )
6876 or
69- exists ( Addressable a , string field | arg = a .getCanonicalPath ( ) + "::" + field |
70- c .( StructFieldContent ) .isStructField ( a , field )
71- or
72- c .( StructFieldContent ) .isVariantField ( a , field )
73- )
77+ encodeContentStructField ( c , arg )
7478 or
75- exists ( int pos |
76- c = TTuplePositionContent ( pos ) and
77- arg = pos .toString ( )
78- )
79+ exists ( int pos | c = TTuplePositionContent ( pos ) and arg = pos .toString ( ) )
7980 )
8081 or
8182 result = "Reference" and
0 commit comments