Use DefaultMetadataLoader for loading dylib metadata (#698)

This commit is contained in:
bjorn3 2021-08-03 12:20:46 +02:00 committed by GitHub
parent 710e6ab4d6
commit cccb9737d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -269,15 +269,7 @@ impl MetadataLoader for SpirvMetadataLoader {
}
fn get_dylib_metadata(&self, target: &Target, path: &Path) -> Result<MetadataRef, String> {
// HACK(eddyb) this is needed to allow metadata loading for proc macros
// (compiled as host dylibs); perhaps it'd be better to use the `object`
// crate, like `rustc_codegen_cranelift` does.
// NOTE(eddyb) while both `::new()` and `.metadata_loader()` call `Box::new`,
// they only do so with ZST values, and so we don't pointlessly allocate.
extern crate rustc_codegen_llvm;
rustc_codegen_llvm::LlvmCodegenBackend::new()
.metadata_loader()
.get_dylib_metadata(target, path)
rustc_codegen_ssa::back::metadata::DefaultMetadataLoader.get_dylib_metadata(target, path)
}
}