]> git.lizzy.rs Git - rust.git/blobdiff - src/bootstrap/builder.rs
Rollup merge of #97087 - Nilstrieb:clarify-slice-iteration-order, r=dtolnay
[rust.git] / src / bootstrap / builder.rs
index 68d0d685ebb401012ecd83714845fc8654b7e96c..761bd66b5057bb931ee1b0ac9d131a8da2855cb8 100644 (file)
@@ -284,7 +284,19 @@ fn run(v: &[StepDescription], builder: &Builder<'_>, paths: &[PathBuf]) {
             }
 
             if !attempted_run {
-                panic!("error: no rules matched {}", path.display());
+                eprintln!(
+                    "error: no `{}` rules matched '{}'",
+                    builder.kind.as_str(),
+                    path.display()
+                );
+                eprintln!(
+                    "help: run `x.py {} --help --verbose` to show a list of available paths",
+                    builder.kind.as_str()
+                );
+                eprintln!(
+                    "note: if you are adding a new Step to bootstrap itself, make sure you register it with `describe!`"
+                );
+                std::process::exit(1);
             }
         }
     }
@@ -522,7 +534,7 @@ macro_rules! describe {
                 native::Lld,
                 native::CrtBeginEnd
             ),
-            Kind::Check => describe!(
+            Kind::Check | Kind::Clippy | Kind::Fix => describe!(
                 check::Std,
                 check::Rustc,
                 check::Rustdoc,
@@ -652,7 +664,7 @@ macro_rules! describe {
             ),
             Kind::Run => describe!(run::ExpandYamlAnchors, run::BuildManifest, run::BumpStage0),
             // These commands either don't use paths, or they're special-cased in Build::build()
-            Kind::Clean | Kind::Clippy | Kind::Fix | Kind::Format | Kind::Setup => vec![],
+            Kind::Clean | Kind::Format | Kind::Setup => vec![],
         }
     }
 
@@ -1131,13 +1143,26 @@ pub fn cargo(
             rustflags.arg("-Zunstable-options");
         }
 
-        // #[cfg(not(bootstrap)]
+        // FIXME(Urgau): This a hack as it shouldn't be gated on stage 0 but until `rustc_llvm`
+        // is made to work with `--check-cfg` which is currently not easly possible until cargo
+        // get some support for setting `--check-cfg` within build script, it's the least invasive
+        // hack that still let's us have cfg checking for the vast majority of the codebase.
         if stage != 0 {
-            // Enable cfg checking of cargo features
-            // FIXME: De-comment this when cargo beta get support for it
-            // cargo.arg("-Zcheck-cfg-features");
-
-            // Enable cfg checking of rustc well-known names
+            // Enable cfg checking of cargo features for everything but std.
+            //
+            // Note: `std`, `alloc` and `core` imports some dependencies by #[path] (like
+            // backtrace, core_simd, std_float, ...), those dependencies have their own features
+            // but cargo isn't involved in the #[path] and so cannot pass the complete list of
+            // features, so for that reason we don't enable checking of features for std.
+            //
+            // FIXME: Re-enable this after the beta bump as apperently rustc-perf doesn't use the
+            // beta cargo. See https://github.com/rust-lang/rust/pull/96984#issuecomment-1126678773
+            // #[cfg(not(bootstrap))]
+            // if mode != Mode::Std {
+            //     cargo.arg("-Zcheck-cfg-features"); // -Zcheck-cfg=features after bump
+            // }
+
+            // Enable cfg checking of well known names/values
             rustflags
                 .arg("-Zunstable-options")
                 // Enable checking of well known names
@@ -1413,8 +1438,12 @@ pub fn cargo(
         // FIXME(davidtwco): #[cfg(not(bootstrap))] - #95612 needs to be in the bootstrap compiler
         // for this conditional to be removed.
         if !target.contains("windows") || compiler.stage >= 1 {
-            if target.contains("linux") || target.contains("windows") || target.contains("openbsd")
-            {
+            let needs_unstable_opts = target.contains("linux")
+                || target.contains("windows")
+                || target.contains("bsd")
+                || target.contains("dragonfly");
+
+            if needs_unstable_opts {
                 rustflags.arg("-Zunstable-options");
             }
             match self.config.rust_split_debuginfo {