about summary refs log tree commit diff
path: root/src/test/auxiliary
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2016-04-16 16:21:09 -0700
committerbors <bors@rust-lang.org>2016-04-16 16:21:09 -0700
commitae33aa74f4e03b11a9a82e10dbf7369c3ae6bd04 (patch)
tree285c01dd08e9c3f426d99beeacba4e1e288297b1 /src/test/auxiliary
parenta7c3a294bf33880d27fc7c3f662a981b1625c0bb (diff)
parente14504a113b55c09686a5986c51bbdd6ae9c5da4 (diff)
downloadrust-ae33aa74f4e03b11a9a82e10dbf7369c3ae6bd04.tar.gz
rust-ae33aa74f4e03b11a9a82e10dbf7369c3ae6bd04.zip
Auto merge of #32875 - jseyfried:1422_implementation, r=nikomatsakis
Implement `pub(restricted)` privacy (RFC 1422)

This implements `pub(restricted)` privacy from RFC 1422 (cc #32409) behind a feature gate.

`pub(restricted)` paths currently cannot use re-exported modules both for simplicity of implementation and for future compatibility with RFC 1560 (cf #31783).

r? @nikomatsakis
Diffstat (limited to 'src/test/auxiliary')
-rw-r--r--src/test/auxiliary/pub_restricted.rs23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/test/auxiliary/pub_restricted.rs b/src/test/auxiliary/pub_restricted.rs
new file mode 100644
index 00000000000..b1c88ce6ce5
--- /dev/null
+++ b/src/test/auxiliary/pub_restricted.rs
@@ -0,0 +1,23 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+#![feature(pub_restricted)]
+
+pub(crate) struct Crate;
+#[derive(Default)]
+pub struct Universe {
+    pub x: i32,
+    pub(crate) y: i32
+}
+
+impl Universe {
+    pub fn f(&self) {}
+    pub(crate) fn g(&self) {}
+}