{"record":{"id":"b9dd6855d8220d25","repo":"rust-lang/rust-analyzer","slug":"proc-macro-srv-cli-needs-to-be-compiled-with-the","errorCode":null,"errorMessage":"proc-macro-srv-cli needs to be compiled with the `in-rust-tree` feature to function","messagePattern":"proc-macro-srv-cli needs to be compiled with the `in-rust-tree` feature to function","errorType":"error_code","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"crates/proc-macro-srv-cli/src/main.rs","lineNumber":100,"sourceCode":"\n    fn from_str(input: &str, _ignore_case: bool) -> Result<Self, String> {\n        match input {\n            \"json-legacy\" => Ok(ProtocolFormatArg(ProtocolFormat::JsonLegacy)),\n            \"bidirectional-postcard-prototype\" => {\n                Ok(ProtocolFormatArg(ProtocolFormat::BidirectionalPostcardPrototype))\n            }\n            _ => Err(format!(\"unknown protocol format: {input}\")),\n        }\n    }\n}\n\n#[cfg(not(feature = \"in-rust-tree\"))]\nfn run(\n    _: &mut std::io::BufReader<std::io::Stdin>,\n    _: &mut std::io::Stdout,\n    _: ProtocolFormat,\n) -> std::io::Result<()> {\n    Err(std::io::Error::new(\n        std::io::ErrorKind::Unsupported,\n        \"proc-macro-srv-cli needs to be compiled with the `in-rust-tree` feature to function\"\n            .to_owned(),\n    ))\n}\n","sourceCodeStart":82,"sourceCodeEnd":106,"githubUrl":"https://github.com/rust-lang/rust-analyzer/blob/e8f7e90aa3e7b26aa9a000200f606c1078da99ec/crates/proc-macro-srv-cli/src/main.rs#L82-L106","documentation":"This error is returned by the stub `run` function that is compiled when the `in-rust-tree` cargo feature is disabled. The binary ships two implementations of `run`: a real one that reads requests from stdin and dispatches proc-macro expansions, and this no-op guard that simply errors out. It fires whenever the user invokes proc-macro-srv-cli built without the feature, because only `in-rust-tree` builds link against the rustc driver and the proc-macro bridge needed to expand macros; a standalone build has no expansion backend, so any attempt to run it aborts immediately with this sentinel error.","triggerScenarios":"Thrown at crates/proc-macro-srv-cli/src/main.rs:100 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Rebuild or reinstall the binary with the `in-rust-tree` feature enabled (e.g. `cargo build --features in-rust-tree`)","Use the rustup-distributed rust-analyzer, whose proc-macro-srv component is built in-tree with the required feature","Prefer invoking proc-macro expansion through rust-analyzer, which spawns a compatible proc-macro-srv automatically"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e8f7e90aa3e7b26aa9a000200f606c1078da99ec","analyzedAt":"2026-09-03T21:08:06.959Z","contentChangedAt":"2026-09-03T21:08:06.959Z","schemaVersion":2},"datasetVersion":"2026-09-11T07:07:21.782Z"}