Skip to content

Commit 48b90a0

Browse files
authored
Rollup merge of #134514 - bjorn3:more_driver_refactors, r=jieyouxu
Improve dependency_format a bit * Make `DependencyList` an `IndexVec` rather than emulating one using a `Vec` (which was off-by-one as LOCAL_CRATE was intentionally skipped) * Update some comments for the fact that we now use `#[global_allocator]` rather than `extern crate alloc_system;`/`extern crate alloc_jemalloc;` for specifying which allocator to use. We still use a similar mechanism for the panic runtime, so refer to the panic runtime in those comments instead. * An unrelated refactor to `create_and_enter_global_ctxt` I forgot to include in rust-lang/rust#134302. This refactor is too small to be worth it's own PR.
2 parents 599c3a4 + c0f4cec commit 48b90a0

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

src/helpers.rs

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -152,12 +152,14 @@ pub fn iter_exported_symbols<'tcx>(
152152
let dependency_format = dependency_formats
153153
.get(&CrateType::Executable)
154154
.expect("interpreting a non-executable crate");
155-
for cnum in dependency_format.iter().enumerate().filter_map(|(num, &linkage)| {
156-
// We add 1 to the number because that's what rustc also does everywhere it
157-
// calls `CrateNum::new`...
158-
#[expect(clippy::arithmetic_side_effects)]
159-
(linkage != Linkage::NotLinked).then_some(CrateNum::new(num + 1))
160-
}) {
155+
for cnum in dependency_format
156+
.iter_enumerated()
157+
.filter_map(|(num, &linkage)| (linkage != Linkage::NotLinked).then_some(num))
158+
{
159+
if cnum == LOCAL_CRATE {
160+
continue; // Already handled above
161+
}
162+
161163
// We can ignore `_export_info` here: we are a Rust crate, and everything is exported
162164
// from a Rust crate.
163165
for &(symbol, _export_info) in tcx.exported_symbols(cnum) {

0 commit comments

Comments
 (0)