about summary refs log tree commit diff
path: root/src/libsyntax/error_codes.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2019-05-02 02:01:31 +0000
committerbors <bors@rust-lang.org>2019-05-02 02:01:31 +0000
commit767f59462663fbc55a69d39fc5e1f7f83b6fb37d (patch)
tree895cfb402b31011b55559d0acf4cdc5d34326eec /src/libsyntax/error_codes.rs
parentea68bee369c9ebc0de35abcd39211fa0d4f9c84f (diff)
parent4ff12347d994d5c85cab250cedf223d9d0db8973 (diff)
downloadrust-767f59462663fbc55a69d39fc5e1f7f83b6fb37d.tar.gz
rust-767f59462663fbc55a69d39fc5e1f7f83b6fb37d.zip
Auto merge of #60460 - Centril:rollup-gz5bc8i, r=Centril
Rollup of 7 pull requests

Successful merges:

 - #59634 (Added an explanation for the E0704 error.)
 - #60348 (move some functions from parser.rs to diagostics.rs)
 - #60385 (Emit metadata files earlier)
 - #60428 (Refactor `eval_body_using_ecx` so that it doesn't need to query for MIR)
 - #60437 (Ensure that drop order of `async fn` matches `fn` and that users cannot refer to generated arguments.)
 - #60439 (doc: Warn about possible zombie apocalypse)
 - #60452 (Remove Context and ContextKind)

Failed merges:

r? @ghost
Diffstat (limited to 'src/libsyntax/error_codes.rs')
-rw-r--r--src/libsyntax/error_codes.rs30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/libsyntax/error_codes.rs b/src/libsyntax/error_codes.rs
index ac24475cab8..e2d212eb721 100644
--- a/src/libsyntax/error_codes.rs
+++ b/src/libsyntax/error_codes.rs
@@ -363,6 +363,35 @@ and likely to change in the future.
 
 "##,
 
+E0704: r##"
+This error indicates that a incorrect visibility restriction was specified.
+
+Example of erroneous code:
+
+```compile_fail,E0704
+mod foo {
+    pub(foo) struct Bar {
+        x: i32
+    }
+}
+```
+
+To make struct `Bar` only visible in module `foo` the `in` keyword should be
+used:
+```
+mod foo {
+    pub(in crate::foo) struct Bar {
+        x: i32
+    }
+}
+# fn main() {}
+```
+
+For more information see the Rust Reference on [Visibility].
+
+[Visibility]: https://doc.rust-lang.org/reference/visibility-and-privacy.html
+"##,
+
 E0705: r##"
 A `#![feature]` attribute was declared for a feature that is stable in
 the current edition, but not in all editions.
@@ -417,6 +446,5 @@ register_diagnostics! {
     E0693, // incorrect `repr(align)` attribute format
     E0694, // an unknown tool name found in scoped attributes
     E0703, // invalid ABI
-    E0704, // incorrect visibility restriction
     E0717, // rustc_promotable without stability attribute
 }