Skip to content

Commit c571558

Browse files
committed
Give a more helpful error when calling cargo_crates_in_set for an alias
Before: ``` thread 'main' panicked at 'no entry found for key', builder.rs:110:30 ``` After: ``` thread 'main' panicked at 'missing crate for path library', check.rs:89:26 ```
1 parent 498553f commit c571558

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/bootstrap/builder.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,11 +103,14 @@ impl RunConfig<'_> {
103103
}
104104

105105
/// Return a list of crate names selected by `run.paths`.
106+
#[track_caller]
106107
pub fn cargo_crates_in_set(&self) -> Interned<Vec<String>> {
107108
let mut crates = Vec::new();
108109
for krate in &self.paths {
109110
let path = krate.assert_single_path();
110-
let crate_name = self.builder.crate_paths[&path.path];
111+
let Some(crate_name) = self.builder.crate_paths.get(&path.path) else {
112+
panic!("missing crate for path {}", path.path.display())
113+
};
111114
crates.push(crate_name.to_string());
112115
}
113116
INTERNER.intern_list(crates)

0 commit comments

Comments
 (0)