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

Bitflags v2 #259

Merged
merged 1 commit into from May 24, 2023
Merged

Bitflags v2 #259

merged 1 commit into from May 24, 2023

Conversation

tatref
Copy link
Contributor

@tatref tatref commented Mar 17, 2023

Update to bitflags v2, it's a big update

Changelog is not clean yet, so migration path is not complete
See bitflags/bitflags#310

At the moment, I only updated the version, and implemented derived Copy, Clone, Debug, Hash, Eq, PartialEq, PartialOrd, Ord
From the mentioned PR, seems like we'll need to add some repr(transparent) if we want serde to work.

Maybe it's better to wait until the complete migration guide is finished

@tatref
Copy link
Contributor Author

tatref commented May 3, 2023

I rebased from master, it should be good to go

@tatref tatref marked this pull request as ready for review May 3, 2023 20:14
@@ -18,7 +18,7 @@ serde1 = ["serde"]

[dependencies]
backtrace = { version = "0.3", optional = true }
bitflags = "1.2"
bitflags = { version = "2", features = ["serde"] }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will unconditionally bring in serde, right?

To avoid that, I think we can have:

[dependencies]
bitflags = { version = "2" }

[features]
serde1 = ["serde", "bitflags/serde"]

(untested by me)

@tatref
Copy link
Contributor Author

tatref commented May 17, 2023

Sorry i'm not super versed about dependencies/features selection

I tried the two following snippets:

[features]
serde1 = ["serde", "bitflags/serde"]

[dependencies]
bitflags = { version = "2" }
[features]
serde1 = ["serde", "bitflags/serde"]

[dependencies]
bitflags = { version = "2", no-default-features = true }

In both cases, cargo tree gives:

procfs v0.15.1 (/home/tatref/dev/linux-mem/procfs/procfs)
├── bitflags v2.3.1
│   └── serde v1.0.163
...

If I use cargo tree --features serde1, I get an additional serde v1.0.163 as a direct dependency below procfs v0.15.1

Any idea?

@eminence
Copy link
Owner

Did you make the change in both procfs and procfs-core ?

When I make this change locally, here's what I see:

❯ cargo tree 
procfs v0.15.1 (/nas/achin/devel/procfs/procfs)
├── bitflags v2.2.1
❯ cargo tree --features=serde1
procfs v0.15.1 (/nas/achin/devel/procfs/procfs)
├── bitflags v2.2.1
│   └── serde v1.0.152
│       └── serde_derive v1.0.152 (proc-macro)
│           ├── proc-macro2 v1.0.51
│           │   └── unicode-ident v1.0.6
│           ├── quote v1.0.23
│           │   └── proc-macro2 v1.0.51 (*)
│           └── syn v1.0.107
│               ├── proc-macro2 v1.0.51 (*)
│               ├── quote v1.0.23 (*)
│               └── unicode-ident v1.0.6

@tatref
Copy link
Contributor Author

tatref commented May 22, 2023

Seems like this was fixed as part of #270

@eminence eminence merged commit 186504e into eminence:master May 24, 2023
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants