From fef332f38552ae8af83cf69993dd6aabdebffd6a Mon Sep 17 00:00:00 2001 From: Martin Robinson Date: Tue, 1 Aug 2023 16:44:57 +0200 Subject: Make rustup a requirement and switch to `rust-toolchain.toml` (#30056) This change makes rustup a requirement for building Servo with `./mach` and switches to the newer `rust-toolchain.toml` format. The goal here is to make mach builds more similar to non-mach builds. - The new format allows listing the required components, removing some of the complexity from our mach scripts. - This means we must raise the required version of rustup to 1.23. The current version is 1.26. - We no longer wrap every call to cargo and rustc in "rustup run" calls as both cargo and rustc will take care of installing and using all necessary components specified in `rust-toolchain.toml` when run inside the project directory. --- python/servo/testing_commands.py | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) (limited to 'python/servo/testing_commands.py') diff --git a/python/servo/testing_commands.py b/python/servo/testing_commands.py index 799e5ff6ac5..549b5aed842 100644 --- a/python/servo/testing_commands.py +++ b/python/servo/testing_commands.py @@ -263,14 +263,6 @@ class MachCommands(CommandBase): "tests/wpt/mozilla/.") return 0 - def install_rustfmt(self): - self.ensure_bootstrapped() - with open(os.devnull, "w") as devnull: - if self.call_rustup_run(["cargo", "fmt", "--version", "-q"], - stderr=devnull) != 0: - # Rustfmt is not installed. Install: - self.call_rustup_run(["rustup", "component", "add", "rustfmt-preview"]) - @Command('test-tidy', description='Run the source code tidiness check', category='testing') @@ -289,8 +281,7 @@ class MachCommands(CommandBase): else: manifest_dirty = wpt.manifestupdate.update(check_clean=True) tidy_failed = tidy.scan(not all_files, not no_progress, stylo=stylo, no_wpt=no_wpt) - self.install_rustfmt() - rustfmt_failed = self.call_rustup_run(["cargo", "fmt", "--", "--check"]) + rustfmt_failed = call(["cargo", "fmt", "--", "--check"]) if rustfmt_failed: print("Run `./mach fmt` to fix the formatting") @@ -404,8 +395,7 @@ class MachCommands(CommandBase): description='Format the Rust and CPP source files with rustfmt', category='testing') def format_code(self): - self.install_rustfmt() - return self.call_rustup_run(["cargo", "fmt"]) + return call(["cargo", "fmt"]) @Command('update-wpt', description='Update the web platform tests', -- cgit v1.2.3