File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
src/librustc/middle/typeck Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -653,13 +653,20 @@ pub fn convert_methods(ccx: &CrateCtxt,
653653 & method_generics. lifetimes ,
654654 untransformed_rcvr_ty,
655655 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+
656663 ty:: method {
657664 ident : m. ident ,
658665 generics : ty_generics ( ccx, None , & m. generics ) ,
659666 transformed_self_ty : transformed_self_ty,
660667 fty : fty,
661668 self_ty : m. self_ty . node ,
662- vis : m . vis . inherit_from ( rcvr_visibility ) ,
669+ vis : method_vis ,
663670 def_id : local_def ( m. id )
664671 }
665672 }
You can’t perform that action at this time.
0 commit comments