-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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
diagnostics: make paths to external items more visible #32439
Conversation
c4c4f58
to
1923d1c
Compare
Holy cow I thought I'd never live to see the day this got implemented. Thank you @jseyfried! 🍰 |
6dfa268
to
4f87af1
Compare
4f87af1
to
62d6ea4
Compare
@@ -244,6 +247,52 @@ impl CStore { | |||
{ | |||
self.extern_mod_crate_map.borrow().get(&emod_id).cloned() | |||
} | |||
|
|||
pub fn visible_parent_map<'a>(&'a self) -> ::std::cell::RefMut<'a, DefIdMap<DefId>> { |
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.
Why the RefMut
?
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.
The RefCell
has to be borrowed mutably in this function and I didn't want to needlessly re-borrow it immutably before returning. This function is only used in librustc_metadata
so I don't think it makes much difference.
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.
Could you document this function please?
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 do
62d6ea4
to
82da520
Compare
}; | ||
|
||
let croot = DefId { krate: cnum, index: CRATE_DEF_INDEX }; | ||
for child in self.crate_top_level_items(cnum) { add_child(bfs_queue, child, croot); } |
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.
nit: spread over 3 lines
r+ with the nits addressed |
ccc40dc
to
17e8ce8
Compare
@nrc thanks for the feedback! I addressed your comments in the most recent commit. We should probably wait for #32293 to land before merging this since there will be non-trivial conflicts (cc @nikomatsakis). |
☔ The latest upstream changes (presumably #32293) made this pull request unmergeable. Please resolve the merge conflicts. |
e43422e
to
6ac1799
Compare
@jseyfried I think this can be r=nrc with |
8183ec4
to
d5ea770
Compare
d5ea770
to
da41e58
Compare
@bors r=nrc |
📌 Commit da41e58 has been approved by |
diagnostics: make paths to external items more visible This PR changes the reported path for an external item so that it is visible from at least one local module (i.e. it does not use any inaccessible external modules) if possible. If the external item's crate was declared with an `extern crate`, the path is guarenteed to use the `extern crate`. Fixes #23224, fixes #23355, fixes #26635, fixes #27165. r? @nrc
💥 Test timed out |
@bors force retry |
@bors p=1 |
This ended up passing all tests on bors, not sure what happened here so I'm just gonna merge manually |
This PR changes the reported path for an external item so that it is visible from at least one local module (i.e. it does not use any inaccessible external modules) if possible. If the external item's crate was declared with an
extern crate
, the path is guarenteed to use theextern crate
.Fixes #23224, fixes #23355, fixes #26635, fixes #27165.
r? @nrc