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

unused imports not all detected #16287

Closed
bfops opened this issue Aug 6, 2014 · 3 comments
Closed

unused imports not all detected #16287

bfops opened this issue Aug 6, 2014 · 3 comments

Comments

@bfops
Copy link
Contributor

bfops commented Aug 6, 2014

Sorry, I don't have a minimal repro.

The following commit (I believe) has all unused imports removed: bfops/playform@c4f7351.

However, applying the following patch still builds fine, with no unused import warnings or errors:

diff --git a/Cargo.toml b/Cargo.toml
index 3e6910f..2b32761 100755
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -19,6 +19,9 @@ git = "https:/bjz/gl-rs"
[dependencies.sdl2_game_window]
git = "https:/bfops/sdl2_game_window"

+[dependencies.cgmath]
+git = "https:/bjz/cgmath-rs"
+
[dependencies.piston]
git = "https:/PistonDevelopers/piston"

diff --git a/src/glw.rs b/src/glw.rs
index 56bcd4d..54ae3aa 100644
--- a/src/glw.rs
+++ b/src/glw.rs
@@ -4,6 +4,7 @@
//! GLW stands for "OpenGL wrapper".
+#[deny(unused_imports)]
pub use color::Color4;
+pub use cgmath::matrix::Matrix4;
use cstr_cache;
use libc::types::common::c95;
use nalgebra::na::{Mat3, Mat4, Vec3, Eye, Outer};
diff --git a/src/playform.rs b/src/playform.rs
index c2ef41b..05de4a2 100644
--- a/src/playform.rs
+++ b/src/playform.rs
@@ -10,6 +10,7 @@
// to disable warnings only in a macro.
#![allow(unused_unsafe)]

+extern crate cgmath;
extern crate gl;
extern crate libc;
extern crate nalgebra;

rustc 0.12.0-pre-nightly (25741603f 2014-08-03 23:46:10 +0000)

@alexcrichton
Copy link
Member

The only import you've added here is a pub use which are all whitelisted for unused imports. Is there another specific import you're thinking this should have warned about?

@bfops
Copy link
Contributor Author

bfops commented Aug 6, 2014

Oh, you're right. I guess I was expecting that something like this would generate at least a warning:

pub use std::cmp;

pub struct Vec3;

pub fn foo() {}

pub fn main() {
}

Especially since this does:

mod test;

pub fn main() {
}

test.rs:

pub fn foo () {}

@alexcrichton
Copy link
Member

Ok, in that case I'm going to close this as intended. Resolve doesn't currently warn about any pub use imports as it's undecided whether they're used because they could later be used by future crates for example.

lnicola pushed a commit to lnicola/rust that referenced this issue Aug 29, 2024
…ebold

internal: Be more resilient to bad language item definitions in binop inference

Fixes rust-lang#16287
Fixes rust-lang#16286

There's one more in `write_fn_trait_method_resolution`, but I'm not sure if it won't cause further problems in `infer_closures`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants