Skip to content

Bad use suggestion for RawFloat #56385

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

Closed
lukaslueg opened this issue Nov 30, 2018 · 2 comments
Closed

Bad use suggestion for RawFloat #56385

lukaslueg opened this issue Nov 30, 2018 · 2 comments
Labels
A-diagnostics Area: Messages for errors, warnings, and lints WG-diagnostics Working group: Diagnostics

Comments

@lukaslueg
Copy link
Contributor

fn main() {
 let _ = f32::INFINITY;
}

will error with

  |
3 |  let _ = f32::INFINITY;
  |          ^^^^^^^^^^^^^ associated item not found in `f32`
  |
  = help: items from traits can only be used if the trait is in scope
help: the following trait is implemented but not in scope, perhaps add a `use` for it:
  |
2 | use core::num::dec2flt::rawfp::RawFloat;

The suggestion is both unhelpful and wrong at the same time. Using use core::num::dec2flt::rawfp::RawFloat; would cause a name-error. What we really want here is simply

use std::f32;
@Centril Centril added A-diagnostics Area: Messages for errors, warnings, and lints WG-diagnostics Working group: Diagnostics labels Nov 30, 2018
@Centril
Copy link
Contributor

Centril commented Nov 30, 2018

cc @estebank

@estebank
Copy link
Contributor

Closing as duplicate of #26760.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-diagnostics Area: Messages for errors, warnings, and lints WG-diagnostics Working group: Diagnostics
Projects
None yet
Development

No branches or pull requests

3 participants