1
Fork 0

resolve: Remove visibility hacks for enum variants and trait items

Special treatment like this was necessary before `pub(restricted)` had been implemented and only two visibilities existed - `pub` and non-`pub`.
Now it's no longer necessary and the desired behavior follows from `pub(restricted)`-style visibilities naturally assigned to enum variants and trait items.
This commit is contained in:
Vadim Petrochenkov 2021-01-06 18:07:47 +03:00
parent b4b6b62e70
commit 8e74842089
8 changed files with 80 additions and 137 deletions

View file

@ -1398,10 +1398,7 @@ impl<'a, 'b> Visitor<'b> for BuildReducedGraphVisitor<'a, 'b> {
let parent = self.parent_scope.module;
let expansion = self.parent_scope.expansion;
let res = Res::Def(def_kind, def_id);
// FIXME: For historical reasons the binding visibility is set to public,
// use actual visibility here instead, using enum variants as an example.
let vis_hack = ty::Visibility::Public;
self.r.define(parent, item.ident, ns, (res, vis_hack, item.span, expansion));
self.r.define(parent, item.ident, ns, (res, vis, item.span, expansion));
}
visit::walk_assoc_item(self, item, ctxt);