Skip to content
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

Fix incorrect trait privacy error #32073

Merged
merged 4 commits into from
Mar 9, 2016

Conversation

jseyfried
Copy link
Contributor

This PR fixes #21670 by using the crate metadata instead of ExternalExports to determine if an external item is public.

r? @nikomatsakis

@arielb1
Copy link
Contributor

arielb1 commented Mar 6, 2016

There's some seriously ugly code triplication in fn def_privacy (not a fault of this commit).

@@ -498,7 +497,7 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
let node_id = if let Some(node_id) = self.tcx.map.as_local_node_id(did) {
node_id
} else {
if self.external_exports.contains(&did) {
if self.tcx.sess.cstore.visibility(did) == hir::Public {
debug!("privacy - {:?} was externally exported", did);
return Allowable;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Terrible triplication below this line. Could you clean it up?

@jseyfried
Copy link
Contributor Author

@arielb1 Agreed. Once this PR and #31938 land, I'm going to refactor away PrivacyVisitor entirely, so I'd prefer not to clean it up now.

@nikomatsakis
Copy link
Contributor

@jseyfried Wonderful. I much prefer this fix to the old one :)

@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Contributor

bors commented Mar 8, 2016

📌 Commit b06a1cc has been approved by nikomatsakis

@bors
Copy link
Contributor

bors commented Mar 9, 2016

⌛ Testing commit b06a1cc with merge ef3d051...

bors added a commit that referenced this pull request Mar 9, 2016
…ikomatsakis

Fix incorrect trait privacy error

This PR fixes #21670 by using the crate metadata instead of `ExternalExports` to determine if an external item is public.

r? @nikomatsakis
@bors bors mentioned this pull request Mar 9, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

"error: source trait is private" (fixed by adding use of *struct*)
4 participants