Skip to content

API docs misleading about path to from_str_radix method #25517

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
Valloric opened this issue May 17, 2015 · 0 comments · Fixed by #25583
Closed

API docs misleading about path to from_str_radix method #25517

Valloric opened this issue May 17, 2015 · 0 comments · Fixed by #25583

Comments

@Valloric
Copy link
Contributor

  1. Go to stable API docs: http://doc.rust-lang.org/stable/std/
  2. In search bar, type "radix".
  3. See tons of std::[type]::from_str_radix methods. Pick std::u32::from_str_radix, click it and read the docs for it.
  4. Try to use it like so (playpen link):
fn main() {
  println!("{}" , std::u32::from_str_radix("1", 16).unwrap()); 
}

Output:

<anon>:3:19: 3:43 error: unresolved name `std::u32::from_str_radix`
<anon>:3   println!("{}" , std::u32::from_str_radix("1", 16).unwrap()); 
                           ^~~~~~~~~~~~~~~~~~~~~~~~

Now bang your head for half an hour until you randomly call the method with u32::from_str_radix, so without the std prefix, in spite of the path provided in the API search box. :)

This code works:

fn main() {
  println!("{}" , u32::from_str_radix("1", 16).unwrap()); 
}

@steveklabnik

steveklabnik added a commit to steveklabnik/rust that referenced this issue May 18, 2015
steveklabnik added a commit to steveklabnik/rust that referenced this issue May 18, 2015
steveklabnik added a commit to steveklabnik/rust that referenced this issue May 18, 2015
steveklabnik added a commit to steveklabnik/rust that referenced this issue May 19, 2015
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

Successfully merging a pull request may close this issue.

2 participants