Skip to content

Commit acc45eb

Browse files
authored
Rollup merge of #122588 - klensy:imported_source_file, r=michaelwoerister
less useless filter calls in imported_source_file This reduces calls to `filter` greatly, giving 0.3% instructions win on some tests.
2 parents 87b5679 + 4bfc485 commit acc45eb

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

compiler/rustc_metadata/src/rmeta/decoder.rs

+10-10
Original file line numberDiff line numberDiff line change
@@ -1590,17 +1590,17 @@ impl<'a, 'tcx> CrateMetadataRef<'a> {
15901590
})
15911591
}
15921592

1593-
// Translate the virtual `/rustc/$hash` prefix back to a real directory
1594-
// that should hold actual sources, where possible.
1595-
//
1596-
// NOTE: if you update this, you might need to also update bootstrap's code for generating
1597-
// the `rust-src` component in `Src::run` in `src/bootstrap/dist.rs`.
1598-
let virtual_rust_source_base_dir = [
1599-
filter(sess, option_env!("CFG_VIRTUAL_RUST_SOURCE_BASE_DIR").map(Path::new)),
1600-
filter(sess, sess.opts.unstable_opts.simulate_remapped_rust_src_base.as_deref()),
1601-
];
1602-
16031593
let try_to_translate_virtual_to_real = |name: &mut rustc_span::FileName| {
1594+
// Translate the virtual `/rustc/$hash` prefix back to a real directory
1595+
// that should hold actual sources, where possible.
1596+
//
1597+
// NOTE: if you update this, you might need to also update bootstrap's code for generating
1598+
// the `rust-src` component in `Src::run` in `src/bootstrap/dist.rs`.
1599+
let virtual_rust_source_base_dir = [
1600+
filter(sess, option_env!("CFG_VIRTUAL_RUST_SOURCE_BASE_DIR").map(Path::new)),
1601+
filter(sess, sess.opts.unstable_opts.simulate_remapped_rust_src_base.as_deref()),
1602+
];
1603+
16041604
debug!(
16051605
"try_to_translate_virtual_to_real(name={:?}): \
16061606
virtual_rust_source_base_dir={:?}, real_rust_source_base_dir={:?}",

0 commit comments

Comments
 (0)