]> git.proxmox.com Git - rustc.git/blob - src/librustc_error_codes/error_codes/E0154.md
New upstream version 1.41.1+dfsg1
[rustc.git] / src / librustc_error_codes / error_codes / E0154.md
1 #### Note: this error code is no longer emitted by the compiler.
2
3 Imports (`use` statements) are not allowed after non-item statements, such as
4 variable declarations and expression statements.
5
6 Here is an example that demonstrates the error:
7
8 ```
9 fn f() {
10 // Variable declaration before import
11 let x = 0;
12 use std::io::Read;
13 // ...
14 }
15 ```
16
17 The solution is to declare the imports at the top of the block, function, or
18 file.
19
20 Here is the previous example again, with the correct order:
21
22 ```
23 fn f() {
24 use std::io::Read;
25 let x = 0;
26 // ...
27 }
28 ```
29
30 See the Declaration Statements section of the reference for more information
31 about what constitutes an Item declaration and what does not:
32
33 https://doc.rust-lang.org/reference.html#statements