Skip to content

Commit a9853fc

Browse files
Add 'unlikely' annotation to branch in crate DepNodeIndex caching.
1 parent 0ee6a96 commit a9853fc

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/librustc_metadata/decoder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1372,7 +1372,7 @@ impl<'a, 'tcx> CrateMetadata {
13721372
pub(super) fn get_crate_dep_node_index(&self, tcx: TyCtxt<'tcx>) -> DepNodeIndex {
13731373
let mut dep_node_index = self.dep_node_index.load();
13741374

1375-
if dep_node_index == DepNodeIndex::INVALID {
1375+
if unlikely!(dep_node_index == DepNodeIndex::INVALID) {
13761376
// We have not cached the DepNodeIndex for this upstream crate yet,
13771377
// so use the dep-graph to find it out and cache it.
13781378
// Note that multiple threads can enter this block concurrently.

src/librustc_metadata/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#![doc(html_root_url = "https://doc.rust-lang.org/nightly/")]
22

33
#![feature(box_patterns)]
4+
#![feature(core_intrinsics)]
45
#![feature(crate_visibility_modifier)]
56
#![feature(drain_filter)]
67
#![feature(in_band_lifetimes)]
@@ -11,6 +12,7 @@
1112
#![feature(rustc_private)]
1213
#![feature(slice_patterns)]
1314
#![feature(specialization)]
15+
#![feature(stmt_expr_attributes)]
1416

1517
#![recursion_limit="256"]
1618

0 commit comments

Comments
 (0)