-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Misleading "error: source trait is private" when a trait is not imported #22050
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
Comments
The new error message would need to be something like "error: source trait not found" I guess ? |
For what it's worth, I was confused by this issue today. I was trying to use methods on quickcheck's I tried adding [dependencies]
rand = "*" This wasn't obvious to me at all. |
me too |
So should I replace it by "error: source trait not found" ? |
I would argue it should be
Because that's what happens when you do something like
|
@GuillaumeGomez That would be clearer, yep. It could also suggest adding an |
well, i guess that's different code than the OP's. Basically, the error should mirror what happens when it doesn't exist |
Am I wrong to expect
Possibly with a hint about importing the correct trait. Y'know like it usually happens. |
Also expecting the error message @gkoz mentions. What is different about this than, for example: let mut buf=[0u8;32];
(&mut buf[..]).write_all(&b"test"); which yields
|
Got the same problem (1.8.0): //extern crate num;
extern crate nalgebra;
pub fn fps_look_at<T: nalgebra::BaseFloat>(eye: Vector3<T>, pitch: T, yaw: T) -> Matrix4<T> {
let (sin_pitch, cos_pitch) = pitch.sin_cos();
} Gives the user no hints where to search for the If the compiler knows which is the private trait that is missing, an useful message could show that name as @steveklabnik suggested. Even better with the suggested Update: Even better, on the latest nightly there is no need to include the This issue is perhaps obsolete and can be closed. |
This example uses
rust-crypto 0.2.14
. Failing to import theEncryptor
trait that implementsencrypt
causes an unexpected error message. The trait isn't private and importing it compiles as expected.rustc 1.0.0-nightly (706be5ba1 2015-02-05 23:14:28 +0000)
The text was updated successfully, but these errors were encountered: