Use rustc_codegen_llvm's get_dylib_metadata to unblock proc macros. (#268)

This commit is contained in:
Eduard-Mihai Burtescu 2020-11-20 20:37:01 +02:00 committed by GitHub
parent a92d76a81c
commit 28f604eb77
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -230,8 +230,16 @@ impl MetadataLoader for SpirvMetadataLoader {
link::read_metadata(path) link::read_metadata(path)
} }
fn get_dylib_metadata(&self, _: &Target, _: &Path) -> Result<MetadataRef, String> { fn get_dylib_metadata(&self, target: &Target, path: &Path) -> Result<MetadataRef, String> {
Err("TODO: implement get_dylib_metadata".to_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)
} }
} }