Skip to content

identify traits in libstd that should use associated constants #17825

Closed
@pnkfelix

Description

@pnkfelix

as a subtask of #17307, once associated constants are implemented, we will want to update libstd to use them, rather than continuing to use methods to encode such constants.

A quick ack of the code base via ack --rust 'fn [^\(\)]*\(\) -> Self' shows the following candidate traits for being modified with associated constants:

  • core::default::Default (but this is probably not a great idea; we probably want to continue allowing arbitrary code to be associated with constructing a default value)
  • various numeric traits (but Gankro points out here that perhaps all of these numeric traits will be scrapped in our stdlib anyway)
    • core::num::Zero
    • core::num::One
    • core::num::Bounded
    • core::num::Float
  • core::ptr::RawPtr<T>

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions