From 2be37ad42197f202dfb87c073cb0c6b5e9e5b2ec Mon Sep 17 00:00:00 2001 From: Christian Date: Sat, 20 Apr 2019 17:59:47 +0200 Subject: [PATCH] Added the E0704 error with a link to the Rust reference. --- src/libsyntax/error_codes.rs | 30 ++++++++++++++++++++++++++- src/test/ui/pub/pub-restricted.stderr | 1 + 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/src/libsyntax/error_codes.rs b/src/libsyntax/error_codes.rs index ac24475cab89f..e2d212eb721ff 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 } diff --git a/src/test/ui/pub/pub-restricted.stderr b/src/test/ui/pub/pub-restricted.stderr index 044e5fc5188e6..7eeefa9550543 100644 --- a/src/test/ui/pub/pub-restricted.stderr +++ b/src/test/ui/pub/pub-restricted.stderr @@ -50,3 +50,4 @@ LL | pub (in x) non_parent_invalid: usize, error: aborting due to 5 previous errors +For more information about this error, try `rustc --explain E0704`.