Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"use not_existing_crate:*;" causes invalid "unresolved imports" compile errors #90248

Closed
ngugcx opened this issue Oct 25, 2021 · 0 comments · Fixed by #94595
Closed

"use not_existing_crate:*;" causes invalid "unresolved imports" compile errors #90248

ngugcx opened this issue Oct 25, 2021 · 0 comments · Fixed by #94595
Assignees
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug.

Comments

@ngugcx
Copy link

ngugcx commented Oct 25, 2021

cargo new test3

Add any valid crate as dep:

[dependencies]
log4rs = "*" 

I tried this code:

use log4rs;
use not_existing_crate::{ * }; // or use not_existing_crate::*;

fn main() {
    println!("Hello, world!");
}

I expected to see only not_existing_crate is reported as "resovled imports".

Instead, this happened:

error[E0432]: unresolved imports `not_existing_crate`, `log4rs`
 --> src/main.rs:1:5
  |
1 | use log4rs;
  |     ^^^^^^
2 | use not_existing_crate::{ * };
  |     ^^^^^^^^^^^^^^^^^^ use of undeclared crate or module `not_existing_crate`

error: aborting due to previous error

For more information about this error, try `rustc --explain E0432`.
error: could not compile `test3`

Meta

rustc --version --verbose:

rustc 1.54.0 (a178d0322 2021-07-26)
binary: rustc
commit-hash: a178d0322ce20e33eac124758e837cbd80a6f633
commit-date: 2021-07-26
host: x86_64-unknown-linux-gnu
release: 1.54.0
LLVM version: 12.0.1

The same error with rust 1.56.0.

@ngugcx ngugcx added the C-bug Category: This is a bug. label Oct 25, 2021
@TaKO8Ki TaKO8Ki self-assigned this Nov 4, 2021
@TaKO8Ki TaKO8Ki added the A-diagnostics Area: Messages for errors, warnings, and lints label Mar 4, 2022
Dylan-DPC added a commit to Dylan-DPC/rust that referenced this issue Mar 4, 2022
…rts-errors-for-asterisk-wildcard-syntax, r=estebank

Fix invalid `unresolved imports` errors for a single-segment import

closes rust-lang#90248
@bors bors closed this as completed in f27466d Mar 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints C-bug Category: This is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants