@@ -360,11 +360,13 @@ class CrateItemNode extends ItemNode instanceof Crate {
360360
361361 override predicate providesCanonicalPathPrefixFor ( Crate c , ItemNode child ) {
362362 this .hasCanonicalPath ( c ) and
363- exists ( ModuleLikeNode m | m = this .getModuleNode ( ) |
364- child = m
365- or
366- child .getImmediateParent ( ) = m .( SourceFile ) and
363+ exists ( ModuleLikeNode m |
364+ child .getImmediateParent ( ) = m and
367365 not m = child .( SourceFileItemNode ) .getSuper ( )
366+ |
367+ m = super .getModule ( ) // the special `crate` root module inserted by the extractor
368+ or
369+ m = super .getSourceFile ( )
368370 )
369371 }
370372
@@ -648,6 +650,16 @@ private class MacroCallItemNode extends AssocItemNode instanceof MacroCall {
648650
649651 override Visibility getVisibility ( ) { none ( ) }
650652
653+ override predicate providesCanonicalPathPrefixFor ( Crate c , ItemNode child ) {
654+ any ( ItemNode parent ) .providesCanonicalPathPrefixFor ( c , this ) and
655+ child .getImmediateParent ( ) = this
656+ }
657+
658+ override string getCanonicalPathPrefixFor ( Crate c , ItemNode child ) {
659+ result = this .getCanonicalPathPrefix ( c ) and
660+ this .providesCanonicalPathPrefixFor ( c , child )
661+ }
662+
651663 override predicate hasCanonicalPath ( Crate c ) { none ( ) }
652664
653665 override string getCanonicalPath ( Crate c ) { none ( ) }
@@ -1413,8 +1425,8 @@ private module Debug {
14131425 private Locatable getRelevantLocatable ( ) {
14141426 exists ( string filepath , int startline , int startcolumn , int endline , int endcolumn |
14151427 result .getLocation ( ) .hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn ) and
1416- filepath .matches ( "%/test_logging .rs" ) and
1417- startline = 163
1428+ filepath .matches ( "%/clean/types .rs" ) and
1429+ startline = [ 5 , 350 ]
14181430 )
14191431 }
14201432
@@ -1450,4 +1462,14 @@ private module Debug {
14501462 m = getRelevantLocatable ( ) and
14511463 fileImport ( m , f )
14521464 }
1465+
1466+ predicate debugPreludeEdge ( SourceFile f , string name , ItemNode i ) {
1467+ preludeEdge ( f , name , i ) and
1468+ f = getRelevantLocatable ( )
1469+ }
1470+
1471+ string debugGetCanonicalPath ( ItemNode i , Crate c ) {
1472+ result = i .getCanonicalPath ( c ) and
1473+ i = getRelevantLocatable ( )
1474+ }
14531475}
0 commit comments