@@ -256,6 +256,9 @@ const KNOWN_FEATURES: &'static [(&'static str, &'static str, Option<u32>, Status
256256
257257 // impl specialization (RFC 1210)
258258 ( "specialization" , "1.7.0" , Some ( 31844 ) , Active ) ,
259+
260+ // pub(restricted) visibilities (RFC 1422)
261+ ( "pub_restricted" , "1.9.0" , Some ( 32409 ) , Active ) ,
259262] ;
260263// (changing above list without updating src/doc/reference.md makes @cmr sad)
261264
@@ -608,6 +611,7 @@ pub struct Features {
608611 pub deprecated : bool ,
609612 pub question_mark : bool ,
610613 pub specialization : bool ,
614+ pub pub_restricted : bool ,
611615}
612616
613617impl Features {
@@ -644,6 +648,7 @@ impl Features {
644648 deprecated : false ,
645649 question_mark : false ,
646650 specialization : false ,
651+ pub_restricted : false ,
647652 }
648653 }
649654}
@@ -1159,6 +1164,15 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
11591164 }
11601165 visit:: walk_impl_item ( self , ii) ;
11611166 }
1167+
1168+ fn visit_vis ( & mut self , vis : & ' v ast:: Visibility ) {
1169+ let span = match * vis {
1170+ ast:: Visibility :: Crate ( span) => span,
1171+ ast:: Visibility :: Restricted { ref path, .. } => path. span ,
1172+ _ => return ,
1173+ } ;
1174+ self . gate_feature ( "pub_restricted" , span, "`pub(restricted)` syntax is experimental" ) ;
1175+ }
11621176}
11631177
11641178fn check_crate_inner < F > ( cm : & CodeMap , span_handler : & Handler ,
@@ -1256,6 +1270,7 @@ fn check_crate_inner<F>(cm: &CodeMap, span_handler: &Handler,
12561270 deprecated : cx. has_feature ( "deprecated" ) ,
12571271 question_mark : cx. has_feature ( "question_mark" ) ,
12581272 specialization : cx. has_feature ( "specialization" ) ,
1273+ pub_restricted : cx. has_feature ( "pub_restricted" ) ,
12591274 }
12601275}
12611276
0 commit comments