diff options
| author | Jeffrey Seyfried <jeffrey.seyfried@gmail.com> | 2016-04-10 23:33:36 +0000 |
|---|---|---|
| committer | Jeffrey Seyfried <jeffrey.seyfried@gmail.com> | 2016-04-14 04:58:42 +0000 |
| commit | 44c78eeb4622c7e2c68cfe6a72ae86251426e181 (patch) | |
| tree | 3567973d71a0ac7f577a5523082449072d183f1a /src/libsyntax | |
| parent | 50ce605f462cf7436ea454a38f99246a2c3bfddb (diff) | |
| download | rust-44c78eeb4622c7e2c68cfe6a72ae86251426e181.tar.gz rust-44c78eeb4622c7e2c68cfe6a72ae86251426e181.zip | |
Feature gate `pub(restricted)`
Diffstat (limited to 'src/libsyntax')
| -rw-r--r-- | src/libsyntax/feature_gate.rs | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libsyntax/feature_gate.rs b/src/libsyntax/feature_gate.rs index fc18ef407ab..9960e88e7fb 100644 --- a/src/libsyntax/feature_gate.rs +++ b/src/libsyntax/feature_gate.rs @@ -256,6 +256,9 @@ const KNOWN_FEATURES: &'static [(&'static str, &'static str, Option<u32>, Status // impl specialization (RFC 1210) ("specialization", "1.7.0", Some(31844), Active), + + // pub(restricted) visibilities (RFC 1422) + ("pub_restricted", "1.9.0", Some(32409), Active), ]; // (changing above list without updating src/doc/reference.md makes @cmr sad) @@ -608,6 +611,7 @@ pub struct Features { pub deprecated: bool, pub question_mark: bool, pub specialization: bool, + pub pub_restricted: bool, } impl Features { @@ -644,6 +648,7 @@ impl Features { deprecated: false, question_mark: false, specialization: false, + pub_restricted: false, } } } @@ -1159,6 +1164,15 @@ impl<'a, 'v> Visitor<'v> for PostExpansionVisitor<'a> { } visit::walk_impl_item(self, ii); } + + fn visit_vis(&mut self, vis: &'v ast::Visibility) { + let span = match *vis { + ast::Visibility::Crate(span) => span, + ast::Visibility::Restricted { ref path, .. } => path.span, + _ => return, + }; + self.gate_feature("pub_restricted", span, "`pub(restricted)` syntax is experimental"); + } } fn check_crate_inner<F>(cm: &CodeMap, span_handler: &Handler, @@ -1256,6 +1270,7 @@ fn check_crate_inner<F>(cm: &CodeMap, span_handler: &Handler, deprecated: cx.has_feature("deprecated"), question_mark: cx.has_feature("question_mark"), specialization: cx.has_feature("specialization"), + pub_restricted: cx.has_feature("pub_restricted"), } } |
