-
Notifications
You must be signed in to change notification settings - Fork 13.1k
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
Unused imports not detected in dependencies #16868
Comments
I don’t think this is a bug in Rust, just a bug in Cargo. I believe Cargo silences the output of compiling dependencies unless they fail. Running rustc dep/dep.rs --crate-name dep --crate-type lib -C metadata=deadbeefdeadbeef -C extra-filename=-deadbeefdeadbeef --out-dir target/deps --dep-info target/.fingerprint/dep-deadbeefdeadbeef/dep-lib-dep -L target/deps -L target/deps Running this command manually gives the warning as it should. Moreover, if use std::iter;
pub fn f() {
let _x: Box<str> = box *"hello world";
} then the warning is printed correctly, followed by the error this code causes (in this case, an ICE). |
Yes, this belongs in the cargo repository. Currently cargo captures all output of the compiler (intentionally) for dependencies, and does not print it by default (which causes the behavior you're seeing). |
Good point! My mistake, thanks! I'll report it on cargo. |
fix: handle attributes when typing curly bracket fix rust-lang#16848. When inserting a `{`, if it is identified that the front part of `expr` is `attr`, we consider it as inserting `{}` around the entire `expr` (excluding the attr part).
I believe the following set-up should trigger unused import warnings in
dep/dep.rs
, but it doesn't!rustc 0.12.0-pre-nightly (2e92c67 2014-08-28 23:56:20 +0000)
Cargo.toml:
main.rs:
dep/Cargo.toml:
dep/dep.rs:
The text was updated successfully, but these errors were encountered: