@@ -1334,8 +1334,8 @@ private module Debug {
13341334 private Locatable getRelevantLocatable ( ) {
13351335 exists ( string filepath , int startline , int startcolumn , int endline , int endcolumn |
13361336 result .getLocation ( ) .hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn ) and
1337- filepath .matches ( "%/illegal/ main.rs" ) and
1338- startline = 51
1337+ filepath .matches ( "%/main.rs" ) and
1338+ startline = 8
13391339 )
13401340 }
13411341
@@ -1344,6 +1344,14 @@ private module Debug {
13441344 result = resolvePath ( path )
13451345 }
13461346
1347+ private ItemNode sdfsf ( RelevantPath path , ImplItemNode impl , ItemNode frm ) {
1348+ path = getRelevantLocatable ( ) and
1349+ result = resolvePath ( path ) and
1350+ result = impl .resolveSelfTy ( ) and
1351+ frm = impl .getASuccessorRec ( "from" ) and
1352+ frm instanceof AssocItemNode
1353+ }
1354+
13471355 predicate debugUseImportEdge ( Use use , string name , ItemNode item ) {
13481356 use = getRelevantLocatable ( ) and
13491357 useImportEdge ( use , name , item )
@@ -1364,3 +1372,59 @@ private module Debug {
13641372 fileImport ( m , f )
13651373 }
13661374}
1375+
1376+ private predicate sdfs ( ImplItemNode impl ) {
1377+ // resolvePath(impl.getSelfPath()).getLocation().getStartLine() = [35, 36]
1378+ impl .getLocation ( ) .getFile ( ) .getBaseName ( ) = "main.rs" //and
1379+ // impl.getLocation().getStartLine() = [35 .. 38]
1380+ }
1381+
1382+ private import Type
1383+ private import TypeInference
1384+
1385+ private predicate sdf3 (
1386+ AstNode n , Type t , ImplItemNode impl , string path , RelevantPath p , ImplOrTraitItemNode i ,
1387+ TraitType tt , Function f , string name
1388+ ) {
1389+ t = inferType ( n ) and
1390+ n .getLocation ( ) .getStartLine ( ) = 29 and
1391+ t = TStruct ( impl .resolveSelfTy ( ) ) and
1392+ // t = debugInferType(_, _) and
1393+ impl .toString ( ) = "impl ...::Iterator for ...::Args { ... }" and
1394+ path = p .toStringDebug ( ) and
1395+ p = impl .getTraitPath ( ) .getQualifier * ( ) and
1396+ i = resolvePath ( p ) and
1397+ impl .isFullyParametric ( ) and
1398+ tt = TTrait ( i ) and
1399+ f = tt .getMethod ( name ) and
1400+ f = i .getAnAssocItem ( ) and
1401+ name = "collect" and
1402+ f = impl .resolveSelfTy ( ) .getASuccessor ( name )
1403+ }
1404+
1405+ private predicate sdf4 (
1406+ ImplItemNode impl , string path , RelevantPath p , ItemNode iter , Use u , string usePath ,
1407+ RelevantPath usePathPrefix , ItemNode useResolved
1408+ ) {
1409+ // t = debugInferType(_, _) and
1410+ impl .toString ( ) = "impl ...::Iterator for ...::Args { ... }" and
1411+ path = p .toStringDebug ( ) and
1412+ p = impl .getTraitPath ( ) .getQualifier * ( ) and
1413+ iter = resolvePath ( p ) and
1414+ iter .getName ( ) = "iter" and
1415+ u = iter .( Module ) .getItemList ( ) .getAnItem ( ) and
1416+ usePath = u .getUseTree ( ) .getPath ( ) .toStringDebug ( ) and
1417+ usePath = "self::traits::Iterator" and
1418+ usePathPrefix = u .getUseTree ( ) .getPath ( ) .getQualifier * ( ) and
1419+ useResolved = resolvePath ( usePathPrefix )
1420+ }
1421+
1422+ private predicate sdf5 ( ImplItemNode impl , string path , RelevantPath p , ItemNode iter , Module m ) {
1423+ // t = debugInferType(_, _) and
1424+ impl .toString ( ) = "impl ...::Iterator for ...::Args { ... }" and
1425+ path = p .toStringDebug ( ) and
1426+ p = impl .getTraitPath ( ) .getQualifier * ( ) and
1427+ iter = resolvePath ( p ) and
1428+ iter .getName ( ) = "iter" and
1429+ m = iter .( Module ) .getItemList ( ) .getAnItem ( )
1430+ }
0 commit comments