@@ -323,7 +323,16 @@ abstract private class AssocItemNode extends ItemNode, AssocItem {
323
323
private class ConstItemNode extends AssocItemNode instanceof Const {
324
324
override string getName ( ) { result = Const .super .getName ( ) .getText ( ) }
325
325
326
- override predicate hasImplementation ( ) { super .hasBody ( ) }
326
+ override predicate hasImplementation ( ) {
327
+ super .hasBody ( )
328
+ or
329
+ // for trait items from library code, we do not currently know if they
330
+ // have default implementations or not, so we assume they do
331
+ exists ( TraitItemNode t |
332
+ this = t .getAnAssocItem ( ) and
333
+ not this .fromSource ( )
334
+ )
335
+ }
327
336
328
337
override Namespace getNamespace ( ) { result .isValue ( ) }
329
338
@@ -359,7 +368,16 @@ private class VariantItemNode extends ItemNode instanceof Variant {
359
368
class FunctionItemNode extends AssocItemNode instanceof Function {
360
369
override string getName ( ) { result = Function .super .getName ( ) .getText ( ) }
361
370
362
- override predicate hasImplementation ( ) { super .hasBody ( ) }
371
+ override predicate hasImplementation ( ) {
372
+ super .hasBody ( )
373
+ or
374
+ // for trait items from library code, we do not currently know if they
375
+ // have default implementations or not, so we assume they do
376
+ exists ( TraitItemNode t |
377
+ this = t .getAnAssocItem ( ) and
378
+ not this .fromSource ( )
379
+ )
380
+ }
363
381
364
382
override Namespace getNamespace ( ) { result .isValue ( ) }
365
383
@@ -854,6 +872,12 @@ class RelevantPath extends Path {
854
872
this .getQualifier ( ) .( RelevantPath ) .isCratePath ( "$crate" , _) and
855
873
this .getText ( ) = name
856
874
}
875
+
876
+ // TODO: Remove once the crate graph extractor generates publicly visible paths
877
+ predicate requiresExtractorWorkaround ( ) {
878
+ not this .fromSource ( ) and
879
+ this = any ( RelevantPath p ) .getQualifier ( )
880
+ }
857
881
}
858
882
859
883
/**
@@ -998,6 +1022,7 @@ pragma[nomagic]
998
1022
private ItemNode resolvePathPrivate (
999
1023
RelevantPath path , ModuleLikeNode itemParent , ModuleLikeNode pathParent
1000
1024
) {
1025
+ not path .requiresExtractorWorkaround ( ) and
1001
1026
result = resolvePath1 ( path ) and
1002
1027
itemParent = result .getImmediateParentModule ( ) and
1003
1028
not result .isPublic ( ) and
@@ -1031,7 +1056,11 @@ private ModuleLikeNode getAPrivateVisibleModule(ModuleLikeNode itemParent) {
1031
1056
cached
1032
1057
ItemNode resolvePath ( RelevantPath path ) {
1033
1058
result = resolvePath1 ( path ) and
1034
- result .isPublic ( )
1059
+ (
1060
+ result .isPublic ( )
1061
+ or
1062
+ path .requiresExtractorWorkaround ( )
1063
+ )
1035
1064
or
1036
1065
exists ( ModuleLikeNode itemParent , ModuleLikeNode pathParent |
1037
1066
result = resolvePathPrivate ( path , itemParent , pathParent ) and
0 commit comments