Skip to content

libs: clean up enums now that namespacing has arrived #19253

Description

@aturon

Now that enums are namespaced, there's a fair amount of cleanup work to do in libstd.

In particular:

  • During the rollout of the feature, variants were re-exported at the top level to minimize churn. But the new idiom is to keep these items namespaced under the enum. In most cases, these re-exports should be removed.
  • Some variants included prefixes or suffixes in their names as a way to work around the lack of namespacing. These should be renamed.

A lot of this work will happen naturally during API stabilization, but it's also something that can tackled in parallel to help speed things up.

Activity

  1. aturon commented on Nov 23, 2014

    @aturon
    ContributorAuthor
  2. aturon commented on Nov 24, 2014

    @aturon
    ContributorAuthor

    Does someone want to make a list of the various enums this should apply to, so we can triage?

  3. fhartwig commented on Nov 25, 2014

    @fhartwig
    Contributor

    Here's a list of enums whose variants are re-exported, by file:

    • src/libstd/collections/hash/map.rs: Entry
    • src/libstd/collections/hash/table.rs: BucketState
    • src/libstd/dynamic_lib.rs: Rtld
    • src/libstd/io/mod.rs: SeekStyle, FileMode, FileAccess, FileType, IoErrorKind
    • src/libstd/io/net/addrinfo.rs: SocketType, Flag, Protocol
    • src/libstd/io/net/ip.rs: IpAddr
    • src/libstd/io/process.rs: StdioContainer, ProcessExit
    • src/libstd/num/strconv.rs: ExponentFormat, SignificantDigits, SignFormat
    • src/libstd/os.rs: MemoryMapKind, MapOption, MapError
    • src/libstd/path/windows.rs: PathPrefix
    • src/libstd/sys/common/net.rs: SocketStatus, InAddr
    • src/libstd/sys/unix/timer.rs: Req
    • src/libstd/sys/windows/timer.rs: Req
    • src/libcore/cmp.rs Ordering
    • src/libcore/result.rs: Result
    • src/libcore/option.rs: Option
    • src/libcollections/str.rs: MaybeOwned

    I hope I haven't missed any.
    Apart from Result, Option and (maybe) Ordering, I don't think any of these need to have their variants re-exported.

  4. sfackler commented on Nov 25, 2014

    @sfackler
    Member

    We don't really need to reexport Result's, Option's and Ordering's either since everyone will be pulling them from the prelude anyway.

  5. frewsxcv commented on Nov 27, 2014

    @frewsxcv
    Contributor

    @sfackler I'll open a PR that gets rid of those reexports. If anyone has other suggestions for ones to get rid of, I can do them as well

  6. 53 remaining items

  7. added a commit that references this issue on Dec 25, 2014
  8. added a commit that references this issue on Dec 31, 2014
  9. added a commit that references this issue on Jan 2, 2015
  10. steveklabnik commented on Feb 15, 2015

    @steveklabnik
    Contributor

    I think this is done now, please let me know if there's anything left oustanding.

  11. added a commit that references this issue on Mar 28, 2017
  12. added a commit that references this issue on Mar 2, 2019
  13. added a commit that references this issue on Mar 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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