]> git.lizzy.rs Git - rust.git/commitdiff
Avoid panicking on missing fallback
authorMark Rousskov <mark.simulacrum@gmail.com>
Sat, 17 Sep 2022 22:13:59 +0000 (18:13 -0400)
committerMark Rousskov <mark.simulacrum@gmail.com>
Tue, 20 Sep 2022 22:23:22 +0000 (18:23 -0400)
This just prints a message but continues on if a fallback is missing,
which can happen when we're building a partial set of builders and
producing a dev-static build from it (e.g., when no Apple builder runs
at all).

Probably the more extensive fix is to allow the build-manifest invoker
to specify the expected set of targets & hosts, but that's a far more
extensive change. The main risk from this is that we accidentally start
falling back to linux docs across all platforms without noticing. I'm
not sure that we can do much about that though at this time.

src/tools/build-manifest/src/main.rs

index 1a6760d8c68b9fa91e45aecdd3485e6891b491d3..bf07cd75cab565730c0b85cfbf67f7beaed031dd 100644 (file)
@@ -543,8 +543,18 @@ macro_rules! tarball_name {
             for (substr, fallback_target) in fallback {
                 if target_name.contains(substr) {
                     let t = Target::from_compressed_tar(self, &tarball_name!(fallback_target));
-                    // Fallbacks must always be available.
-                    assert!(t.available);
+                    // Fallbacks should typically be available on 'production' builds
+                    // but may not be available for try builds, which only build one target by
+                    // default. Ideally we'd gate this being a hard error on whether we're in a
+                    // production build or not, but it's not information that's readily available
+                    // here.
+                    if !t.available {
+                        eprintln!(
+                            "{:?} not available for fallback",
+                            tarball_name!(fallback_target)
+                        );
+                        continue;
+                    }
                     return t;
                 }
             }