Closed classabbyamp closed 2 years ago
Thanks for the report.
There were some inconsistencies in features dependencies and #[cfg]
, which were corrected in 491d6a626f785ccc154c5654f033cee0da7cf706.
hm, my intention was to not depend on the regex and once_cell crates (I don't need that functionality for what I'm doing). the errors persist with parse-display = { git = "https://github.com/frozenlib/parse-display", branch = "master", default-features = false }
hm, my intention was to not depend on the regex and once_cell crates (I don't need that functionality for what I'm doing).
For now, code generated by #[derive(FromStr)]
requires regex
and once_cell
crates even if it does not use #[from_str(regex = "...")]
.
So, to solve that problem, we need to add a function to generate code that does not use regex
.
the errors persist with
parse-display = { git = "https://github.com/frozenlib/parse-display", branch = "master", default-features = false }
We are getting the errors with the above configuration because parse-display-derive
before the change is used.
If you use the settings below instead, compile errors will disappear.
[dependencies]
parse-display = { version = "0.5.5", default-features = false, features = [ "std" ] }
[patch.crates-io]
parse-display = { git = 'https://github.com/frozenlib/parse-display', branch = 'master' }
when using parse-display without the default features (i.e.
parse-display = {version = "0.5.5", default-features = false, features=["std"]}
), compilation fails despite those dependencies being marked optional. I think this may be related to #2 or possibly missing#[cfg]
attributes.minimal reproducible example:
cargo.toml
src/main.rs
compilation log
```rs Compiling parse-display v0.5.5 Compiling foo v0.1.0 (/tmp/foo) error[E0433]: failed to resolve: could not find `helpers` in `parse_display` --> src/main.rs:3:37 | 3 | #[derive(Debug, Clone, pd::Display, pd::FromStr)] | ^^^^^^^^^^^ could not find `helpers` in `parse_display` | = note: this error originates in the derive macro `pd::FromStr` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0433]: failed to resolve: could not find `helpers` in `parse_display` --> src/main.rs:3:37 | 3 | #[derive(Debug, Clone, pd::Display, pd::FromStr)] | ^^^^^^^^^^^ not found in `parse_display::helpers::once_cell::sync` | = note: this error originates in the derive macro `pd::FromStr` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider importing one of these items | 1 | use core::lazy::Lazy; | 1 | use std::lazy::Lazy; | help: if you import `Lazy`, refer to it directly | 3 - #[derive(Debug, Clone, pd::Display, pd::FromStr)] 3 + #[derive(Debug, Clone, pd::Display, pd::FromStr)] | For more information about this error, try `rustc --explain E0433`. error: could not compile `foo` due to 2 previous errors ```