@@ -648,6 +648,16 @@ private class MacroCallItemNode extends AssocItemNode instanceof MacroCall {
648
648
649
649
override Visibility getVisibility ( ) { none ( ) }
650
650
651
+ override predicate providesCanonicalPathPrefixFor ( Crate c , ItemNode child ) {
652
+ any ( ItemNode parent ) .providesCanonicalPathPrefixFor ( c , this ) and
653
+ child .getImmediateParent ( ) = this
654
+ }
655
+
656
+ override string getCanonicalPathPrefixFor ( Crate c , ItemNode child ) {
657
+ result = this .getCanonicalPathPrefix ( c ) and
658
+ this .providesCanonicalPathPrefixFor ( c , child )
659
+ }
660
+
651
661
override predicate hasCanonicalPath ( Crate c ) { none ( ) }
652
662
653
663
override string getCanonicalPath ( Crate c ) { none ( ) }
@@ -948,6 +958,19 @@ private Meta getPathAttrMeta(Module m) {
948
958
result .getPath ( ) .getText ( ) = "path"
949
959
}
950
960
961
+ private Meta testgetPathAttrMeta ( TokenTree tree , Token t ) {
962
+ // result = getPathAttrMeta(m) and
963
+ result .getPath ( ) .getText ( ) = "cfg_attr" and
964
+ result .getLocation ( ) .getFile ( ) .getBaseName ( ) = "masks.rs" and
965
+ tree = result .getTokenTree ( ) and
966
+ t .getParentNode ( ) = tree
967
+ }
968
+
969
+ private predicate sdf ( Token t ) {
970
+ // result = getPathAttrMeta(m) and
971
+ t .getLocation ( ) .getFile ( ) .getBaseName ( ) = "masks.rs"
972
+ }
973
+
951
974
/**
952
975
* Holds if `m` is a `mod name;` module declaration, where the corresponding
953
976
* module file needs to be looked up in `lookup` or one of its descandants.
@@ -1388,6 +1411,42 @@ private predicate useImportEdge(Use use, string name, ItemNode item) {
1388
1411
)
1389
1412
}
1390
1413
1414
+ private predicate test (
1415
+ Crate core , ModuleItemNode mod , ModuleItemNode prelude , ModuleItemNode rust , Use use ,
1416
+ RelevantPath path , string p , ModuleItemNode v1 , Use asMutUse , RelevantPath asMutPath ,
1417
+ string asMutP , ModuleItemNode common , Use asMutUse2 , RelevantPath asMutPath2 , string asMutP2 ,
1418
+ Item i2
1419
+ ) {
1420
+ // Item i2
1421
+ core .getName ( ) = "core" and
1422
+ mod = core .getModule ( ) and
1423
+ prelude = mod .getASuccessorRec ( "prelude" ) and
1424
+ rust = prelude .getASuccessorRec ( [ "rust_2015" , "rust_2018" , "rust_2021" , "rust_2024" ] ) and
1425
+ // use = rust.getASuccessorRec(_) and
1426
+ use = rust .( Module ) .getItemList ( ) .getAnItem ( ) and
1427
+ p = path .toStringDebug ( ) + " (" + use .getUseTree ( ) .getPath ( ) .toStringDebug ( ) + ")" and
1428
+ path = use .getUseTree ( ) .getPath ( ) .getQualifier * ( ) and
1429
+ use .getUseTree ( ) .getPath ( ) .toStringDebug ( ) = "super::v1::AsMut" and
1430
+ v1 = resolvePath ( path ) and
1431
+ path .toStringDebug ( ) = "super::v1" and
1432
+ asMutUse = v1 .( Module ) .getItemList ( ) .getAnItem ( ) and
1433
+ // asMutUse = v1.getASuccessorRec(name) and
1434
+ asMutPath = asMutUse .getUseTree ( ) .getPath ( ) .getQualifier * ( ) and
1435
+ asMutP = asMutPath .toStringDebug ( ) + " (" + asMutUse .getUseTree ( ) .getPath ( ) .toStringDebug ( ) + ")" and
1436
+ common = resolvePath ( asMutPath ) and
1437
+ asMutPath .toStringDebug ( ) = "super::common" and
1438
+ asMutUse2 = common .( Module ) .getItemList ( ) .getAnItem ( ) and
1439
+ // asMutUse = v1.getASuccessorRec(name) and
1440
+ asMutPath2 = asMutUse2 .getUseTree ( ) .getPath ( ) .getQualifier * ( ) and
1441
+ asMutP2 =
1442
+ asMutPath2 .toStringDebug ( ) + " (" + asMutUse2 .getUseTree ( ) .getPath ( ) .toStringDebug ( ) + ")" and
1443
+ i2 = resolvePath ( asMutPath2 ) and
1444
+ hasCratePath ( asMutUse2 ) and
1445
+ rootHasCratePathTc ( _, asMutUse2 )
1446
+ // asMutUse2.(UseItemNode).getImmediateParent+() = i and
1447
+ // i = any(Crate c).getModule()
1448
+ }
1449
+
1391
1450
/**
1392
1451
* Holds if `i` is available inside `f` because it is reexported in [the prelude][1].
1393
1452
*
@@ -1413,8 +1472,8 @@ private module Debug {
1413
1472
private Locatable getRelevantLocatable ( ) {
1414
1473
exists ( string filepath , int startline , int startcolumn , int endline , int endcolumn |
1415
1474
result .getLocation ( ) .hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn ) and
1416
- filepath .matches ( "%/test_logging .rs" ) and
1417
- startline = 163
1475
+ filepath .matches ( "%/clean/types .rs" ) and
1476
+ startline = [ 5 , 350 ]
1418
1477
)
1419
1478
}
1420
1479
@@ -1450,4 +1509,14 @@ private module Debug {
1450
1509
m = getRelevantLocatable ( ) and
1451
1510
fileImport ( m , f )
1452
1511
}
1512
+
1513
+ predicate debugPreludeEdge ( SourceFile f , string name , ItemNode i ) {
1514
+ preludeEdge ( f , name , i ) and
1515
+ f = getRelevantLocatable ( )
1516
+ }
1517
+
1518
+ string debugGetCanonicalPath ( ItemNode i , Crate c ) {
1519
+ result = i .getCanonicalPath ( c ) and
1520
+ i = getRelevantLocatable ( )
1521
+ }
1453
1522
}
0 commit comments