summaryrefslogtreecommitdiffstats
path: root/src/bootstrap/tool.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:03 +0000
commit64d98f8ee037282c35007b64c2649055c56af1db (patch)
tree5492bcf97fce41ee1c0b1cc2add283f3e66cdab0 /src/bootstrap/tool.rs
parentAdding debian version 1.67.1+dfsg1-1. (diff)
downloadrustc-64d98f8ee037282c35007b64c2649055c56af1db.tar.xz
rustc-64d98f8ee037282c35007b64c2649055c56af1db.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/bootstrap/tool.rs')
-rw-r--r--src/bootstrap/tool.rs35
1 files changed, 23 insertions, 12 deletions
diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs
index e0be4c432..9a2100c2f 100644
--- a/src/bootstrap/tool.rs
+++ b/src/bootstrap/tool.rs
@@ -29,6 +29,8 @@ struct ToolBuild {
is_optional_tool: bool,
source_type: SourceType,
extra_features: Vec<String>,
+ /// Nightly-only features that are allowed (comma-separated list).
+ allow_features: &'static str,
}
impl Step for ToolBuild {
@@ -59,7 +61,7 @@ impl Step for ToolBuild {
_ => panic!("unexpected Mode for tool build"),
}
- let cargo = prepare_tool_cargo(
+ let mut cargo = prepare_tool_cargo(
builder,
compiler,
self.mode,
@@ -69,6 +71,9 @@ impl Step for ToolBuild {
self.source_type,
&self.extra_features,
);
+ if !self.allow_features.is_empty() {
+ cargo.allow_features(self.allow_features);
+ }
builder.info(&format!("Building stage{} tool {} ({})", compiler.stage, tool, target));
let mut duplicates = Vec::new();
@@ -292,6 +297,7 @@ macro_rules! bootstrap_tool {
$name:ident, $path:expr, $tool_name:expr
$(,is_external_tool = $external:expr)*
$(,is_unstable_tool = $unstable:expr)*
+ $(,allow_features = $allow_features:expr)?
;
)+) => {
#[derive(Copy, PartialEq, Eq, Clone)]
@@ -355,6 +361,7 @@ macro_rules! bootstrap_tool {
SourceType::InTree
},
extra_features: vec![],
+ allow_features: concat!($($allow_features)*),
}).expect("expected to build -- essential tool")
}
}
@@ -368,7 +375,7 @@ bootstrap_tool!(
Tidy, "src/tools/tidy", "tidy";
Linkchecker, "src/tools/linkchecker", "linkchecker";
CargoTest, "src/tools/cargotest", "cargotest";
- Compiletest, "src/tools/compiletest", "compiletest", is_unstable_tool = true;
+ Compiletest, "src/tools/compiletest", "compiletest", is_unstable_tool = true, allow_features = "test";
BuildManifest, "src/tools/build-manifest", "build-manifest";
RemoteTestClient, "src/tools/remote-test-client", "remote-test-client";
RustInstaller, "src/tools/rust-installer", "rust-installer", is_external_tool = true;
@@ -435,6 +442,7 @@ impl Step for ErrorIndex {
is_optional_tool: false,
source_type: SourceType::InTree,
extra_features: Vec::new(),
+ allow_features: "",
})
.expect("expected to build -- essential tool")
}
@@ -471,6 +479,7 @@ impl Step for RemoteTestServer {
is_optional_tool: false,
source_type: SourceType::InTree,
extra_features: Vec::new(),
+ allow_features: "",
})
.expect("expected to build -- essential tool")
}
@@ -622,6 +631,7 @@ impl Step for Cargo {
is_optional_tool: false,
source_type: SourceType::Submodule,
extra_features: Vec::new(),
+ allow_features: "",
})
.expect("expected to build -- essential tool");
@@ -637,6 +647,7 @@ impl Step for Cargo {
is_optional_tool: true,
source_type: SourceType::Submodule,
extra_features: Vec::new(),
+ allow_features: "",
});
};
@@ -684,6 +695,7 @@ impl Step for LldWrapper {
is_optional_tool: false,
source_type: SourceType::InTree,
extra_features: Vec::new(),
+ allow_features: "",
})
.expect("expected to build -- essential tool");
@@ -697,6 +709,11 @@ pub struct RustAnalyzer {
pub target: TargetSelection,
}
+impl RustAnalyzer {
+ pub const ALLOW_FEATURES: &str =
+ "proc_macro_internals,proc_macro_diagnostic,proc_macro_span,proc_macro_span_shrink";
+}
+
impl Step for RustAnalyzer {
type Output = Option<PathBuf>;
const DEFAULT: bool = true;
@@ -731,6 +748,7 @@ impl Step for RustAnalyzer {
extra_features: vec!["rust-analyzer/in-rust-tree".to_owned()],
is_optional_tool: false,
source_type: SourceType::InTree,
+ allow_features: RustAnalyzer::ALLOW_FEATURES,
})
}
}
@@ -747,19 +765,9 @@ impl Step for RustAnalyzerProcMacroSrv {
const ONLY_HOSTS: bool = true;
fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
- let builder = run.builder;
-
// 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<'_>) {
@@ -779,6 +787,7 @@ impl Step for RustAnalyzerProcMacroSrv {
extra_features: vec!["proc-macro-srv/sysroot-abi".to_owned()],
is_optional_tool: false,
source_type: SourceType::InTree,
+ allow_features: RustAnalyzer::ALLOW_FEATURES,
})?;
// Copy `rust-analyzer-proc-macro-srv` to `<sysroot>/libexec/`
@@ -798,6 +807,7 @@ macro_rules! tool_extended {
$tool_name:expr,
stable = $stable:expr
$(,tool_std = $tool_std:literal)?
+ $(,allow_features = $allow_features:expr)?
;)+) => {
$(
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
@@ -849,6 +859,7 @@ macro_rules! tool_extended {
extra_features: $sel.extra_features,
is_optional_tool: true,
source_type: SourceType::InTree,
+ allow_features: concat!($($allow_features)*),
})
}
}