@@ -1205,8 +1205,8 @@ private module Debug {
12051205 private Locatable getRelevantLocatable ( ) {
12061206 exists ( string filepath , int startline , int startcolumn , int endline , int endcolumn |
12071207 result .getLocation ( ) .hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn ) and
1208- filepath .matches ( "%/test_logging .rs" ) and
1209- startline = 163
1208+ filepath .matches ( "%/test .rs" ) and
1209+ startline = 29
12101210 )
12111211 }
12121212
@@ -1243,3 +1243,59 @@ private module Debug {
12431243 fileImport ( m , f )
12441244 }
12451245}
1246+
1247+ private predicate sdfs ( ImplItemNode impl ) {
1248+ // resolvePath(impl.getSelfPath()).getLocation().getStartLine() = [35, 36]
1249+ impl .getLocation ( ) .getFile ( ) .getBaseName ( ) = "main.rs" //and
1250+ // impl.getLocation().getStartLine() = [35 .. 38]
1251+ }
1252+
1253+ private import Type
1254+ private import TypeInference
1255+
1256+ private predicate sdf3 (
1257+ AstNode n , Type t , ImplItemNode impl , string path , RelevantPath p , ImplOrTraitItemNode i ,
1258+ TraitType tt , Function f , string name
1259+ ) {
1260+ t = inferType ( n ) and
1261+ n .getLocation ( ) .getStartLine ( ) = 29 and
1262+ t = TStruct ( impl .resolveSelfTy ( ) ) and
1263+ // t = debugInferType(_, _) and
1264+ impl .toString ( ) = "impl ...::Iterator for ...::Args { ... }" and
1265+ path = p .toStringDebug ( ) and
1266+ p = impl .getTraitPath ( ) .getQualifier * ( ) and
1267+ i = resolvePath ( p ) and
1268+ impl .isFullyParametric ( ) and
1269+ tt = TTrait ( i ) and
1270+ f = tt .getMethod ( name ) and
1271+ f = i .getAnAssocItem ( ) and
1272+ name = "collect" and
1273+ f = impl .resolveSelfTy ( ) .getASuccessor ( name )
1274+ }
1275+
1276+ private predicate sdf4 (
1277+ ImplItemNode impl , string path , RelevantPath p , ItemNode iter , Use u , string usePath ,
1278+ RelevantPath usePathPrefix , ItemNode useResolved
1279+ ) {
1280+ // t = debugInferType(_, _) and
1281+ impl .toString ( ) = "impl ...::Iterator for ...::Args { ... }" and
1282+ path = p .toStringDebug ( ) and
1283+ p = impl .getTraitPath ( ) .getQualifier * ( ) and
1284+ iter = resolvePath ( p ) and
1285+ iter .getName ( ) = "iter" and
1286+ u = iter .( Module ) .getItemList ( ) .getAnItem ( ) and
1287+ usePath = u .getUseTree ( ) .getPath ( ) .toStringDebug ( ) and
1288+ usePath = "self::traits::Iterator" and
1289+ usePathPrefix = u .getUseTree ( ) .getPath ( ) .getQualifier * ( ) and
1290+ useResolved = resolvePath ( usePathPrefix )
1291+ }
1292+
1293+ private predicate sdf5 ( ImplItemNode impl , string path , RelevantPath p , ItemNode iter , Module m ) {
1294+ // t = debugInferType(_, _) and
1295+ impl .toString ( ) = "impl ...::Iterator for ...::Args { ... }" and
1296+ path = p .toStringDebug ( ) and
1297+ p = impl .getTraitPath ( ) .getQualifier * ( ) and
1298+ iter = resolvePath ( p ) and
1299+ iter .getName ( ) = "iter" and
1300+ m = iter .( Module ) .getItemList ( ) .getAnItem ( )
1301+ }
0 commit comments