File tree 1 file changed +9
-0
lines changed
compiler/rustc_metadata/src
1 file changed +9
-0
lines changed Original file line number Diff line number Diff line change @@ -529,6 +529,15 @@ impl<'a> CrateLocator<'a> {
529
529
let mut err_data: Option < Vec < PathBuf > > = None ;
530
530
for ( lib, kind) in m {
531
531
info ! ( "{} reading metadata from: {}" , flavor, lib. display( ) ) ;
532
+ if flavor == CrateFlavor :: Rmeta && lib. metadata ( ) . map_or ( false , |m| m. len ( ) == 0 ) {
533
+ // Empty files will cause get_metadata_section to fail. Rmeta
534
+ // files can be empty, for example with binaries (which can
535
+ // often appear with `cargo check` when checking a library as
536
+ // a unittest). We don't want to emit a user-visible warning
537
+ // in this case as it is not a real problem.
538
+ debug ! ( "skipping empty file" ) ;
539
+ continue ;
540
+ }
532
541
let ( hash, metadata) =
533
542
match get_metadata_section ( self . target , flavor, & lib, self . metadata_loader ) {
534
543
Ok ( blob) => {
You can’t perform that action at this time.
0 commit comments