Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x build src/tools/cargo builds the compiler #97510

Open
jyn514 opened this issue May 29, 2022 · 3 comments
Open

x build src/tools/cargo builds the compiler #97510

jyn514 opened this issue May 29, 2022 · 3 comments
Labels
A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@jyn514
Copy link
Member

jyn514 commented May 29, 2022

Cargo builds on stable. Building the compiler seems wrong.

Changing ToolRustc to ToolBootstrap avoids building the compiler, but gives an error when using --stage 1 or --stage 2 with cargo. I think in some sense that's right? Cargo should be the same regardless of the stage you use to build it.

ToolRustc -> ToolBootstrap
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index bc851568f89..a5cd6315b1a 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -273,7 +273,7 @@ fn run(self, builder: &Builder<'_>) {
         let mut cargo = tool::prepare_tool_cargo(
             builder,
             compiler,
-            Mode::ToolRustc,
+            Mode::ToolBootstrap,
             self.host,
             "test",
             "src/tools/cargo",
diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs
index 3b30e6de12a..d775e3b4e55 100644
--- a/src/bootstrap/tool.rs
+++ b/src/bootstrap/tool.rs
@@ -609,7 +609,7 @@ fn run(self, builder: &Builder<'_>) -> PathBuf {
                 compiler: self.compiler,
                 target: self.target,
                 tool: "cargo",
-                mode: Mode::ToolRustc,
+                mode: Mode::ToolBootstrap,
                 path: "src/tools/cargo",
                 is_optional_tool: false,
                 source_type: SourceType::Submodule,
@@ -624,7 +624,7 @@ fn run(self, builder: &Builder<'_>) -> PathBuf {
                 compiler: self.compiler,
                 target: self.target,
                 tool: name,
-                mode: Mode::ToolRustc,
+                mode: Mode::ToolBootstrap,
                 path,
                 is_optional_tool: true,
                 source_type: SourceType::Submodule,

cc @Mark-Simulacrum: I wonder if we should make this change and give a warning when using --stage with cargo.

I found this in #97268.

@rustbot label +A-rustbuild +A-contributor-roadblock

@rustbot rustbot added A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels May 29, 2022
@jyn514
Copy link
Member Author

jyn514 commented May 29, 2022

src/tools/rust-demangler has the same issue.

@ehuss
Copy link
Contributor

ehuss commented May 29, 2022

Can you say more about why you would want to change this? I would prefer to keep cargo building with the latest tip of the compiler to ensure that there aren't any regressions. Also, the testsuite depends on some nightly-only things, which I think would be a problem if rustc weren't built.

@jyn514
Copy link
Member Author

jyn514 commented May 29, 2022

@ehuss building the compiler is slow. When I need to replicate CI failures that involve cargo, it's frustrating to have to wait for a full compiler build first, even when using --stage 0.

I would prefer to keep cargo building with the latest tip of the compiler to ensure that there aren't any regressions. Also, the testsuite depends on some nightly-only things, which I think would be a problem if rustc weren't built.

Ok - maybe we should still allow using --stage 2 and pass that in CI, but fix --stage 0 not to build the compiler? I think cargo is only using feature(test) and a few other library features, which we can allow by using Mode::ToolStd. If nothing else, build cargo shouldn't require anything nightly and we can only build rustc crates when using test cargo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-contributor-roadblock Area: Makes things more difficult for new contributors to rust itself T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

No branches or pull requests

3 participants