diff options
| author | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2019-10-14 14:06:54 +0200 |
|---|---|---|
| committer | Guillaume Gomez <guillaume1.gomez@gmail.com> | 2019-10-29 13:56:19 +0100 |
| commit | 208af201ec8a2fc563d58005b1609e02fce9ab5e (patch) | |
| tree | e60245de749380abcca782a7f5bee68406533974 /src | |
| parent | c8420db21d6d64ed9ce8c7937ad7ceda0eee8d20 (diff) | |
| download | rust-208af201ec8a2fc563d58005b1609e02fce9ab5e.tar.gz rust-208af201ec8a2fc563d58005b1609e02fce9ab5e.zip | |
Add long error explanation for E0740
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc_resolve/error_codes.rs | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/src/librustc_resolve/error_codes.rs b/src/librustc_resolve/error_codes.rs index b76373703d1..32e5eb50a76 100644 --- a/src/librustc_resolve/error_codes.rs +++ b/src/librustc_resolve/error_codes.rs @@ -1933,6 +1933,44 @@ struct Foo<X = Box<Self>> { ``` "##, +E0741: r##" +Visibility is restricted to a module which isn't an ancestor of the current +item. + +Erroneous code example: + +```compile_fail,E0741,edition2018 +pub mod Sea {} + +pub (in crate::Sea) struct Shark; // error! + +fn main() {} +``` + +To fix this error, we need to move the `Shark` struct inside the `Sea` module: + +```edition2018 +pub mod Sea { + pub (in crate::Sea) struct Shark; // ok! +} + +fn main() {} +``` + +Of course, you can do it as long as the module you're referring to is an +ancestor: + +```edition2018 +pub mod Earth { + pub mod Sea { + pub (in crate::Earth) struct Shark; // ok! + } +} + +fn main() {} +``` +"##, + ; // E0153, unused error code // E0157, unused error code @@ -1953,5 +1991,4 @@ struct Foo<X = Box<Self>> { // E0470, removed E0577, E0578, - E0740, } |
