schematic icon indicating copy to clipboard operation
schematic copied to clipboard

Compilation error for schematic_macros

Open hamracekk opened this issue 1 year ago • 3 comments

There is an compilation error during the schematic_macro compilation.

error: Unexpected type `lit`
  --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/schematic_macros-0.17.8/src/common/field.rs:44:22
   |
44 |     #[darling(with = "preserve_str_literal", map = "Some")]
   |                      ^^^^^^^^^^^^^^^^^^^^^^

error[E0599]: no function or associated item named `from_attributes` found for struct `common::field::FieldArgs` in the current scope
  --> /usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/schematic_macros-0.17.8/src/common/field.rs:81:31
   |
39 | pub struct FieldArgs {
   | -------------------- function or associated item `from_attributes` not found for this struct
...
81 |         let args = FieldArgs::from_attributes(&field.attrs).unwrap_or_default();
   |                               ^^^^^^^^^^^^^^^ function or associated item not found in `FieldArgs`
   |
   = help: items from traits can only be used if the trait is implemented and in scope
   = note: the following trait defines an item `from_attributes`, perhaps you need to implement it:
           candidate #1: `FromAttributes`

   Compiling tokio-stream v0.1.17
For more information about this error, try `rustc --explain E0599`.
error: could not compile `schematic_macros` (lib) due to 2 previous errors
warning: build failed, waiting for other jobs to finish...

Version

schematic = "=0.17.11"

Do you have any ides what could happen ? Here is the tree version of the package versions:

schematic v0.17.11
├── garde v0.22.0
│   ├── compact_str v0.8.1
│   │   ├── castaway v0.2.3
│   │   │   └── rustversion v1.0.20 (proc-macro)
│   │   ├── cfg-if v1.0.0
│   │   ├── itoa v1.0.15
│   │   ├── rustversion v1.0.20 (proc-macro)
│   │   ├── ryu v1.0.20
│   │   └── static_assertions v1.1.0
│   ├── once_cell v1.21.3
│   ├── regex v1.11.1
│   │   ├── aho-corasick v1.1.3
│   │   │   └── memchr v2.7.4
│   │   ├── memchr v2.7.4
│   │   ├── regex-automata v0.4.9
│   │   │   ├── aho-corasick v1.1.3 (*)
│   │   │   ├── memchr v2.7.4
│   │   │   └── regex-syntax v0.8.5
│   │   └── regex-syntax v0.8.5
│   └── smallvec v1.14.0
├── miette v7.5.0
│   ├── cfg-if v1.0.0
│   ├── miette-derive v7.5.0 (proc-macro)
│   │   ├── proc-macro2 v1.0.94 (*)
│   │   ├── quote v1.0.40 (*)
│   │   └── syn v2.0.100 (*)
│   ├── thiserror v1.0.69
│   │   └── thiserror-impl v1.0.69 (proc-macro)
│   │       ├── proc-macro2 v1.0.94 (*)
│   │       ├── quote v1.0.40 (*)
│   │       └── syn v2.0.100 (*)
│   └── unicode-width v0.1.14
├── schematic_macros v0.17.8 (proc-macro)
│   ├── convert_case v0.7.1
│   │   └── unicode-segmentation v1.12.0
│   ├── darling v0.20.11 (*)
│   ├── proc-macro2 v1.0.94 (*)
│   ├── quote v1.0.40 (*)
│   └── syn v2.0.100 (*)
├── schematic_types v0.9.7
│   └── indexmap v2.8.0
│       ├── equivalent v1.0.2
│       ├── hashbrown v0.15.2
│       └── serde v1.0.219
│           └── serde_derive v1.0.219 (proc-macro)
│               ├── proc-macro2 v1.0.94 (*)
│               ├── quote v1.0.40 (*)
│               └── syn v2.0.100 (*)
├── serde v1.0.219 (*)
├── serde_path_to_error v0.1.17
│   ├── itoa v1.0.15
│   └── serde v1.0.219 (*)
├── starbase_styles v0.4.14
│   ├── dirs v6.0.0
│   │   └── dirs-sys v0.5.0
│   │       ├── libc v0.2.171
│   │       └── option-ext v0.2.0
│   ├── owo-colors v4.2.0
│   └── supports-color v3.0.2
│       └── is_ci v1.2.0
├── thiserror v2.0.12
│   └── thiserror-impl v2.0.12 (proc-macro)
│       ├── proc-macro2 v1.0.94 (*)
│       ├── quote v1.0.40 (*)
│       └── syn v2.0.100 (*)
└── tracing v0.1.41
    ├── log v0.4.27
    ├── pin-project-lite v0.2.16
    ├── tracing-attributes v0.1.28 (proc-macro)
    │   ├── proc-macro2 v1.0.94 (*)
    │   ├── quote v1.0.40 (*)
    │   └── syn v2.0.100 (*)
    └── tracing-core v0.1.33
        └── once_cell v1.21.3

schematic_macros v0.17.8 (proc-macro) (*)

hamracekk avatar Apr 01 '25 15:04 hamracekk

@hamracekk darling released a breaking change in a patch version.

However, this is fixed in 0.18.2.

milesj avatar Apr 01 '25 16:04 milesj

Thank you for reply! The problem is that my project now depends on unstable feature.

error: failed to download `schematic_macros v0.18.2`

Caused by:
  unable to get packages from source

Caused by:
  failed to parse manifest at `/usr/local/cargo/registry/src/index.crates.io-6f17d22bba15001f/schematic_macros-0.18.2/Cargo.toml`

Caused by:
  feature `edition2024` is required

  The package requires the Cargo feature called `edition2024`, but that feature is not stabilized in this version of Cargo (1.84.0 (66221abde 2024-11-19)).
  Consider trying a newer version of Cargo (this may require the nightly release).
  See https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#edition-2024 for more information about the status of this feature.

Can't I use some lower stable version ?

hamracekk avatar Apr 02 '25 08:04 hamracekk

@hamracekk You can try pinning darling in your Cargo.toml to a lower version and see if that works.

darling = "=0.20.10"

milesj avatar Apr 02 '25 14:04 milesj