Skip to content

Commit 8787237

Browse files
Add E0254 error explanation
1 parent 41fe4b7 commit 8787237

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

src/librustc_resolve/diagnostics.rs

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,45 @@ fn main() {}
153153
It's invalid to directly import methods belonging to a trait or concrete type.
154154
"##,
155155

156+
E0254: r##"
157+
Attempt was made to import an item whereas an extern crate with this name has
158+
already been imported.
159+
160+
Erroneous code example:
161+
162+
```compile_fail,E0254
163+
extern crate collections;
164+
165+
mod foo {
166+
pub trait collections {
167+
fn do_something();
168+
}
169+
}
170+
171+
use foo::collections; // error: an extern crate named `collections` has already
172+
// been imported in this module
173+
174+
fn main() {}
175+
```
176+
177+
To fix issue issue, you have to rename at least one of the two imports.
178+
Example:
179+
180+
```ignore
181+
extern crate collections as libcollections; // ok!
182+
183+
mod foo {
184+
pub trait collections {
185+
fn do_something();
186+
}
187+
}
188+
189+
use foo::collections;
190+
191+
fn main() {}
192+
```
193+
"##,
194+
156195
E0255: r##"
157196
You can't import a value whose name is the same as another value defined in the
158197
module.
@@ -1237,7 +1276,6 @@ impl Foo for i32 {}
12371276
register_diagnostics! {
12381277
// E0153, unused error code
12391278
// E0157, unused error code
1240-
E0254, // import conflicts with imported crate in this module
12411279
// E0257,
12421280
// E0258,
12431281
E0402, // cannot use an outer type parameter in this context

0 commit comments

Comments
 (0)