We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2a44a1b commit d716398Copy full SHA for d716398
src/librustc/middle/typeck/collect.rs
@@ -653,13 +653,20 @@ pub fn convert_methods(ccx: &CrateCtxt,
653
&method_generics.lifetimes,
654
untransformed_rcvr_ty,
655
m.self_ty, &m.decl);
656
+
657
+ // if the method specifies a visibility, use that, otherwise
658
+ // inherit the visibility from the impl (so `foo` in `pub impl
659
+ // { fn foo(); }` is public, but private in `priv impl { fn
660
+ // foo(); }`).
661
+ let method_vis = m.vis.inherit_from(rcvr_visibility);
662
663
ty::method {
664
ident: m.ident,
665
generics: ty_generics(ccx, None, &m.generics),
666
transformed_self_ty: transformed_self_ty,
667
fty: fty,
668
self_ty: m.self_ty.node,
- vis: m.vis.inherit_from(rcvr_visibility),
669
+ vis: method_vis,
670
def_id: local_def(m.id)
671
}
672
0 commit comments