Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Nov 20, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions crates/rustc_codegen_spirv/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,16 @@ impl MetadataLoader for SpirvMetadataLoader {
link::read_metadata(path)
}

fn get_dylib_metadata(&self, _: &Target, _: &Path) -> Result<MetadataRef, String> {
Err("TODO: implement get_dylib_metadata".to_string())
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)
}
}

Expand Down