{"record":{"id":"e14c46da8390e0eb","repo":"embassy-rs/embassy","slug":"multiple-time-driver-xxx-cargo-features-enabled","errorCode":null,"errorMessage":"Multiple time-driver-xxx Cargo features enabled","messagePattern":"Multiple time-driver-xxx Cargo features enabled","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"embassy-mspm0/build.rs","lineNumber":429,"sourceCode":"fn time_driver(singletons: &mut Vec<Singleton>, cfgs: &mut CfgSet) {\n    // Timer features\n    for (timer, _) in TIMERS.iter() {\n        let name = timer.to_lowercase();\n        cfgs.declare(&format!(\"time_driver_{}\", name));\n    }\n\n    let time_driver = match env::vars()\n        .map(|(a, _)| a)\n        .filter(|x| x.starts_with(\"CARGO_FEATURE_TIME_DRIVER_\"))\n        .get_one()\n    {\n        Ok(x) => Some(\n            x.strip_prefix(\"CARGO_FEATURE_TIME_DRIVER_\")\n                .unwrap()\n                .to_ascii_lowercase(),\n        ),\n        Err(GetOneError::None) => None,\n        Err(GetOneError::Multiple) => panic!(\"Multiple time-driver-xxx Cargo features enabled\"),\n    };\n\n    // Verify the selected timer is available\n    let selected_timer = match time_driver.as_ref().map(|x| x.as_ref()) {\n        None => \"\",\n        // TODO: Fix TIMB0\n        // Some(\"timb0\") => \"TIMB0\",\n        Some(\"timg0\") => \"TIMG0\",\n        Some(\"timg1\") => \"TIMG1\",\n        Some(\"timg2\") => \"TIMG2\",\n        Some(\"timg3\") => \"TIMG3\",\n        Some(\"timg4\") => \"TIMG4\",\n        Some(\"timg5\") => \"TIMG5\",\n        Some(\"timg6\") => \"TIMG6\",\n        Some(\"timg7\") => \"TIMG7\",\n        Some(\"timg8\") => \"TIMG8\",\n        Some(\"timg9\") => \"TIMG9\",\n        Some(\"timg10\") => \"TIMG10\",","sourceCodeStart":411,"sourceCodeEnd":447,"githubUrl":"https://github.com/embassy-rs/embassy/blob/463a07b963419a1bfe61d5d597c44acb810afb8b/embassy-mspm0/build.rs#L411-L447","documentation":"embassy-mspm0 supports several time-driver timer choices exposed as `time_driver_<timer>` Cargo features (e.g. time_driver_tima0). The build script's `time_driver` function uses `get_one` to require at most one such feature; when two or more are enabled it panics with this message, failing the build.","triggerScenarios":"Enabling two time-driver features simultaneously, e.g. `features = [\"time_driver_tima0\", \"time_driver_timg0\"]`, or having a dependency enable a different time-driver feature that Cargo unifies with yours.","commonSituations":"Merging two projects' dependency blocks; a BSP crate enabling its own time driver feature; switching drivers by adding the new feature but forgetting to remove the old one.","solutions":["Keep exactly one `time_driver_*` feature (or none, for the default) in your embassy-mspm0 dependency.","Remove the redundant feature: `cargo tree -f '{p} {f}' -i embassy-mspm0` reveals where the extra feature comes from.","If a dependency enables a time driver, use its chosen driver rather than enabling a conflicting one."],"exampleFix":"// before\nfeatures = [\"time_driver_tima0\", \"time_driver_timg0\"]\n// after\nfeatures = [\"time_driver_tima0\"]","handlingStrategy":"validation","validationCode":"// At most one time_driver_* feature:\n// features = [\"mspm0g350x\", \"time_driver_tima0\"]","typeGuard":null,"tryCatchPattern":null,"preventionTips":["When switching time drivers, remove the old feature in the same commit.","Check `cargo tree -f '{p} {f}' -i embassy-mspm0` when a dependency also uses embassy-mspm0.","Omit time_driver features entirely unless you need a non-default timer."],"tags":["rust","build-script","cargo-features","time-driver","conflict"],"backgroundTag":"mutually-exclusive-flags","analyzedSha":"463a07b963419a1bfe61d5d597c44acb810afb8b","analyzedAt":"2026-09-10T13:38:26.660Z","contentChangedAt":"2026-09-10T13:38:26.660Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}