-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
More robust "KnownNames" resolution #27
More robust "KnownNames" resolution #27
Conversation
@hermanventer I left a few minor TODO comments for myself that I don't think stop this from landing, I plan to pick them up as separate PR(s) in the next few days or early next week. |
"future" => known_name_for_terminal_from_ns!( | ||
tail_segments, | ||
DefPathData::ValueNs, | ||
// TODO: (@davidsemakula) Was `from_generator` removed? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems so and, in general, the Rust compiler folks are prone to renaming functions and moving functions between namespaces so the mapping provided by KnownNames continually breaks. I make time to keep the tests mostly running, but finding the time to keep KnownNames current in every respect has been difficult.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be worthwhile to write a test case that contains, one way or another, code the generates DefIds for each of the cases in KnownNames. Fixing such a test case when the compiler churns will be much more efficient than analyzing other test cases that break in weird ways because KnownNames is invalidated by a compiler change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's a good idea to keep it and the TODO/comment around till we hunt down it's replacement :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It may be worthwhile to write a test case that contains, one way or another, code the generates DefIds for each of the cases in KnownNames.
Makes sense
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will work on this and ping you :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good.
Description
Improves
KnownName
resolution by:Matching againstrustc
lang items (byDefId
) when possible (should produce the most precise match, and also likely the least expensive as a lang items map is available via arustc
query)DefPath
segmentsKnownName
to the fullDefPath
(See Assertion failure in checker/src/call_visitor.rs:2038 #26 (comment) for details)DefPathData
variant instead of the integerdisambiguator
forDefPath
segments that don't include a name (e.g.impl
,extern
/"foreign module" definitions e.t.c)Fixes #26
Type of change
How Has This Been Tested?
Added a test case as described at #26 (comment)
Also ran
./validate.sh
Checklist:
main
.