Skip to content

Commit c6f1b89

Browse files
authored
Output the missing peripheral name and referencing task instead of panicing. (#151)
1 parent d3d6405 commit c6f1b89

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

xtask/src/dist.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -709,8 +709,16 @@ fn make_descriptors(
709709
// For peripherals referenced by the task, we don't need to allocate
710710
// _new_ regions, since we did them all in advance. Just record the
711711
// entries for the TaskDesc.
712-
for (j, name) in task.uses.iter().enumerate() {
713-
task_regions[allocs.len() + j] = peripheral_index[name] as u8;
712+
for (j, peripheral_name) in task.uses.iter().enumerate() {
713+
if let Some(&peripheral) = peripheral_index.get(&peripheral_name) {
714+
task_regions[allocs.len() + j] = peripheral as u8;
715+
} else {
716+
bail!(
717+
"Could not find peripheral `{}` referenced by task `{}`.",
718+
peripheral_name,
719+
name
720+
);
721+
}
714722
}
715723

716724
let mut flags = abi::TaskFlags::empty();

0 commit comments

Comments
 (0)