Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move uses of enum to bitflags! where appropriate #14207

Closed
aturon opened this issue May 14, 2014 · 3 comments
Closed

Move uses of enum to bitflags! where appropriate #14207

aturon opened this issue May 14, 2014 · 3 comments
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.

Comments

@aturon
Copy link
Member

aturon commented May 14, 2014

Where an enum has been used to represent C-style flags (which are then |-ed together and represented as some flavor of uint), we should now be using the bitflags! macro, which provides stronger type safety guarantees at no cost.

This gist gives a rough grep of the code base where enums with custom discriminants are being used. Some of these are genuinely enums, while others are being used as flags and should be converted to use bitflags! instead.

@richo
Copy link
Contributor

richo commented May 14, 2014

Happy to work on this, took a stab at it a while ago using EnumSet, keen for round 2.

@aturon
Copy link
Member Author

aturon commented May 14, 2014

@richo Great! Let me know if I can help, and I'd be happy to review a PR once it's ready.

@aturon
Copy link
Member Author

aturon commented Feb 16, 2015

I'm going to close this for now, since bitflags has been moved out of tree and our long-term story here isn't so clear.

@aturon aturon closed this as completed Feb 16, 2015
lnicola pushed a commit to lnicola/rust that referenced this issue Mar 13, 2023
Respect $CARGO_HOME when looking up toolchains.

Some people set `$CARGO_HOME` to a location other than `~/.cargo` (`$XDG_DATA_DIR/cargo`,  in my case), and I'd be a little nicer if the rust-analyzer extension and server respect that value when looking up toolchains, instead of having us configure all of `$CARGO`, `$RUSTC` ... manually.

The new implementation still defaults to `~/.cargo` if `$CARGO_HOME` is unset, pretty much like cargo itself does (as documented in https://doc.rust-lang.org/cargo/guide/cargo-home.html), so the change is backwards compatible for most people except those who has configured `$CARGO_HOME` explicitly.

I considered using https://crates.io/crates/home as suggested by https://doc.rust-lang.org/cargo/guide/cargo-home.html, but decided to put int on hold because i) we need mirror impl in node, ii) I thought the consistency matters more and iii) the new implementation shouldn't be worse than the current one (i.e. switching to `home` improvement is rather orthogonal and could be done in another PR). If you have any directions on this, please let me know.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
E-easy Call for participation: Easy difficulty. Experience needed to fix: Not much. Good first issue.
Projects
None yet
Development

No branches or pull requests

2 participants