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 clean library/std fails with an unexpected argument error #108517

Closed
clubby789 opened this issue Feb 27, 2023 · 3 comments · Fixed by #108564
Closed

x clean library/std fails with an unexpected argument error #108517

clubby789 opened this issue Feb 27, 2023 · 3 comments · Fixed by #108564
Labels
C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)

Comments

@clubby789
Copy link
Contributor

x clean library/std invokes cargo clean --target ... --release std, resulting in

error: unexpected argument 'std' found

Usage: cargo clean [OPTIONS]

For more information, try '--help'.

Cleaning a compiler/ crate correctly adds the -p flag needed to specify packages.

I did notice that adding the -p caused the command to complete successfully, but the std build dir was not actually cleaned.

@rustbot label +T-bootstrap

@clubby789 clubby789 added the C-bug Category: This is a bug. label Feb 27, 2023
@rustbot rustbot added the T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) label Feb 27, 2023
@KittyBorgX
Copy link
Member

KittyBorgX commented Feb 28, 2023

Does x clean --target library/std help?

Cleaning a compiler/ crate correctly adds the -p flag needed to specify packages.

Unfortunately, that unexpectedly fails on my end:

Building bootstrap
    Finished dev [unoptimized] target(s) in 0.03s
Cleaning {rustc_lexer} stage0 rustc artifacts (aarch64-apple-darwin -> aarch64-apple-darwin)
error: unexpected argument 'rustc_lexer' found

@albertlarsan68
Copy link
Member

Here is a (hacky) way to get it working:

diff --git a/src/bootstrap/clean.rs b/src/bootstrap/clean.rs
index 468efc1114c4..7ebd0a8f2706 100644
--- a/src/bootstrap/clean.rs
+++ b/src/bootstrap/clean.rs
@@ -62,6 +62,7 @@ fn run(self, builder: &Builder<'_>) -> Self::Output {
                 let target = compiler.host;
                 let mut cargo = builder.bare_cargo(compiler, $mode, target, "clean");
                 for krate in &*self.crates {
+                    cargo.arg("-p");
                     cargo.arg(krate);
                 }

You can make a PR with this patch, but I am not sure many people are using this way of cleaning, so it may not get much attention.

@clubby789
Copy link
Contributor Author

Hmm, I must have made a mistake while manually adding -p to the command line. That patch fixes it, thank you 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants