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

Do not suggest internal crates in error messages #34950

Closed
IvanUkhov opened this issue Jul 21, 2016 · 2 comments
Closed

Do not suggest internal crates in error messages #34950

IvanUkhov opened this issue Jul 21, 2016 · 2 comments

Comments

@IvanUkhov
Copy link
Contributor

IvanUkhov commented Jul 21, 2016

The following code:

fn main() {
    let _ = 42.0.ln();
}

produces the following error:

error: no method named `ln` found for type `_` in the current scope
 --> <anon>:2:18
2 |>     let _ = 42.0.ln();
  |>                  ^^
help: items from traits can only be used if the trait is in scope; the following trait is implemented but not in scope, perhaps add a `use` for it:
help: candidate #1: `use rand::FloatMath`

error: aborting due to previous error

The fact that unsuffixed floating-point numbers don’t currently default to f64 has already been discussed in #24124. The point of this issue is the error message: it suggests using rand::FloatMath, which is confusing as it’s an internal crate.

Regards,
Ivan

@Michael-F-Bryan
Copy link

I just got bitten by this one too. The fix is easy (just throw in an as f64), but the fact that you are told you don't have the trait in scope and are told to use an internal crate which is named the same as an external one is super confusing.

Luckily after doing some digging through rand's docs a bit of googling led me to this issue, but it would be really nice if this issue was fixed so others don't have to deal with it.

@Mark-Simulacrum
Copy link
Member

This appears to no longer happen, so I'm going to close. I don't think a test is needed here (we basically test this with other UI tests).

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

3 participants