@@ -615,16 +615,10 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
615615 // decision solely based on the privacy of the method
616616 // invocation.
617617 Some ( ast_map:: NodeImplItem ( ii) ) => {
618- match ii. node {
619- hir:: ImplItemKind :: Const ( ..) |
620- hir:: ImplItemKind :: Method ( ..) => {
621- let imp = self . tcx . map . get_parent_did ( node_id) ;
622- match self . tcx . impl_trait_ref ( imp) {
623- Some ( ..) => hir:: Public ,
624- _ => ii. vis
625- }
626- }
627- hir:: ImplItemKind :: Type ( _) => hir:: Public ,
618+ let imp = self . tcx . map . get_parent_did ( node_id) ;
619+ match self . tcx . impl_trait_ref ( imp) {
620+ Some ( ..) => hir:: Public ,
621+ _ => ii. vis ,
628622 }
629623 }
630624 Some ( ast_map:: NodeTraitItem ( _) ) => hir:: Public ,
@@ -804,8 +798,8 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
804798 // Trait methods are always all public. The only controlling factor
805799 // is whether the trait itself is accessible or not.
806800 ty:: TraitContainer ( trait_def_id) => {
807- self . report_error ( self . ensure_public ( span , trait_def_id,
808- None , "source trait" ) ) ;
801+ let msg = format ! ( "source trait `{}`" , self . tcx . item_path_str ( trait_def_id) ) ;
802+ self . report_error ( self . ensure_public ( span , trait_def_id , None , & msg ) ) ;
809803 }
810804 }
811805 }
0 commit comments