Skip to content

Commit 06ebda8

Browse files
committed
revise explanation for E0429 (focus on error first)
1 parent a2b7dfa commit 06ebda8

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/librustc_resolve/diagnostics.rs

+7-9
Original file line numberDiff line numberDiff line change
@@ -1030,28 +1030,26 @@ struct Bar2; // ok!
10301030
"##,
10311031

10321032
E0429: r##"
1033-
To import a namespace itself in addition to some of its members, the `self`
1034-
keyword may appear in a brace-enclosed list as the last segment in a `use`
1035-
declaration. However, `self` cannot be used alone, without the brace
1036-
syntax.
1033+
The `self` keyword cannot appear alone as the last segment in a `use`
1034+
declaration.
10371035
10381036
Example of erroneous code:
10391037
10401038
```compile_fail
10411039
use std::fmt::self; // error: `self` imports are only allowed within a { } list
10421040
```
10431041
1044-
If you only want to import the namespace, do so directly:
1042+
To use a namespace itself in addition to some of its members, `self` may appear
1043+
as part of a brace-enclosed list of imports:
10451044
10461045
```
1047-
use std::fmt;
1046+
use std::fmt::{self, Debug};
10481047
```
10491048
1050-
If you also want to import members in the same statement, you may use the brace
1051-
syntax:
1049+
If you only want to import the namespace, do so directly:
10521050
10531051
```
1054-
use std::fmt::{self, Debug};
1052+
use std::fmt;
10551053
```
10561054
"##,
10571055

0 commit comments

Comments
 (0)