Rust: Crate graph extraction workarounds#19362
Conversation
6919095 to
3ce7728
Compare
paldepind
left a comment
There was a problem hiding this comment.
Really great to get this fixed!
| exists(TraitItemNode t | | ||
| this = t.getAnAssocItem() and | ||
| not this.fromSource() | ||
| ) |
There was a problem hiding this comment.
What about this?
| exists(TraitItemNode t | | |
| this = t.getAnAssocItem() and | |
| not this.fromSource() | |
| ) | |
| not this.fromSource() and | |
| this = any(TraitItemNode t).getAnAssocItem() |
| ( | ||
| // when a method exists in both source code and in library code, it is because | ||
| // we also extracted the source code as library code, and hence we only want | ||
| // the method from source code |
There was a problem hiding this comment.
Does this not affect path resolution as well? Could the workaround be done in path resolution? Or is there a benefit to having getASuccessor give the duplicated methods?
| super.hasBody() | ||
| or | ||
| // for trait items from library code, we do not currently know if they | ||
| // have default implementations or not, so we assume they do |
There was a problem hiding this comment.
Why do we assume that they have implementations and not the other way around (assume that they don't)?
There was a problem hiding this comment.
That is what we did before, and that meant we were unable to resolve such calls
There was a problem hiding this comment.
Oh, I see. I would've thought that they'd just be prioritized lower in getStaticTarget.
| exists(TraitItemNode t | | ||
| this = t.getAnAssocItem() and | ||
| not this.fromSource() | ||
| ) |
There was a problem hiding this comment.
What about this?
| exists(TraitItemNode t | | |
| this = t.getAnAssocItem() and | |
| not this.fromSource() | |
| ) | |
| not this.fromSource() and | |
| this = any(TraitItemNode t).getAnAssocItem() |
3ce7728 to
da68329
Compare
da68329 to
52bd99b
Compare
paldepind
left a comment
There was a problem hiding this comment.
Great! Thanks for fixing this and to me it seems nice how it's contained inside path resolution now :)
This PR works around two issues in the crate graph extractor:
core::iter::Iterator(because that's how it is publicly visible), it generatescore::iter::traits::iterator::Iterator, which mentions the privatetraitsmodule.DCA looks great; theMissing call targetsmetric goes down for all projects, without significant analysis slowdown.DCA is somewhat mixed, we both gain and lose call edges; the reason why we lose call edges is that functions extracted from the crate graph don't include constraints, so the
isFullyParametricincorrectly always hold for those.CC: @aibaars