use tcx.crate_name(LOCAL_CRATE)
rather than LinkMeta::crate_name
This commit is contained in:
parent
3f59079f8a
commit
c22fdf9a3a
8 changed files with 14 additions and 15 deletions
|
@ -53,7 +53,6 @@ pub use self::NativeLibraryKind::*;
|
||||||
|
|
||||||
#[derive(Clone, Debug)]
|
#[derive(Clone, Debug)]
|
||||||
pub struct LinkMeta {
|
pub struct LinkMeta {
|
||||||
pub crate_name: Symbol,
|
|
||||||
pub crate_hash: Svh,
|
pub crate_hash: Svh,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1140,7 +1140,7 @@ pub fn phase_6_link_output(sess: &Session,
|
||||||
outputs: &OutputFilenames) {
|
outputs: &OutputFilenames) {
|
||||||
time(sess.time_passes(),
|
time(sess.time_passes(),
|
||||||
"linking",
|
"linking",
|
||||||
|| link::link_binary(sess, trans, outputs, &trans.link.crate_name.as_str()));
|
|| link::link_binary(sess, trans, outputs, &trans.crate_name.as_str()));
|
||||||
}
|
}
|
||||||
|
|
||||||
fn escape_dep_filename(filename: &str) -> String {
|
fn escape_dep_filename(filename: &str) -> String {
|
||||||
|
|
|
@ -14,7 +14,7 @@ use schema::*;
|
||||||
|
|
||||||
use rustc::middle::cstore::{LinkMeta, LinkagePreference, NativeLibrary,
|
use rustc::middle::cstore::{LinkMeta, LinkagePreference, NativeLibrary,
|
||||||
EncodedMetadata, EncodedMetadataHash};
|
EncodedMetadata, EncodedMetadataHash};
|
||||||
use rustc::hir::def_id::{CrateNum, CRATE_DEF_INDEX, DefIndex, DefId};
|
use rustc::hir::def_id::{CrateNum, CRATE_DEF_INDEX, DefIndex, DefId, LOCAL_CRATE};
|
||||||
use rustc::hir::map::definitions::DefPathTable;
|
use rustc::hir::map::definitions::DefPathTable;
|
||||||
use rustc::middle::dependency_format::Linkage;
|
use rustc::middle::dependency_format::Linkage;
|
||||||
use rustc::middle::lang_items;
|
use rustc::middle::lang_items;
|
||||||
|
@ -1380,7 +1380,7 @@ impl<'a, 'tcx> EncodeContext<'a, 'tcx> {
|
||||||
let link_meta = self.link_meta;
|
let link_meta = self.link_meta;
|
||||||
let is_proc_macro = tcx.sess.crate_types.borrow().contains(&CrateTypeProcMacro);
|
let is_proc_macro = tcx.sess.crate_types.borrow().contains(&CrateTypeProcMacro);
|
||||||
let root = self.lazy(&CrateRoot {
|
let root = self.lazy(&CrateRoot {
|
||||||
name: link_meta.crate_name,
|
name: tcx.crate_name(LOCAL_CRATE),
|
||||||
triple: tcx.sess.opts.target_triple.clone(),
|
triple: tcx.sess.opts.target_triple.clone(),
|
||||||
hash: link_meta.crate_hash,
|
hash: link_meta.crate_hash,
|
||||||
disambiguator: tcx.sess.local_crate_disambiguator(),
|
disambiguator: tcx.sess.local_crate_disambiguator(),
|
||||||
|
|
|
@ -47,7 +47,6 @@ use std::str;
|
||||||
use flate;
|
use flate;
|
||||||
use syntax::ast;
|
use syntax::ast;
|
||||||
use syntax::attr;
|
use syntax::attr;
|
||||||
use syntax::symbol::Symbol;
|
|
||||||
use syntax_pos::Span;
|
use syntax_pos::Span;
|
||||||
|
|
||||||
/// The LLVM module name containing crate-metadata. This includes a `.` on
|
/// The LLVM module name containing crate-metadata. This includes a `.` on
|
||||||
|
@ -136,11 +135,8 @@ pub fn find_crate_name(sess: Option<&Session>,
|
||||||
"rust_out".to_string()
|
"rust_out".to_string()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn build_link_meta(incremental_hashes_map: &IncrementalHashesMap,
|
pub fn build_link_meta(incremental_hashes_map: &IncrementalHashesMap) -> LinkMeta {
|
||||||
name: &str)
|
|
||||||
-> LinkMeta {
|
|
||||||
let r = LinkMeta {
|
let r = LinkMeta {
|
||||||
crate_name: Symbol::intern(name),
|
|
||||||
crate_hash: Svh::new(incremental_hashes_map[&DepNode::Krate].to_smaller_hash()),
|
crate_hash: Svh::new(incremental_hashes_map[&DepNode::Krate].to_smaller_hash()),
|
||||||
};
|
};
|
||||||
info!("{:?}", r);
|
info!("{:?}", r);
|
||||||
|
|
|
@ -1063,12 +1063,12 @@ pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||||
// particular items that will be processed.
|
// particular items that will be processed.
|
||||||
let krate = tcx.hir.krate();
|
let krate = tcx.hir.krate();
|
||||||
|
|
||||||
let ty::CrateAnalysis { reachable, name, .. } = analysis;
|
let ty::CrateAnalysis { reachable, .. } = analysis;
|
||||||
let exported_symbols = find_exported_symbols(tcx, reachable);
|
let exported_symbols = find_exported_symbols(tcx, reachable);
|
||||||
|
|
||||||
let check_overflow = tcx.sess.overflow_checks();
|
let check_overflow = tcx.sess.overflow_checks();
|
||||||
|
|
||||||
let link_meta = link::build_link_meta(incremental_hashes_map, &name);
|
let link_meta = link::build_link_meta(incremental_hashes_map);
|
||||||
|
|
||||||
let shared_ccx = SharedCrateContext::new(tcx,
|
let shared_ccx = SharedCrateContext::new(tcx,
|
||||||
link_meta.clone(),
|
link_meta.clone(),
|
||||||
|
@ -1096,6 +1096,7 @@ pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||||
let empty_exported_symbols = ExportedSymbols::empty();
|
let empty_exported_symbols = ExportedSymbols::empty();
|
||||||
let linker_info = LinkerInfo::new(&shared_ccx, &empty_exported_symbols);
|
let linker_info = LinkerInfo::new(&shared_ccx, &empty_exported_symbols);
|
||||||
return CrateTranslation {
|
return CrateTranslation {
|
||||||
|
crate_name: tcx.crate_name(LOCAL_CRATE),
|
||||||
modules: vec![],
|
modules: vec![],
|
||||||
metadata_module: metadata_module,
|
metadata_module: metadata_module,
|
||||||
link: link_meta,
|
link: link_meta,
|
||||||
|
@ -1307,6 +1308,7 @@ pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||||
});
|
});
|
||||||
|
|
||||||
CrateTranslation {
|
CrateTranslation {
|
||||||
|
crate_name: tcx.crate_name(LOCAL_CRATE),
|
||||||
modules: modules,
|
modules: modules,
|
||||||
metadata_module: metadata_module,
|
metadata_module: metadata_module,
|
||||||
link: link_meta,
|
link: link_meta,
|
||||||
|
|
|
@ -13,7 +13,7 @@ use llvm::{ContextRef, ModuleRef, ValueRef};
|
||||||
use rustc::dep_graph::{DepGraph, DepGraphSafe, DepNode, DepTrackingMap, DepTrackingMapConfig};
|
use rustc::dep_graph::{DepGraph, DepGraphSafe, DepNode, DepTrackingMap, DepTrackingMapConfig};
|
||||||
use middle::cstore::LinkMeta;
|
use middle::cstore::LinkMeta;
|
||||||
use rustc::hir;
|
use rustc::hir;
|
||||||
use rustc::hir::def_id::DefId;
|
use rustc::hir::def_id::{DefId, LOCAL_CRATE};
|
||||||
use rustc::traits;
|
use rustc::traits;
|
||||||
use debuginfo;
|
use debuginfo;
|
||||||
use callee;
|
use callee;
|
||||||
|
@ -439,7 +439,7 @@ impl<'b, 'tcx> SharedCrateContext<'b, 'tcx> {
|
||||||
|
|
||||||
pub fn metadata_symbol_name(&self) -> String {
|
pub fn metadata_symbol_name(&self) -> String {
|
||||||
format!("rust_metadata_{}_{}",
|
format!("rust_metadata_{}_{}",
|
||||||
self.link_meta().crate_name,
|
self.tcx().crate_name(LOCAL_CRATE),
|
||||||
self.link_meta().crate_hash)
|
self.link_meta().crate_hash)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ use llvm::debuginfo::{DIType, DIFile, DIScope, DIDescriptor,
|
||||||
DICompositeType, DILexicalBlock, DIFlags};
|
DICompositeType, DILexicalBlock, DIFlags};
|
||||||
|
|
||||||
use rustc::hir::def::CtorKind;
|
use rustc::hir::def::CtorKind;
|
||||||
use rustc::hir::def_id::DefId;
|
use rustc::hir::def_id::{DefId, LOCAL_CRATE};
|
||||||
use rustc::ty::fold::TypeVisitor;
|
use rustc::ty::fold::TypeVisitor;
|
||||||
use rustc::ty::subst::Substs;
|
use rustc::ty::subst::Substs;
|
||||||
use rustc::ty::util::TypeIdHasher;
|
use rustc::ty::util::TypeIdHasher;
|
||||||
|
@ -810,7 +810,7 @@ pub fn compile_unit_metadata(scc: &SharedCrateContext,
|
||||||
};
|
};
|
||||||
|
|
||||||
fn fallback_path(scc: &SharedCrateContext) -> CString {
|
fn fallback_path(scc: &SharedCrateContext) -> CString {
|
||||||
CString::new(scc.link_meta().crate_name.to_string()).unwrap()
|
CString::new(scc.tcx().crate_name(LOCAL_CRATE).to_string()).unwrap()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#![feature(conservative_impl_trait)]
|
#![feature(conservative_impl_trait)]
|
||||||
|
|
||||||
use rustc::dep_graph::WorkProduct;
|
use rustc::dep_graph::WorkProduct;
|
||||||
|
use syntax_pos::symbol::Symbol;
|
||||||
|
|
||||||
extern crate flate;
|
extern crate flate;
|
||||||
extern crate libc;
|
extern crate libc;
|
||||||
|
@ -165,6 +166,7 @@ unsafe impl Send for ModuleTranslation { }
|
||||||
unsafe impl Sync for ModuleTranslation { }
|
unsafe impl Sync for ModuleTranslation { }
|
||||||
|
|
||||||
pub struct CrateTranslation {
|
pub struct CrateTranslation {
|
||||||
|
pub crate_name: Symbol,
|
||||||
pub modules: Vec<ModuleTranslation>,
|
pub modules: Vec<ModuleTranslation>,
|
||||||
pub metadata_module: ModuleTranslation,
|
pub metadata_module: ModuleTranslation,
|
||||||
pub link: middle::cstore::LinkMeta,
|
pub link: middle::cstore::LinkMeta,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue