Comments (11)
Fine after a cargo clean...
from strum.
Thanks for reporting this issue! I'm not able to repro it though :( Could you let me know what version of rustc you're using, and potentially try running cargo clean
before you build if you've got a little time?
from strum.
Oh, actually the issue is when running clippy!
"cargo" "clippy" "--" "-W" "clippy::cast_possible_truncation" "-W" "clippy::cast_sign_loss" "-W" "clippy::fallible_impl_from" "-W" "clippy::cast_precision_loss" "-W" "clippy::cast_possible_wrap" "-W" "clippy::print_stdout" "-W" "clippy::dbg_macro" "-D" "warnings"
▶ rustc --version
rustc 1.35.0-nightly (96d700f1b 2019-04-10)
▶ cargo clippy --version
clippy 0.0.212 (37f5c1ec 2019-04-09)
from strum.
To reproduce, check out 864-ethereum-htlc-crate
branch of https://github.com/comit-network/comit-rs
Update strum from 0.14
to 0.15
in ./vendor/blockchain_contracts/Cargo.toml
run the clippy command above
from strum.
I upgraded to nightly-2019-04-30
and it is fine now. Maybe it's just me...
from strum.
Ok so now it fails on travis: https://travis-ci.com/comit-network/comit-rs/builds/110209768
If you checkout https://github.com/comit-network/comit-rs branch strum
and run the clippy command: "cargo" "clippy" "--" "-W" "clippy::cast_possible_truncation" "-W" "clippy::cast_sign_loss"
you should be able to reproduce the issue.
from strum.
I think I understand what is happening. This seems like a psuedo-diamond-dependency issue.
0.15
added the ability to rename packages using feature flags, and in your repo, this file sets the "verbose-display-name" feature flag which changes the plugin from Display
to StrumDisplay
. That appears to be changing the name globally across all your crates.
I was able to set up a tiny repro with 2 crates in the same cargo "workspace." One of them set "verbose-display-name" and the other doesn't. If I call cargo build
in the root it fails because Display
cannot be found. If I cd
into each directory individually though, both build separately. Cargo can't seem to use different combinations of feature flags in the same workspace.
This seems to be a cargo issue (by design?).
from strum.
@Peternator7 alright, make sense. Any chance you could push the tiny repo somewhere so we can report the issue to cargo?
from strum.
That appears to be changing the name globally across all your crates.
I think, this is actually expected behaviour within cargo/rust. As soon as there is a dependency within your dependency tree that enables a certain feature, you cannot depend on the same dependency without that feature. I am not sure but depending on different versions might work because they result in different binary code.
from strum.
I peeked at your code. Macro renaming is mostly for old versions of rustc
. If you're importing derives by path, you shouldn't need to use them. You can do this:
#[derive(Clone, Copy, strum_macros::Display, Debug, Serialize)]
#[strum(serialize_all = "snake_case")]
pub enum DataName {
SecretHash,
Expiry,
RedeemIdentity,
RefundIdentity,
TokenQuantity,
TokenContract,
}
Edit: I will also acknowledge that it's perhaps not worth fixing if it works :)
from strum.
Thanks!
from strum.
Related Issues (20)
- enum_messages and enum_discriminants tests are broken HOT 1
- Enhancement: Better ParseError HOT 2
- Question about effect on memory allocation HOT 2
- Preserve leading underscores in generated `Ident`s
- 0.24.1 change to automatically implement `TryFrom` has unforeseen migration issues HOT 4
- 0.24.1 Yanked HOT 3
- Enum iterators trigger lints which can't be easily silenced HOT 2
- Allow to get a EnumDiscriminants without consuming the value HOT 2
- EnumIter should implement Debug
- Extend #[strum(serialize)] to include sum type fields HOT 3
- Why possible values VARIANTS can not work with case insensitive enum? HOT 2
- Generating strong ordinal values independent of discriminants
- Visibility for EnumIter HOT 3
- clippy::use_self HOT 1
- Allow to set integer values for EnumDiscriminants HOT 2
- support for no_std? HOT 1
- Disabled variant still included in VariantNames HOT 1
- Feature Request: Add attribute for types that don't implement Default HOT 5
- Ordering guarantees on EnumIter?
- feature request: AsRefStr using the discriminant as UTF-8 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from strum.