Skip to content

Commit 28626ca

Browse files
committed
Stabilize pub(restricted)
1 parent 0aeb9c1 commit 28626ca

File tree

27 files changed

+35
-106
lines changed

27 files changed

+35
-106
lines changed

src/doc/unstable-book/src/SUMMARY.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@
6565
- [plugin_registrar](plugin-registrar.md)
6666
- [prelude_import](prelude-import.md)
6767
- [proc_macro](proc-macro.md)
68-
- [pub_restricted](pub-restricted.md)
6968
- [quote](quote.md)
7069
- [relaxed_adts](relaxed-adts.md)
7170
- [repr_simd](repr-simd.md)

src/doc/unstable-book/src/pub-restricted.md

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/librustc/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
#![feature(libc)]
3535
#![feature(loop_break_value)]
3636
#![feature(nonzero)]
37-
#![feature(pub_restricted)]
37+
#![cfg_attr(stage0, feature(pub_restricted))]
3838
#![feature(quote)]
3939
#![feature(rustc_diagnostic_macros)]
4040
#![feature(rustc_private)]

src/librustc_incremental/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
#![feature(core_intrinsics)]
2626
#![feature(conservative_impl_trait)]
2727
#![cfg_attr(stage0,feature(field_init_shorthand))]
28-
#![feature(pub_restricted)]
28+
#![cfg_attr(stage0, feature(pub_restricted))]
2929

3030
extern crate graphviz;
3131
#[macro_use] extern crate rustc;

src/librustc_privacy/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -951,7 +951,7 @@ impl<'a, 'tcx: 'a> TypeVisitor<'tcx> for SearchInterfaceForPrivateItemsVisitor<'
951951
self.min_visibility = vis;
952952
}
953953
if !vis.is_at_least(self.required_visibility, self.tcx) {
954-
if self.tcx.sess.features.borrow().pub_restricted || self.has_old_errors {
954+
if self.has_old_errors {
955955
let mut err = struct_span_err!(self.tcx.sess, self.span, E0446,
956956
"private type `{}` in public interface", ty);
957957
err.span_label(self.span, &format!("can't leak private type"));
@@ -986,7 +986,7 @@ impl<'a, 'tcx: 'a> TypeVisitor<'tcx> for SearchInterfaceForPrivateItemsVisitor<'
986986
self.min_visibility = vis;
987987
}
988988
if !vis.is_at_least(self.required_visibility, self.tcx) {
989-
if self.tcx.sess.features.borrow().pub_restricted || self.has_old_errors {
989+
if self.has_old_errors {
990990
struct_span_err!(self.tcx.sess, self.span, E0445,
991991
"private trait `{}` in public interface", trait_ref)
992992
.span_label(self.span, &format!(

src/libstd/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,6 @@
283283
#![feature(placement_in_syntax)]
284284
#![feature(placement_new_protocol)]
285285
#![feature(prelude_import)]
286-
#![feature(pub_restricted)]
287286
#![feature(rand)]
288287
#![feature(raw)]
289288
#![feature(repr_simd)]
@@ -309,6 +308,7 @@
309308
#![feature(vec_push_all)]
310309
#![feature(zero_one)]
311310
#![cfg_attr(test, feature(update_panic_count))]
311+
#![cfg_attr(stage0, feature(pub_restricted))]
312312

313313
// Explicitly import the prelude. The compiler uses this same unstable attribute
314314
// to import the prelude implicitly when building crates that depend on std.

src/libsyntax/feature_gate.rs

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,6 @@ declare_features! (
260260
// impl specialization (RFC 1210)
261261
(active, specialization, "1.7.0", Some(31844)),
262262

263-
// pub(restricted) visibilities (RFC 1422)
264-
(active, pub_restricted, "1.9.0", Some(32409)),
265-
266263
// Allow Drop types in statics/const functions (RFC 1440)
267264
(active, drop_types_in_const, "1.9.0", Some(33156)),
268265

@@ -406,6 +403,9 @@ declare_features! (
406403
(accepted, field_init_shorthand, "1.17.0", Some(37340)),
407404
// Allows the definition recursive static items.
408405
(accepted, static_recursion, "1.17.0", Some(29719)),
406+
// pub(restricted) visibilities (RFC 1422)
407+
(accepted, pub_restricted, "1.17.0", Some(32409)),
408+
409409
);
410410
// If you change this, please modify src/doc/unstable-book as well. You must
411411
// move that documentation into the relevant place in the other docs, and
@@ -1410,17 +1410,6 @@ impl<'a> Visitor<'a> for PostExpansionVisitor<'a> {
14101410
visit::walk_impl_item(self, ii);
14111411
}
14121412

1413-
fn visit_vis(&mut self, vis: &'a ast::Visibility) {
1414-
let span = match *vis {
1415-
ast::Visibility::Crate(span) => span,
1416-
ast::Visibility::Restricted { ref path, .. } => path.span,
1417-
_ => return,
1418-
};
1419-
gate_feature_post!(&self, pub_restricted, span, "`pub(restricted)` syntax is experimental");
1420-
1421-
visit::walk_vis(self, vis)
1422-
}
1423-
14241413
fn visit_generics(&mut self, g: &'a ast::Generics) {
14251414
for t in &g.ty_params {
14261415
if !t.attrs.is_empty() {

src/test/compile-fail-fulldeps/auxiliary/pub_and_stability.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
// non-pub fields, marked with SILLY below)
3636

3737
#![feature(staged_api)]
38-
#![feature(pub_restricted)]
3938

4039
#![stable(feature = "unit_test", since = "0.0.0")]
4140

src/test/compile-fail/imports/unused.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(pub_restricted)]
1211
#![deny(unused)]
1312

1413
mod foo {

src/test/compile-fail/privacy/restricted/auxiliary/pub_restricted.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
#![feature(pub_restricted)]
12-
1311
pub(crate) struct Crate;
1412
#[derive(Default)]
1513
pub struct Universe {

0 commit comments

Comments
 (0)