Error E0425: unresolved name was use

Hi there,

I need some help, I'm using sqlx as follow:

[dependencies.sqlx]
version = "0.5.7"
default-features = false
features = [
  "runtime-actix-rustls",
  "macros",
  "postgres",
  "uuid",
  "chrono",
  "migrate"
]

I found that the E0425 says that unresolved name was use E0425 - Error codes index

I don't know what could it be and stuck here please help

 error[E0425]: cannot find function parse_str in crate syn
   --> /home/ercntreras/.cargo/registry/src/index.crates.io-6f17d22bba15001f/sqlx-macros-0.5.13/src/query/mod.rs:318:46
    |
318 |                 let record_name: Type = syn::parse_str("Record").unwrap();
    |                                              ^^^^^^^^^ not found in syn
    |
note: found an item that was configured out
   --> /home/ercntreras/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-1.0.109/src/lib.rs:917:8
    |
917 | pub fn parse_str<T: parse::Parse>(s: &str) -> Result<T> {
    |        ^^^^^^^^^
note: the item is gated behind the parsing feature
   --> /home/ercntreras/.cargo/registry/src/index.crates.io-6f17d22bba15001f/syn-1.0.109/src/lib.rs:915:7
    |
915 | #[cfg(feature = "parsing")]

version 0.5.7 is a bit old for this active library, did you try the newer version?

1 Like

Your sqlx version is pretty outdated. Is there a reason why you don't use 0.8?

If updating is not an option, you have to enable syn's parsing feature yourself, which is not enabled by sqlx-macros, even though it depends on it being enabled:

[dependencies]
syn = { version = "1", default-features = false, features = ["parsing"] }

Edit: I've not considered that sqlx-macros is a proc-macro crate. I'm not sure how feature unification works for proc-macros, so the suggestion above probably doesn't work.

Thanks, I tried using version "6.0.0" and it works for practical purpose. Before I tried to use version "8" but it says that some features aren't available.

What features? Possibly they were just renamed or the gated functionality was moved to a different feature.

1 Like