diff options
| author | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2016-06-06 06:48:32 +0300 |
|---|---|---|
| committer | Eduard-Mihai Burtescu <edy.burt@gmail.com> | 2016-06-06 06:48:32 +0300 |
| commit | 0e98d1dc8f96d46662efb35d5a1a29f79e98fe48 (patch) | |
| tree | ec9fc4e69e5f9ae3506de67a52acbf3f95356a2c | |
| parent | a8ab762ea3a1dcc635817c2c8c3300225a32e969 (diff) | |
| parent | 06ebda837e50634cd1a73d54ce36a6fdec9688c5 (diff) | |
| download | rust-0e98d1dc8f96d46662efb35d5a1a29f79e98fe48.tar.gz rust-0e98d1dc8f96d46662efb35d5a1a29f79e98fe48.zip | |
Rollup merge of #33955 - zackmdavis:explain_E0429, r=GuillaumeGomez
add explanation for E0429 (`self` use declaration must use brace syntax) This is an item under #32777. r? @GuillaumeGomez
| -rw-r--r-- | src/librustc_resolve/diagnostics.rs | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/src/librustc_resolve/diagnostics.rs b/src/librustc_resolve/diagnostics.rs index b576f77dbd7..97b57f231b9 100644 --- a/src/librustc_resolve/diagnostics.rs +++ b/src/librustc_resolve/diagnostics.rs @@ -1029,6 +1029,30 @@ struct Bar2; // ok! ``` "##, +E0429: r##" +The `self` keyword cannot appear alone as the last segment in a `use` +declaration. + +Example of erroneous code: + +```compile_fail +use std::fmt::self; // error: `self` imports are only allowed within a { } list +``` + +To use a namespace itself in addition to some of its members, `self` may appear +as part of a brace-enclosed list of imports: + +``` +use std::fmt::{self, Debug}; +``` + +If you only want to import the namespace, do so directly: + +``` +use std::fmt; +``` +"##, + E0430: r##" The `self` import appears more than once in the list. Erroneous code example: @@ -1235,5 +1259,4 @@ register_diagnostics! { E0420, // is not an associated const E0421, // unresolved associated const E0427, // cannot use `ref` binding mode with ... - E0429, // `self` imports are only allowed within a { } list } |
