@@ -648,6 +648,16 @@ private class MacroCallItemNode extends AssocItemNode instanceof MacroCall {
648648
649649 override Visibility getVisibility ( ) { none ( ) }
650650
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+
651661 override predicate hasCanonicalPath ( Crate c ) { none ( ) }
652662
653663 override string getCanonicalPath ( Crate c ) { none ( ) }
@@ -948,6 +958,19 @@ private Meta getPathAttrMeta(Module m) {
948958 result .getPath ( ) .getText ( ) = "path"
949959}
950960
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+
951974/**
952975 * Holds if `m` is a `mod name;` module declaration, where the corresponding
953976 * 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) {
13881411 )
13891412}
13901413
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+
13911450/**
13921451 * Holds if `i` is available inside `f` because it is reexported in [the prelude][1].
13931452 *
@@ -1413,8 +1472,8 @@ private module Debug {
14131472 private Locatable getRelevantLocatable ( ) {
14141473 exists ( string filepath , int startline , int startcolumn , int endline , int endcolumn |
14151474 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 ]
14181477 )
14191478 }
14201479
@@ -1450,4 +1509,14 @@ private module Debug {
14501509 m = getRelevantLocatable ( ) and
14511510 fileImport ( m , f )
14521511 }
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+ }
14531522}
0 commit comments