diff options
| author | CorinJG <cogilmore@gmail.com> | 2022-06-10 11:25:47 +0100 |
|---|---|---|
| committer | CorinJG <cogilmore@gmail.com> | 2022-06-10 11:25:47 +0100 |
| commit | 20e166eab45a76ee127e24f196ecdac6378b0e0a (patch) | |
| tree | 724b4b833ee3af69e789d159a89fb39b12f8c6f3 | |
| parent | 3dea0033f7f40fc3a96b728cb2095da91135f0a4 (diff) | |
| download | rust-20e166eab45a76ee127e24f196ecdac6378b0e0a.tar.gz rust-20e166eab45a76ee127e24f196ecdac6378b0e0a.zip | |
Fixed several error_codes/Exxxx.md messages which used UpperCamelCase instead of snake_case for module names
| -rw-r--r-- | compiler/rustc_error_codes/src/error_codes/E0451.md | 12 | ||||
| -rw-r--r-- | compiler/rustc_error_codes/src/error_codes/E0574.md | 10 | ||||
| -rw-r--r-- | compiler/rustc_error_codes/src/error_codes/E0577.md | 12 | ||||
| -rw-r--r-- | compiler/rustc_error_codes/src/error_codes/E0603.md | 10 | ||||
| -rw-r--r-- | compiler/rustc_error_codes/src/error_codes/E0742.md | 16 |
5 files changed, 30 insertions, 30 deletions
diff --git a/compiler/rustc_error_codes/src/error_codes/E0451.md b/compiler/rustc_error_codes/src/error_codes/E0451.md index 821073fe16e..a12378a206d 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0451.md +++ b/compiler/rustc_error_codes/src/error_codes/E0451.md @@ -3,14 +3,14 @@ A struct constructor with private fields was invoked. Erroneous code example: ```compile_fail,E0451 -mod Bar { +mod bar { pub struct Foo { pub a: isize, b: isize, } } -let f = Bar::Foo{ a: 0, b: 0 }; // error: field `b` of struct `Bar::Foo` +let f = bar::Foo{ a: 0, b: 0 }; // error: field `b` of struct `bar::Foo` // is private ``` @@ -18,20 +18,20 @@ To fix this error, please ensure that all the fields of the struct are public, or implement a function for easy instantiation. Examples: ``` -mod Bar { +mod bar { pub struct Foo { pub a: isize, pub b: isize, // we set `b` field public } } -let f = Bar::Foo{ a: 0, b: 0 }; // ok! +let f = bar::Foo{ a: 0, b: 0 }; // ok! ``` Or: ``` -mod Bar { +mod bar { pub struct Foo { pub a: isize, b: isize, // still private @@ -44,5 +44,5 @@ mod Bar { } } -let f = Bar::Foo::new(); // ok! +let f = bar::Foo::new(); // ok! ``` diff --git a/compiler/rustc_error_codes/src/error_codes/E0574.md b/compiler/rustc_error_codes/src/error_codes/E0574.md index 8154d5b782e..4881f61d0bc 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0574.md +++ b/compiler/rustc_error_codes/src/error_codes/E0574.md @@ -4,9 +4,9 @@ expected. Erroneous code example: ```compile_fail,E0574 -mod Mordor {} +mod mordor {} -let sauron = Mordor { x: () }; // error! +let sauron = mordor { x: () }; // error! enum Jak { Daxter { i: isize }, @@ -19,17 +19,17 @@ match eco { ``` In all these errors, a type was expected. For example, in the first error, -we tried to instantiate the `Mordor` module, which is impossible. If you want +we tried to instantiate the `mordor` module, which is impossible. If you want to instantiate a type inside a module, you can do it as follow: ``` -mod Mordor { +mod mordor { pub struct TheRing { pub x: usize, } } -let sauron = Mordor::TheRing { x: 1 }; // ok! +let sauron = mordor::TheRing { x: 1 }; // ok! ``` In the second error, we tried to bind the `Jak` enum directly, which is not diff --git a/compiler/rustc_error_codes/src/error_codes/E0577.md b/compiler/rustc_error_codes/src/error_codes/E0577.md index 1feb9c0acf3..579a8b596e3 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0577.md +++ b/compiler/rustc_error_codes/src/error_codes/E0577.md @@ -3,21 +3,21 @@ Something other than a module was found in visibility scope. Erroneous code example: ```compile_fail,E0577,edition2018 -pub struct Sea; +pub struct sea; -pub (in crate::Sea) struct Shark; // error! +pub (in crate::sea) struct Shark; // error! fn main() {} ``` -`Sea` is not a module, therefore it is invalid to use it in a visibility path. -To fix this error we need to ensure `Sea` is a module. +`sea` is not a module, therefore it is invalid to use it in a visibility path. +To fix this error we need to ensure `sea` is a module. Please note that the visibility scope can only be applied on ancestors! ```edition2018 -pub mod Sea { - pub (in crate::Sea) struct Shark; // ok! +pub mod sea { + pub (in crate::sea) struct Shark; // ok! } fn main() {} diff --git a/compiler/rustc_error_codes/src/error_codes/E0603.md b/compiler/rustc_error_codes/src/error_codes/E0603.md index 69fefce3908..eb293118acc 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0603.md +++ b/compiler/rustc_error_codes/src/error_codes/E0603.md @@ -3,13 +3,13 @@ A private item was used outside its scope. Erroneous code example: ```compile_fail,E0603 -mod SomeModule { +mod foo { const PRIVATE: u32 = 0x_a_bad_1dea_u32; // This const is private, so we // can't use it outside of the - // `SomeModule` module. + // `foo` module. } -println!("const value: {}", SomeModule::PRIVATE); // error: constant `PRIVATE` +println!("const value: {}", foo::PRIVATE); // error: constant `PRIVATE` // is private ``` @@ -17,10 +17,10 @@ In order to fix this error, you need to make the item public by using the `pub` keyword. Example: ``` -mod SomeModule { +mod foo { pub const PRIVATE: u32 = 0x_a_bad_1dea_u32; // We set it public by using the // `pub` keyword. } -println!("const value: {}", SomeModule::PRIVATE); // ok! +println!("const value: {}", foo::PRIVATE); // ok! ``` diff --git a/compiler/rustc_error_codes/src/error_codes/E0742.md b/compiler/rustc_error_codes/src/error_codes/E0742.md index fed9f1f4cee..e10c1639dd3 100644 --- a/compiler/rustc_error_codes/src/error_codes/E0742.md +++ b/compiler/rustc_error_codes/src/error_codes/E0742.md @@ -4,18 +4,18 @@ item. Erroneous code example: ```compile_fail,E0742,edition2018 -pub mod Sea {} +pub mod sea {} -pub (in crate::Sea) struct Shark; // error! +pub (in crate::sea) struct Shark; // error! fn main() {} ``` -To fix this error, we need to move the `Shark` struct inside the `Sea` module: +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! +pub mod sea { + pub (in crate::sea) struct Shark; // ok! } fn main() {} @@ -25,9 +25,9 @@ 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! +pub mod earth { + pub mod sea { + pub (in crate::earth) struct Shark; // ok! } } |
