Skip to content

String has duplicate from_str() functions #16024

Closed
@alexchandel

Description

@alexchandel

One is in impl String in libcollections/string.rs and has the signature fn from_str(string: &str) -> String.

The other is in impl FromStr for String in libstd/from_str.rs and has the signature fn from_str(s: &str) -> Option<String>. In fact, FromStr::from_str() actually calls String::from_str().

This situation probably came about because struct String exists in libcollections, which you could conceivably have without libstd in a freestanding environment, and the FromStr trait lives in libstd.

Conceivably, FromStr could be moved to a different crate, or a dependency on libstd could be introduced to libcollections.

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