@@ -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
@@ -650,6 +652,16 @@ private class MacroCallItemNode extends AssocItemNode instanceof MacroCall {
650652
651653 override Visibility getVisibility ( ) { none ( ) }
652654
655+ override predicate providesCanonicalPathPrefixFor ( Crate c , ItemNode child ) {
656+ any ( ItemNode parent ) .providesCanonicalPathPrefixFor ( c , this ) and
657+ child .getImmediateParent ( ) = this
658+ }
659+
660+ override string getCanonicalPathPrefixFor ( Crate c , ItemNode child ) {
661+ result = this .getCanonicalPathPrefix ( c ) and
662+ this .providesCanonicalPathPrefixFor ( c , child )
663+ }
664+
653665 override predicate hasCanonicalPath ( Crate c ) { none ( ) }
654666
655667 override string getCanonicalPath ( Crate c ) { none ( ) }
@@ -1415,8 +1427,8 @@ private module Debug {
14151427 private Locatable getRelevantLocatable ( ) {
14161428 exists ( string filepath , int startline , int startcolumn , int endline , int endcolumn |
14171429 result .getLocation ( ) .hasLocationInfo ( filepath , startline , startcolumn , endline , endcolumn ) and
1418- filepath .matches ( "%/test_logging .rs" ) and
1419- startline = 163
1430+ filepath .matches ( "%/clean/types .rs" ) and
1431+ startline = [ 5 , 350 ]
14201432 )
14211433 }
14221434
@@ -1452,4 +1464,14 @@ private module Debug {
14521464 m = getRelevantLocatable ( ) and
14531465 fileImport ( m , f )
14541466 }
1467+
1468+ predicate debugPreludeEdge ( SourceFile f , string name , ItemNode i ) {
1469+ preludeEdge ( f , name , i ) and
1470+ f = getRelevantLocatable ( )
1471+ }
1472+
1473+ string debugGetCanonicalPath ( ItemNode i , Crate c ) {
1474+ result = i .getCanonicalPath ( c ) and
1475+ i = getRelevantLocatable ( )
1476+ }
14551477}
0 commit comments