From cf94bdc0742c13e2a0cac864c478b8626b266e1b Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:11:38 +0200 Subject: Merging upstream version 1.66.0+dfsg1. Signed-off-by: Daniel Baumann --- src/bootstrap/tool.rs | 42 +++++++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 15 deletions(-) (limited to 'src/bootstrap/tool.rs') diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs index 7d4ed24b6..eec74b267 100644 --- a/src/bootstrap/tool.rs +++ b/src/bootstrap/tool.rs @@ -698,7 +698,7 @@ pub struct RustAnalyzer { impl Step for RustAnalyzer { type Output = Option; const DEFAULT: bool = true; - const ONLY_HOSTS: bool = false; + const ONLY_HOSTS: bool = true; fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { let builder = run.builder; @@ -742,18 +742,22 @@ pub struct RustAnalyzerProcMacroSrv { impl Step for RustAnalyzerProcMacroSrv { type Output = Option; const DEFAULT: bool = true; - const ONLY_HOSTS: bool = false; + const ONLY_HOSTS: bool = true; fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> { let builder = run.builder; - run.path("src/tools/rust-analyzer").default_condition( - builder.config.extended - && builder - .config - .tools - .as_ref() - .map_or(true, |tools| tools.iter().any(|tool| tool == "rust-analyzer")), - ) + + // Allow building `rust-analyzer-proc-macro-srv` both as part of the `rust-analyzer` and as a stand-alone tool. + run.path("src/tools/rust-analyzer") + .path("src/tools/rust-analyzer/crates/proc-macro-srv-cli") + .default_condition( + builder.config.extended + && builder.config.tools.as_ref().map_or(true, |tools| { + tools.iter().any(|tool| { + tool == "rust-analyzer" || tool == "rust-analyzer-proc-macro-srv" + }) + }), + ) } fn make_run(run: RunConfig<'_>) { @@ -764,7 +768,7 @@ impl Step for RustAnalyzerProcMacroSrv { } fn run(self, builder: &Builder<'_>) -> Option { - builder.ensure(ToolBuild { + let path = builder.ensure(ToolBuild { compiler: self.compiler, target: self.target, tool: "rust-analyzer-proc-macro-srv", @@ -773,7 +777,15 @@ impl Step for RustAnalyzerProcMacroSrv { extra_features: vec!["proc-macro-srv/sysroot-abi".to_owned()], is_optional_tool: false, source_type: SourceType::InTree, - }) + })?; + + // Copy `rust-analyzer-proc-macro-srv` to `/libexec/` + // so that r-a can use it. + let libexec_path = builder.sysroot(self.compiler).join("libexec"); + t!(fs::create_dir_all(&libexec_path)); + builder.copy(&path, &libexec_path.join("rust-analyzer-proc-macro-srv")); + + Some(path) } } @@ -856,12 +868,12 @@ tool_extended!((self, builder), Cargofmt, "src/tools/rustfmt", "cargo-fmt", stable=true, in_tree=true, {}; CargoClippy, "src/tools/clippy", "cargo-clippy", stable=true, in_tree=true, {}; Clippy, "src/tools/clippy", "clippy-driver", stable=true, in_tree=true, {}; - Miri, "src/tools/miri", "miri", stable=false, {}; - CargoMiri, "src/tools/miri/cargo-miri", "cargo-miri", stable=false, {}; - Rls, "src/tools/rls", "rls", stable=true, {}; + Miri, "src/tools/miri", "miri", stable=false, in_tree=true, {}; + CargoMiri, "src/tools/miri/cargo-miri", "cargo-miri", stable=false, in_tree=true, {}; // FIXME: tool_std is not quite right, we shouldn't allow nightly features. // But `builder.cargo` doesn't know how to handle ToolBootstrap in stages other than 0, // and this is close enough for now. + Rls, "src/tools/rls", "rls", stable=true, in_tree=true, tool_std=true, {}; RustDemangler, "src/tools/rust-demangler", "rust-demangler", stable=false, in_tree=true, tool_std=true, {}; Rustfmt, "src/tools/rustfmt", "rustfmt", stable=true, in_tree=true, {}; ); -- cgit v1.2.3