1//! A standalone binary for `proc-macro-srv`.
2//! Driver for proc macro server
3#![cfg_attr(feature = "in-rust-tree", feature(rustc_private))]
4#![cfg_attr(not(feature = "sysroot-abi"), allow(unused_crate_dependencies))]
5#![allow(clippy::print_stderr)]
67#[cfg(feature = "in-rust-tree")]
8extern crate rustc_driver as _;
910#[cfg(any(feature = "sysroot-abi", rust_analyzer))]
11mod main_loop;
12#[cfg(any(feature = "sysroot-abi", rust_analyzer))]
13use main_loop::run;
1415fn main() -> std::io::Result<()> {
16let v = std::env::var("RUST_ANALYZER_INTERNALS_DO_NOT_USE");
17if v.is_err() {
18eprintln!(
19"This is an IDE implementation detail, you can use this tool by exporting RUST_ANALYZER_INTERNALS_DO_NOT_USE."
20);
21eprintln!(
22"Note that this tool's API is highly unstable and may break without prior notice"
23);
24 std::process::exit(122);
25 }
2627 run()
28}
2930#[cfg(not(any(feature = "sysroot-abi", rust_analyzer)))]
31fn run() -> std::io::Result<()> {
32Err(std::io::Error::new(
33 std::io::ErrorKind::Unsupported,
34"proc-macro-srv-cli needs to be compiled with the `sysroot-abi` feature to function"
35.to_owned(),
36 ))
37}