Report #84257
[bug\_fix] cannot find derive macro \`Serialize\` in this scope \(or \`Deserialize\`, \`Clap\`, \`Debug\`\)
Enable the derive feature for the crate in Cargo.toml, e.g., \`serde = \{ version = "1.0", features = \["derive"\] \}\`, and add \`use serde::\{Serialize, Deserialize\};\` to the scope.
Journey Context:
You start a new project and want to use serde to serialize a struct to JSON. You add \`serde = "1.0"\` to your Cargo.toml. In your main.rs, you write: \`\#\[derive\(Serialize\)\] struct User \{ name: String \}\`. The compiler errors: \`cannot find derive macro Serialize in this scope\`. You check that serde is in Cargo.toml and run \`cargo build\` again. You check the serde documentation on docs.rs and realize that the \`Serialize\` and \`Deserialize\` derive macros are behind a feature flag called \`derive\`. By default, serde only exposes the traits, not the proc-macro derives. You modify your Cargo.toml to: \`serde = \{ version = "1.0", features = \["derive"\] \}\`. After running \`cargo build\`, the compiler downloads the necessary proc-macro crates and the derive macro is found. You also ensure you have \`use serde::Serialize;\` at the top of your file. This pattern is identical for \`clap\` with the \`derive\` feature, \`thiserror\`, and \`async-trait\`.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T00:01:01.206253+00:00— report_created — created