Skip to content

Commit

Permalink
Make DependencyList an IndexVec
Browse files Browse the repository at this point in the history
  • Loading branch information
bjorn3 committed Dec 19, 2024
1 parent 3f945bb commit c0f4cec
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,12 +151,14 @@ pub fn iter_exported_symbols<'tcx>(
let dependency_format = dependency_formats
.get(&CrateType::Executable)
.expect("interpreting a non-executable crate");
for cnum in dependency_format.iter().enumerate().filter_map(|(num, &linkage)| {
// We add 1 to the number because that's what rustc also does everywhere it
// calls `CrateNum::new`...
#[expect(clippy::arithmetic_side_effects)]
(linkage != Linkage::NotLinked).then_some(CrateNum::new(num + 1))
}) {
for cnum in dependency_format
.iter_enumerated()
.filter_map(|(num, &linkage)| (linkage != Linkage::NotLinked).then_some(num))
{
if cnum == LOCAL_CRATE {
continue; // Already handled above
}

// We can ignore `_export_info` here: we are a Rust crate, and everything is exported
// from a Rust crate.
for &(symbol, _export_info) in tcx.exported_symbols(cnum) {
Expand Down

0 comments on commit c0f4cec

Please sign in to comment.