Skip to content

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

Closed
@ngugcx

Description

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

A-diagnosticsArea: Messages for errors, warnings, and lintsC-bugCategory: This is a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions