Skip to content

Commit 5e30dc2

Browse files
author
Johnathan Van Why
committed
Improve libtock_runtime's error handling if it can't find an assembly toolchain.
Previously, if `libtock_runtime`'s build script was unable to find a toolchain to build its external assembly with, its build would succeed then the process binary would fail to link. This change makes `libtock_runtime`'s build script panic with a useful error message instead.
1 parent 761310d commit 5e30dc2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

runtime/extern_asm.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
//! point) and linking it into the process binary. Requires out_dir to be added
33
//! to rustc's link search path.
44
5+
/// Compiles the external assembly and tells cargo/rustc to link the resulting
6+
/// library into the crate. Panics if it is unable to find a working assembly
7+
/// toolchain or if the assembly fails to compile.
58
pub(crate) fn build_and_link(out_dir: &str) {
69
use std::env::var;
710
let arch = var("CARGO_CFG_TARGET_ARCH").expect("Unable to read CARGO_CFG_TARGET_ARCH");
@@ -49,6 +52,8 @@ pub(crate) fn build_and_link(out_dir: &str) {
4952
return;
5053
}
5154
}
55+
56+
panic!("Unable to find a toolchain for architecture {}", arch);
5257
}
5358

5459
#[derive(Clone, Copy)]

0 commit comments

Comments
 (0)