Skip to content

Commit f3b5791

Browse files
committed
rustc_metadata: Do not encode empty reexport lists
This is more a cleanup than optimization
1 parent 66ccf36 commit f3b5791

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

compiler/rustc_metadata/src/rmeta/encoder.rs

+5-7
Original file line numberDiff line numberDiff line change
@@ -1267,13 +1267,6 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
12671267
// the crate root for consistency with other crates (some of the resolver
12681268
// code uses it). However, we skip encoding anything relating to child
12691269
// items - we encode information about proc-macros later on.
1270-
let reexports = if !self.is_proc_macro {
1271-
tcx.module_reexports(local_def_id).unwrap_or(&[])
1272-
} else {
1273-
&[]
1274-
};
1275-
1276-
record_array!(self.tables.module_reexports[def_id] <- reexports);
12771270
if self.is_proc_macro {
12781271
// Encode this here because we don't do it in encode_def_ids.
12791272
record!(self.tables.expn_that_defined[def_id] <- tcx.expn_that_defined(local_def_id));
@@ -1305,6 +1298,11 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
13051298
}
13061299
}
13071300
}));
1301+
1302+
if let Some(reexports) = tcx.module_reexports(local_def_id) {
1303+
assert!(!reexports.is_empty());
1304+
record_array!(self.tables.module_reexports[def_id] <- reexports);
1305+
}
13081306
}
13091307
}
13101308

0 commit comments

Comments
 (0)