Skip to content

Commit

Permalink
Auto merge of #90072 - ehuss:empty-rmeta-no-warn, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
Don't emit a warning for empty rmeta files.

This avoids displaying a warning when attempting to load an empty rmeta file. Warnings were enabled via #89634 which can cause a lot of noise (for example, running `./x.py check`).  rustc generates empty rmeta files for things like binaries, which can happen when checking libraries as unittests.

Closes #89795
  • Loading branch information
bors committed Oct 21, 2021
2 parents 4626184 + 6f91505 commit 40ebd07
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions compiler/rustc_metadata/src/locator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,15 @@ impl<'a> CrateLocator<'a> {
let mut err_data: Option<Vec<PathBuf>> = None;
for (lib, kind) in m {
info!("{} reading metadata from: {}", flavor, lib.display());
if flavor == CrateFlavor::Rmeta && lib.metadata().map_or(false, |m| m.len() == 0) {
// Empty files will cause get_metadata_section to fail. Rmeta
// files can be empty, for example with binaries (which can
// often appear with `cargo check` when checking a library as
// a unittest). We don't want to emit a user-visible warning
// in this case as it is not a real problem.
debug!("skipping empty file");
continue;
}
let (hash, metadata) =
match get_metadata_section(self.target, flavor, &lib, self.metadata_loader) {
Ok(blob) => {
Expand Down

0 comments on commit 40ebd07

Please sign in to comment.