This commit is contained in:
bjorn3 2021-10-02 14:42:18 +02:00
commit d76afa705b
4 changed files with 10 additions and 6 deletions

View File

@ -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::rmeta::encoder::encode_metadata";
if let Some(index) = stack.find(ENCODE_METADATA) {
stack = &stack[..index + ENCODE_METADATA.len()];
}

View File

@ -6,8 +6,8 @@
use rustc_ast::{InlineAsmOptions, InlineAsmTemplatePiece};
use rustc_codegen_ssa::{CodegenResults, CompiledModule, CrateInfo, ModuleKind};
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
use rustc_metadata::EncodedMetadata;
use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
use rustc_middle::middle::cstore::EncodedMetadata;
use rustc_middle::mir::mono::{CodegenUnit, MonoItem};
use rustc_session::cgu_reuse_tracker::CguReuse;
use rustc_session::config::{DebugInfo, OutputType};

View File

@ -30,8 +30,8 @@
use rustc_codegen_ssa::traits::CodegenBackend;
use rustc_codegen_ssa::CodegenResults;
use rustc_errors::ErrorReported;
use rustc_metadata::EncodedMetadata;
use rustc_middle::dep_graph::{WorkProduct, WorkProductId};
use rustc_middle::middle::cstore::EncodedMetadata;
use rustc_session::config::OutputFilenames;
use rustc_session::Session;

View File

@ -3,16 +3,20 @@
use object::write::{Object, StandardSegment, Symbol, SymbolSection};
use object::{SectionKind, SymbolFlags, SymbolKind, SymbolScope};
use rustc_middle::middle::cstore::EncodedMetadata;
use rustc_metadata::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;
let mut compressed = rustc_metadata::METADATA_HEADER.to_vec();
FrameEncoder::new(&mut compressed).write_all(&metadata.raw_data).unwrap();
FrameEncoder::new(&mut compressed).write_all(metadata.raw_data()).unwrap();
let triple = crate::target_triple(tcx.sess);