Closed
Description
I tried this code:
pub const ITEM: Item = Item;
pub struct Item;
pub fn item() {}
// Glob (*) is required to cause the error
pub use doesnt_exist::*;
mod a {
use crate::{item, Item, ITEM};
}
mod b {
use crate::item;
use crate::Item;
use crate::ITEM;
}
mod c {
use crate::item;
}
(play)
I expected to see an error that only says that "doesnt_exist
is unresolved".
But the error says that all uses of items from the module with glob import (crate
in this case) are unresolved too:
error[E0432]: unresolved imports `doesnt_exist`, `crate::item`, `crate::Item`, `crate::ITEM`, `crate::item`, `crate::Item`, `crate::ITEM`, `crate::item`
--> src/lib.rs:41:9
|
41 | pub use doesnt_exist::*;
| ^^^^^^^^^^^^ use of undeclared crate or module `doesnt_exist`
...
44 | use crate::{item, Item, ITEM};
| ^^^^ ^^^^ ^^^^
...
48 | use crate::item;
| ^^^^^^^^^^^
49 | use crate::Item;
| ^^^^^^^^^^^
50 | use crate::ITEM;
| ^^^^^^^^^^^
...
54 | use crate::item;
| ^^^^^^^^^^^
This may lead to extremely long and unreadable errors. The issue was originally found while developing teloxide
where it caused 1500+ lines error.
Meta
rustc --version --verbose
:
rustc 1.51.0-nightly (c97f11af7 2021-01-10)
binary: rustc
commit-hash: c97f11af7bc4a6d3578f6a953be04ab2449a5728
commit-date: 2021-01-10
host: x86_64-unknown-linux-gnu
release: 1.51.0-nightly