@@ -26,6 +26,7 @@ use util::nodemap::{NodeMap, NodeSet};
2626
2727use syntax:: ast;
2828use syntax:: ast_map;
29+ use syntax:: ast_util;
2930use syntax:: ast_util:: { is_local, local_def} ;
3031use syntax:: attr;
3132use syntax:: codemap:: Span ;
@@ -263,10 +264,10 @@ impl<'a> Visitor<()> for EmbargoVisitor<'a> {
263264
264265 if public_ty || public_trait {
265266 for method in methods. iter ( ) {
266- let meth_public = match method. explicit_self . node {
267+ let meth_public = match ast_util :: method_explicit_self ( & * * method) . node {
267268 ast:: SelfStatic => public_ty,
268269 _ => true ,
269- } && method. vis == ast:: Public ;
270+ } && ast_util :: method_vis ( & * * method) == ast:: Public ;
270271 if meth_public || tr. is_some ( ) {
271272 self . exported_items . insert ( method. id ) ;
272273 }
@@ -456,8 +457,8 @@ impl<'a> PrivacyVisitor<'a> {
456457 let imp = self . tcx . map . get_parent_did ( closest_private_id) ;
457458 match ty:: impl_trait_ref ( self . tcx , imp) {
458459 Some ( ..) => return Allowable ,
459- _ if m . vis == ast:: Public => return Allowable ,
460- _ => m . vis
460+ _ if ast_util :: method_vis ( & * * m ) == ast:: Public => return Allowable ,
461+ _ => ast_util :: method_vis ( & * * m )
461462 }
462463 }
463464 Some ( ast_map:: NodeTraitMethod ( _) ) => {
@@ -1078,7 +1079,7 @@ impl<'a> SanePrivacyVisitor<'a> {
10781079 "visibility qualifiers have no effect on trait \
10791080 impls") ;
10801081 for m in methods. iter ( ) {
1081- check_inherited ( m. span , m . vis , "" ) ;
1082+ check_inherited ( m. span , ast_util :: method_vis ( & * * m ) , "" ) ;
10821083 }
10831084 }
10841085
@@ -1110,7 +1111,7 @@ impl<'a> SanePrivacyVisitor<'a> {
11101111 for m in methods. iter ( ) {
11111112 match * m {
11121113 ast:: Provided ( ref m) => {
1113- check_inherited ( m. span , m . vis ,
1114+ check_inherited ( m. span , ast_util :: method_vis ( & * * m ) ,
11141115 "unnecessary visibility" ) ;
11151116 }
11161117 ast:: Required ( ref m) => {
@@ -1148,7 +1149,7 @@ impl<'a> SanePrivacyVisitor<'a> {
11481149 match item. node {
11491150 ast:: ItemImpl ( _, _, _, ref methods) => {
11501151 for m in methods. iter ( ) {
1151- check_inherited ( tcx, m. span , m . vis ) ;
1152+ check_inherited ( tcx, m. span , ast_util :: method_vis ( & * * m ) ) ;
11521153 }
11531154 }
11541155 ast:: ItemForeignMod ( ref fm) => {
@@ -1174,7 +1175,7 @@ impl<'a> SanePrivacyVisitor<'a> {
11741175 match * m {
11751176 ast:: Required ( ..) => { }
11761177 ast:: Provided ( ref m) => check_inherited ( tcx, m. span ,
1177- m . vis ) ,
1178+ ast_util :: method_vis ( & * * m ) ) ,
11781179 }
11791180 }
11801181 }
@@ -1344,7 +1345,7 @@ impl<'a> Visitor<()> for VisiblePrivateTypesVisitor<'a> {
13441345 // methods will be visible as `Public::foo`.
13451346 let mut found_pub_static = false ;
13461347 for method in methods. iter ( ) {
1347- if method. explicit_self . node == ast:: SelfStatic &&
1348+ if ast_util :: method_explicit_self ( & * * method) . node == ast:: SelfStatic &&
13481349 self . exported_items . contains ( & method. id ) {
13491350 found_pub_static = true ;
13501351 visit:: walk_method_helper ( self , & * * method, ( ) ) ;
0 commit comments