]> git.pld-linux.org Git - packages/rust.git/blob - rust-no-miri.patch
- patch to disable miri build by default (nightly only tool, not meant for stable)
[packages/rust.git] / rust-no-miri.patch
1 From 416b010f4087d055febe2d55919f74e261ca8cd6 Mon Sep 17 00:00:00 2001
2 From: Ralf Jung <post@ralfj.de>
3 Date: Thu, 11 Jun 2020 09:25:06 +0200
4 Subject: [PATCH] x.py: do not build Miri by default
5
6 ---
7  src/bootstrap/builder.rs |  2 ++
8  src/bootstrap/tool.rs    | 30 ++++++++++++++++++------------
9  2 files changed, 20 insertions(+), 12 deletions(-)
10
11 diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
12 index ffdd8485181f4..c4f29927cf4a8 100644
13 --- a/src/bootstrap/builder.rs
14 +++ b/src/bootstrap/builder.rs
15 @@ -52,6 +52,8 @@ pub trait Step: 'static + Clone + Debug + PartialEq + Eq + Hash {
16      /// it's been assembled.
17      type Output: Clone;
18  
19 +    /// Whether this step is run by default as part of its respective phase.
20 +    /// `true` here can still be overwritten by `should_run` calling `default_condition`.
21      const DEFAULT: bool = false;
22  
23      /// If true, then this rule should be skipped if --target was specified, but --host was not
24 diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs
25 index 6cd9f9029c948..9c95de0a81eae 100644
26 --- a/src/bootstrap/tool.rs
27 +++ b/src/bootstrap/tool.rs
28 @@ -595,6 +595,7 @@ macro_rules! tool_extended {
29         $toolstate:ident,
30         $path:expr,
31         $tool_name:expr,
32 +       stable = $stable:expr,
33         $extra_deps:block;)+) => {
34          $(
35              #[derive(Debug, Clone, Hash, PartialEq, Eq)]
36 @@ -606,17 +607,22 @@ macro_rules! tool_extended {
37  
38          impl Step for $name {
39              type Output = Option<PathBuf>;
40 -            const DEFAULT: bool = true;
41 +            const DEFAULT: bool = true; // Overwritten below
42              const ONLY_HOSTS: bool = true;
43  
44              fn should_run(run: ShouldRun<'_>) -> ShouldRun<'_> {
45                  let builder = run.builder;
46                  run.path($path).default_condition(
47                      builder.config.extended
48 -                        && builder.config.tools.as_ref().map_or(true, |tools| {
49 -                            tools.iter().any(|tool| match tool.as_ref() {
50 -                                "clippy" => $tool_name == "clippy-driver",
51 -                                x => $tool_name == x,
52 +                        && builder.config.tools.as_ref().map_or(
53 +                            // By default, on nightly/dev enable all tools, else only
54 +                            // build stable tools.
55 +                            $stable || builder.build.unstable_features(),
56 +                            // If `tools` is set, search list for this tool.
57 +                            |tools| {
58 +                                tools.iter().any(|tool| match tool.as_ref() {
59 +                                    "clippy" => $tool_name == "clippy-driver",
60 +                                    x => $tool_name == x,
61                              })
62                          }),
63                  )
64 @@ -652,12 +658,12 @@ macro_rules! tool_extended {
65  // Note: tools need to be also added to `Builder::get_step_descriptions` in `build.rs`
66  // to make `./x.py build <tool>` work.
67  tool_extended!((self, builder),
68 -    Cargofmt, rustfmt, "src/tools/rustfmt", "cargo-fmt", {};
69 -    CargoClippy, clippy, "src/tools/clippy", "cargo-clippy", {};
70 -    Clippy, clippy, "src/tools/clippy", "clippy-driver", {};
71 -    Miri, miri, "src/tools/miri", "miri", {};
72 -    CargoMiri, miri, "src/tools/miri/cargo-miri", "cargo-miri", {};
73 -    Rls, rls, "src/tools/rls", "rls", {
74 +    Cargofmt, rustfmt, "src/tools/rustfmt", "cargo-fmt", stable=true, {};
75 +    CargoClippy, clippy, "src/tools/clippy", "cargo-clippy", stable=true, {};
76 +    Clippy, clippy, "src/tools/clippy", "clippy-driver", stable=true, {};
77 +    Miri, miri, "src/tools/miri", "miri", stable=false, {};
78 +    CargoMiri, miri, "src/tools/miri/cargo-miri", "cargo-miri", stable=false, {};
79 +    Rls, rls, "src/tools/rls", "rls", stable=true, {
80          builder.ensure(Clippy {
81              compiler: self.compiler,
82              target: self.target,
83 @@ -665,7 +671,7 @@ tool_extended!((self, builder),
84          });
85          self.extra_features.push("clippy".to_owned());
86      };
87 -    Rustfmt, rustfmt, "src/tools/rustfmt", "rustfmt", {};
88 +    Rustfmt, rustfmt, "src/tools/rustfmt", "rustfmt", stable=true, {};
89  );
90  
91  impl<'a> Builder<'a> {
This page took 0.035319 seconds and 3 git commands to generate.