@@ -256,6 +256,9 @@ const KNOWN_FEATURES: &'static [(&'static str, &'static str, Option<u32>, Status
256
256
257
257
// impl specialization (RFC 1210)
258
258
( "specialization" , "1.7.0" , Some ( 31844 ) , Active ) ,
259
+
260
+ // pub(restricted) visibilities (RFC 1422)
261
+ ( "pub_restricted" , "1.9.0" , Some ( 32409 ) , Active ) ,
259
262
] ;
260
263
// (changing above list without updating src/doc/reference.md makes @cmr sad)
261
264
@@ -608,6 +611,7 @@ pub struct Features {
608
611
pub deprecated : bool ,
609
612
pub question_mark : bool ,
610
613
pub specialization : bool ,
614
+ pub pub_restricted : bool ,
611
615
}
612
616
613
617
impl Features {
@@ -644,6 +648,7 @@ impl Features {
644
648
deprecated : false ,
645
649
question_mark : false ,
646
650
specialization : false ,
651
+ pub_restricted : false ,
647
652
}
648
653
}
649
654
}
@@ -1159,6 +1164,15 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> {
1159
1164
}
1160
1165
visit:: walk_impl_item ( self , ii) ;
1161
1166
}
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
+ }
1162
1176
}
1163
1177
1164
1178
fn check_crate_inner < F > ( cm : & CodeMap , span_handler : & Handler ,
@@ -1256,6 +1270,7 @@ fn check_crate_inner<F>(cm: &CodeMap, span_handler: &Handler,
1256
1270
deprecated : cx. has_feature ( "deprecated" ) ,
1257
1271
question_mark : cx. has_feature ( "question_mark" ) ,
1258
1272
specialization : cx. has_feature ( "specialization" ) ,
1273
+ pub_restricted : cx. has_feature ( "pub_restricted" ) ,
1259
1274
}
1260
1275
}
1261
1276
0 commit comments