Skip to content

os::mkdir and friends should maybe not take u32 #6085

Closed
@brson

Description

@brson
Contributor

These are Rust functions, not C.

Activity

sammykim

sammykim commented on May 8, 2013

@sammykim
Contributor

What should it take instead of c_int?

brson

brson commented on May 8, 2013

@brson
ContributorAuthor

Here's some discussion from IRC

22:05 < strcat> brson: well, ideally not an enum
22:05 <@brson> yichoi: graydon could disagree though. I'm not sure what his vision for that module is and 
               he usually likes less abstraction than I
22:05 < strcat> we just need a flag type with | overloaded
22:05 < strcat> and some constants
22:05 < strcat> casting to an int to OR them would be annoying

@thestinger has some opinions

thestinger

thestinger commented on May 8, 2013

@thestinger
Contributor

I think structs are better for flags, because you're not restricted to the pre-defined variants. It wouldn't be safe to OR enum variants together unless you added a variant for each combination (match assumes it knows all of the variants, and so do the loads in the IR now).

It's much nicer to be able to do let base = FlagA | FlagC | FlagE and then call a function with base | FlagB than building up vectors.

brson

brson commented on May 8, 2013

@brson
ContributorAuthor

We might want to use @nikomatsakis' EnumSet: nikomatsakis@75df9af#L10L-1

emberian

emberian commented on Jul 12, 2013

@emberian
Member

Visiting for triage; still relevant. EnumSet still a viable solution.

sammykim

sammykim commented on Sep 3, 2013

@sammykim
Contributor

It's still taking c_int and remains an issue.

martindemello

martindemello commented on Sep 25, 2013

@martindemello
Contributor

I can take a shot at this. Is EnumSet still the way to go? And if so, would it need to be moved into libstd first?

sanxiyn

sanxiyn commented on Oct 21, 2013

@sanxiyn
Member

#8054 moved EnumSet to libextra.

richo

richo commented on Mar 29, 2014

@richo
Contributor

I'm interested in working on this. It looks like EnumSet has landed in core (Based on the hits for git grep EnumSet in the main repo).

Is there anything special I should know before I dive in? (Found this as a result of digging through issues tagged easy to play with)

richo

richo commented on Mar 29, 2014

@richo
Contributor

I did some preliminary work to allow the use of EnumSet in std here: #13196

I'll tentatively start work on porting the permission flags, and then rebase when I found out the fate of that PR.

15 remaining items

Loading
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

    C-cleanupCategory: PRs that clean code up or issues documenting cleanup.E-easyCall for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Participants

      @martindemello@sanxiyn@alexcrichton@brson@richo

      Issue actions

        os::mkdir and friends should maybe not take u32 · Issue #6085 · rust-lang/rust