E0463name-resolution

Can't find crate

External crate referenced in code isn't in the build graph.

Repro

extern crate serde;   // E0463: can't find crate `serde`

Why

The crate isn't declared as a dependency. In edition 2018+ you usually don't need extern crate at all — use the dep directly via use serde::.... The error appears when: - Crate missing from Cargo.toml. - Crate name has a typo. - Targeting a feature-gated crate without enabling the feature. - Cross-compiling and the crate isn't built for that target.

Fix

- cargo add serde — Cargo edits the manifest and downloads. - For workspace crates, list the path: mycrate = { path = "../mycrate" }. - Drop extern crate in 2018+ unless you're using #[macro_use] for old-style macro imports. - Run cargo check after each Cargo.toml edit to confirm resolution.

Patterns that solve this