Skip to content

API docs misleading about path to from_str_radix method #25517

Closed
@Valloric

Description

@Valloric
  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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions