Skip to content

Commit 7e2ec68

Browse files
committed
---
yaml --- r: 210655 b: refs/heads/try c: f3a3684 h: refs/heads/master i: 210653: 55166c2 210651: d2e71c5 210647: e520536 210639: a7eb9b2 210623: e2c663d v: v3
1 parent 11d0fc9 commit 7e2ec68

File tree

2 files changed

+33
-2
lines changed

2 files changed

+33
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: 3e561f05c00cd180ec02db4ccab2840a4aba93d2
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: ba0e1cd8147d452c356aacb29fb87568ca26f111
5-
refs/heads/try: c0412bcad69d95e217211bf6be925802004e4b17
5+
refs/heads/try: f3a3684614c0baf01e2d22e662b67e6a1408b718
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
88
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596

branches/try/src/librustc_resolve/diagnostics.rs

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,38 @@
1515
// In vim you can `:set tw=80` and use `gq` to wrap paragraphs. Use `:set tw=0` to disable.
1616
register_long_diagnostics! {
1717

18+
E0154: r##"
19+
Imports (`use` statements) are not allowed after non-item statements, such as
20+
variable declarations and expression statements.
21+
22+
Wrong example:
23+
```
24+
fn f() {
25+
// Variable declaration before import
26+
let x = 0;
27+
use std::io::Read;
28+
...
29+
}
30+
```
31+
32+
The solution is to declare the imports at the top of the block, function, or
33+
file.
34+
35+
Here is the previous example again, with the correct order:
36+
```
37+
fn f() {
38+
use std::io::Read;
39+
let x = 0;
40+
...
41+
}
42+
```
43+
44+
See the Declaration Statements section of the reference for more information
45+
about what constitutes an Item declaration and what does not:
46+
47+
http://doc.rust-lang.org/reference.html#statements
48+
"##,
49+
1850
E0317: r##"
1951
User-defined types or type parameters cannot shadow the primitive types.
2052
This error indicates you tried to define a type, struct or enum with the same
@@ -29,7 +61,6 @@ http://doc.rust-lang.org/reference.html#types
2961
}
3062

3163
register_diagnostics! {
32-
E0154,
3364
E0157,
3465
E0153,
3566
E0251, // a named type or value has already been imported in this module

0 commit comments

Comments
 (0)