@@ -1317,8 +1317,8 @@ private module Debug {
13171317 private Locatable getRelevantLocatable ( ) {
13181318 exists ( string filepath , int startline , int startcolumn , int endline , int endcolumn |
13191319 result .getLocation ( ) .hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn ) and
1320- filepath .matches ( "%/illegal/ main.rs" ) and
1321- startline = 51
1320+ filepath .matches ( "%/main.rs" ) and
1321+ startline = 8
13221322 )
13231323 }
13241324
@@ -1327,6 +1327,14 @@ private module Debug {
13271327 result = resolvePath ( path )
13281328 }
13291329
1330+ private ItemNode sdfsf ( RelevantPath path , ImplItemNode impl , ItemNode frm ) {
1331+ path = getRelevantLocatable ( ) and
1332+ result = resolvePath ( path ) and
1333+ result = impl .resolveSelfTy ( ) and
1334+ frm = impl .getASuccessorRec ( "from" ) and
1335+ frm instanceof AssocItemNode
1336+ }
1337+
13301338 predicate debugUseImportEdge ( Use use , string name , ItemNode item ) {
13311339 use = getRelevantLocatable ( ) and
13321340 useImportEdge ( use , name , item )
@@ -1347,3 +1355,59 @@ private module Debug {
13471355 fileImport ( m , f )
13481356 }
13491357}
1358+
1359+ private predicate sdfs ( ImplItemNode impl ) {
1360+ // resolvePath(impl.getSelfPath()).getLocation().getStartLine() = [35, 36]
1361+ impl .getLocation ( ) .getFile ( ) .getBaseName ( ) = "main.rs" //and
1362+ // impl.getLocation().getStartLine() = [35 .. 38]
1363+ }
1364+
1365+ private import Type
1366+ private import TypeInference
1367+
1368+ private predicate sdf3 (
1369+ AstNode n , Type t , ImplItemNode impl , string path , RelevantPath p , ImplOrTraitItemNode i ,
1370+ TraitType tt , Function f , string name
1371+ ) {
1372+ t = inferType ( n ) and
1373+ n .getLocation ( ) .getStartLine ( ) = 29 and
1374+ t = TStruct ( impl .resolveSelfTy ( ) ) and
1375+ // t = debugInferType(_, _) and
1376+ impl .toString ( ) = "impl ...::Iterator for ...::Args { ... }" and
1377+ path = p .toStringDebug ( ) and
1378+ p = impl .getTraitPath ( ) .getQualifier * ( ) and
1379+ i = resolvePath ( p ) and
1380+ impl .isFullyParametric ( ) and
1381+ tt = TTrait ( i ) and
1382+ f = tt .getMethod ( name ) and
1383+ f = i .getAnAssocItem ( ) and
1384+ name = "collect" and
1385+ f = impl .resolveSelfTy ( ) .getASuccessor ( name )
1386+ }
1387+
1388+ private predicate sdf4 (
1389+ ImplItemNode impl , string path , RelevantPath p , ItemNode iter , Use u , string usePath ,
1390+ RelevantPath usePathPrefix , ItemNode useResolved
1391+ ) {
1392+ // t = debugInferType(_, _) and
1393+ impl .toString ( ) = "impl ...::Iterator for ...::Args { ... }" and
1394+ path = p .toStringDebug ( ) and
1395+ p = impl .getTraitPath ( ) .getQualifier * ( ) and
1396+ iter = resolvePath ( p ) and
1397+ iter .getName ( ) = "iter" and
1398+ u = iter .( Module ) .getItemList ( ) .getAnItem ( ) and
1399+ usePath = u .getUseTree ( ) .getPath ( ) .toStringDebug ( ) and
1400+ usePath = "self::traits::Iterator" and
1401+ usePathPrefix = u .getUseTree ( ) .getPath ( ) .getQualifier * ( ) and
1402+ useResolved = resolvePath ( usePathPrefix )
1403+ }
1404+
1405+ private predicate sdf5 ( ImplItemNode impl , string path , RelevantPath p , ItemNode iter , Module m ) {
1406+ // t = debugInferType(_, _) and
1407+ impl .toString ( ) = "impl ...::Iterator for ...::Args { ... }" and
1408+ path = p .toStringDebug ( ) and
1409+ p = impl .getTraitPath ( ) .getQualifier * ( ) and
1410+ iter = resolvePath ( p ) and
1411+ iter .getName ( ) = "iter" and
1412+ m = iter .( Module ) .getItemList ( ) .getAnItem ( )
1413+ }
0 commit comments