rust-lang/cargo · error
not implemented
Error message
not implemented
What it means
Cargo's new feature resolver (enabled via -Z features) supports several sub-flags (build_dep, host_dep, dev_dep, itarget, all, compare). The 'ws' (workspace-unified feature resolution) sub-flag is declared in the match but not yet implemented, so it triggers unimplemented!(). This is nightly-only unstable functionality.
Solutions
- Remove 'ws' from the -Z features value (use combinations of build_dep/host_dep/dev_dep/itarget/all/compare instead).
- Use the stabilized resolver v2/v3 (resolver = "2"/"3" in Cargo.toml) which enables 'all' automatically, instead of the unstable 'ws' flag.
- Upgrade or downgrade nightly to a version where 'ws' is implemented, if applicable.
Example fix
// before "ws" => unimplemented!(), // after (user side) // cargo build -Z features=ws -> remove // cargo build -Z features=all
Defensive patterns
Strategy: validation
Validate before calling
// Validate the -Z features value before running Cargo
let allowed = ["build_dep","host_dep","dev_dep","itarget","all","compare"];
for f in features_value.split(',') {
if !allowed.contains(&f) {
eprintln!("flag `{f}` is not implemented; remove it (notably 'ws')");
}
} Type guard
null
Try / catch
null
Prevention
- Never include 'ws' in -Z features; it is unimplemented.
- Prefer stabilized resolver v2/v3 over unstable -Z features flags.
- Pin nightly versions in CI and test flag combinations.
When it happens
Trigger: Invoking Cargo with `-Z features=ws` on a nightly toolchain. FeatureOpts::new matches the 'ws' token and panics. Note: because this runs inside the resolver, the panic surfaces as a crash rather than a clean error.
Common situations: Experimenting with unstable Cargo feature flags; copy-pasting a flag list that includes 'ws' from docs/PRs; CI on nightly where 'ws' was advertised but not stabilized.
Related errors
- parsing ` ` requires `-Zscript
- parsing ` ` requires `-Zscript
- artifact-dir was not locked during clean
- cannot publish with `open-namespaces`
- lock file version ` ` requires `-Znext-lockfile-bump
AI-assisted analysis of rust-lang/cargo@42eee92bc9 (2026-08-11).
Data as JSON: /api/errors/e3f199f3bb3b1dbe.
Report an issue: GitHub.
Appendix: source
Thrown at src/resolver/features.rs:189
ws: &Workspace<'_>,
has_dev_units: HasDevUnits,
force_all_targets: ForceAllTargets,
) -> CargoResult<FeatureOpts> {
let mut opts = FeatureOpts::default();
let unstable_flags = ws.gctx().cli_unstable();
let mut enable = |feat_opts: &Vec<String>| {
for opt in feat_opts {
match opt.as_ref() {
"build_dep" | "host_dep" => opts.decouple_host_deps = true,
"dev_dep" => opts.decouple_dev_deps = true,
"itarget" => opts.ignore_inactive_targets = true,
"all" => {
opts.decouple_host_deps = true;
opts.decouple_dev_deps = true;
opts.ignore_inactive_targets = true;
}
"compare" => opts.compare = true,
"ws" => unimplemented!(),
s => bail!("-Zfeatures flag `{}` is not supported", s),
}
}
Ok(())
};
if let Some(feat_opts) = unstable_flags.features.as_ref() {
enable(feat_opts)?;
}
match ws.resolve_behavior() {
ResolveBehavior::V1 => {}
ResolveBehavior::V2 | ResolveBehavior::V3 => {
enable(&vec!["all".to_string()]).unwrap();
}
}
if let HasDevUnits::Yes = has_dev_units {
// Dev deps cannot be decoupled when they are in use.
opts.decouple_dev_deps = false;
}View on GitHub (pinned to 42eee92bc9)