Move crate_name field from OngoingCodegen to CrateInfo
This commit is contained in:
parent
96247017fa
commit
e30490d5b2
6 changed files with 6 additions and 9 deletions
|
@ -31,7 +31,7 @@ use rustc_session::config::{self, CrateType, Lto, OutputFilenames, OutputType};
|
|||
use rustc_session::config::{Passes, SwitchWithOptPath};
|
||||
use rustc_session::Session;
|
||||
use rustc_span::source_map::SourceMap;
|
||||
use rustc_span::symbol::{sym, Symbol};
|
||||
use rustc_span::symbol::sym;
|
||||
use rustc_span::{BytePos, FileName, InnerSpan, Pos, Span};
|
||||
use rustc_target::spec::{MergeFunctions, PanicStrategy, SanitizerSet};
|
||||
|
||||
|
@ -426,7 +426,6 @@ pub fn start_async_codegen<B: ExtraBackendMethods>(
|
|||
let (coordinator_send, coordinator_receive) = channel();
|
||||
let sess = tcx.sess;
|
||||
|
||||
let crate_name = tcx.crate_name(LOCAL_CRATE);
|
||||
let crate_attrs = tcx.hir().attrs(rustc_hir::CRATE_HIR_ID);
|
||||
let no_builtins = tcx.sess.contains_name(crate_attrs, sym::no_builtins);
|
||||
let is_compiler_builtins = tcx.sess.contains_name(crate_attrs, sym::compiler_builtins);
|
||||
|
@ -461,7 +460,6 @@ pub fn start_async_codegen<B: ExtraBackendMethods>(
|
|||
|
||||
OngoingCodegen {
|
||||
backend,
|
||||
crate_name,
|
||||
metadata,
|
||||
linker_info,
|
||||
crate_info,
|
||||
|
@ -1800,7 +1798,6 @@ impl SharedEmitterMain {
|
|||
|
||||
pub struct OngoingCodegen<B: ExtraBackendMethods> {
|
||||
pub backend: B,
|
||||
pub crate_name: Symbol,
|
||||
pub metadata: EncodedMetadata,
|
||||
pub linker_info: LinkerInfo,
|
||||
pub crate_info: CrateInfo,
|
||||
|
@ -1844,7 +1841,6 @@ impl<B: ExtraBackendMethods> OngoingCodegen<B> {
|
|||
|
||||
(
|
||||
CodegenResults {
|
||||
crate_name: self.crate_name,
|
||||
metadata: self.metadata,
|
||||
linker_info: self.linker_info,
|
||||
crate_info: self.crate_info,
|
||||
|
|
|
@ -756,6 +756,7 @@ impl<B: ExtraBackendMethods> Drop for AbortCodegenOnDrop<B> {
|
|||
|
||||
impl CrateInfo {
|
||||
pub fn new(tcx: TyCtxt<'_>) -> CrateInfo {
|
||||
let local_crate_name = tcx.crate_name(LOCAL_CRATE);
|
||||
let crate_attrs = tcx.hir().attrs(rustc_hir::CRATE_HIR_ID);
|
||||
let subsystem = tcx.sess.first_attr_value_str_by_name(crate_attrs, sym::windows_subsystem);
|
||||
let windows_subsystem = subsystem.map(|subsystem| {
|
||||
|
@ -770,6 +771,7 @@ impl CrateInfo {
|
|||
});
|
||||
|
||||
let mut info = CrateInfo {
|
||||
local_crate_name,
|
||||
panic_runtime: None,
|
||||
compiler_builtins: None,
|
||||
profiler_runtime: None,
|
||||
|
|
|
@ -128,6 +128,7 @@ impl From<&cstore::NativeLib> for NativeLib {
|
|||
/// and the corresponding properties without referencing information outside of a `CrateInfo`.
|
||||
#[derive(Debug, Encodable, Decodable)]
|
||||
pub struct CrateInfo {
|
||||
pub local_crate_name: Symbol,
|
||||
pub panic_runtime: Option<CrateNum>,
|
||||
pub compiler_builtins: Option<CrateNum>,
|
||||
pub profiler_runtime: Option<CrateNum>,
|
||||
|
@ -146,7 +147,6 @@ pub struct CrateInfo {
|
|||
|
||||
#[derive(Encodable, Decodable)]
|
||||
pub struct CodegenResults {
|
||||
pub crate_name: Symbol,
|
||||
pub modules: Vec<CompiledModule>,
|
||||
pub allocator_module: Option<CompiledModule>,
|
||||
pub metadata_module: Option<CompiledModule>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue