@@ -615,16 +615,10 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
615
615
// decision solely based on the privacy of the method
616
616
// invocation.
617
617
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 ,
628
622
}
629
623
}
630
624
Some ( ast_map:: NodeTraitItem ( _) ) => hir:: Public ,
@@ -804,8 +798,8 @@ impl<'a, 'tcx> PrivacyVisitor<'a, 'tcx> {
804
798
// Trait methods are always all public. The only controlling factor
805
799
// is whether the trait itself is accessible or not.
806
800
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 ) ) ;
809
803
}
810
804
}
811
805
}
0 commit comments