Move encode_metadata out of CrateStore.

This commit is contained in:
Camille GILLOT 2020-11-14 01:59:00 +01:00
parent 500e22e340
commit 745dee9d3e
2 changed files with 6 additions and 2 deletions

@ -96,7 +96,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
stack = &stack[..index + REPORT_SYMBOL_NAMES.len()];
}
const ENCODE_METADATA: &str = "rustc_middle::ty::context::TyCtxt::encode_metadata";
const ENCODE_METADATA: &str = "rustc_metadata::encode_metadata";
if let Some(index) = stack.find(ENCODE_METADATA) {
stack = &stack[..index + ENCODE_METADATA.len()];
}

@ -7,7 +7,11 @@ use rustc_middle::middle::cstore::EncodedMetadata;
use rustc_middle::ty::TyCtxt;
// Adapted from https://github.com/rust-lang/rust/blob/da573206f87b5510de4b0ee1a9c044127e409bd3/src/librustc_codegen_llvm/base.rs#L47-L112
pub(crate) fn new_metadata_object(tcx: TyCtxt<'_>, cgu_name: &str, metadata: &EncodedMetadata) -> Vec<u8> {
pub(crate) fn new_metadata_object(
tcx: TyCtxt<'_>,
cgu_name: &str,
metadata: &EncodedMetadata,
) -> Vec<u8> {
use snap::write::FrameEncoder;
use std::io::Write;