Fix for upstream changes
This commit is contained in:
parent
d703552325
commit
e130ccc54e
7 changed files with 41 additions and 37 deletions
1
src/Cargo.lock
generated
1
src/Cargo.lock
generated
|
@ -1785,7 +1785,6 @@ dependencies = [
|
||||||
"owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
"owning_ref 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"rustc 0.0.0",
|
"rustc 0.0.0",
|
||||||
"rustc_back 0.0.0",
|
"rustc_back 0.0.0",
|
||||||
"rustc_incremental 0.0.0",
|
|
||||||
"syntax 0.0.0",
|
"syntax 0.0.0",
|
||||||
"syntax_pos 0.0.0",
|
"syntax_pos 0.0.0",
|
||||||
]
|
]
|
||||||
|
|
|
@ -94,6 +94,8 @@ use syntax::ast;
|
||||||
|
|
||||||
use mir::lvalue::Alignment;
|
use mir::lvalue::Alignment;
|
||||||
|
|
||||||
|
pub use rustc_trans_utils::find_exported_symbols;
|
||||||
|
|
||||||
pub struct StatRecorder<'a, 'tcx: 'a> {
|
pub struct StatRecorder<'a, 'tcx: 'a> {
|
||||||
ccx: &'a CrateContext<'a, 'tcx>,
|
ccx: &'a CrateContext<'a, 'tcx>,
|
||||||
name: Option<String>,
|
name: Option<String>,
|
||||||
|
@ -887,7 +889,6 @@ fn iter_globals(llmod: llvm::ModuleRef) -> ValueIter {
|
||||||
pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
pub fn trans_crate<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||||
rx: mpsc::Receiver<Box<Any + Send>>)
|
rx: mpsc::Receiver<Box<Any + Send>>)
|
||||||
-> OngoingCrateTranslation {
|
-> OngoingCrateTranslation {
|
||||||
use rustc_trans_utils::find_exported_symbols;
|
|
||||||
|
|
||||||
check_for_rustc_errors_attr(tcx);
|
check_for_rustc_errors_attr(tcx);
|
||||||
|
|
||||||
|
|
|
@ -138,12 +138,13 @@ mod type_;
|
||||||
mod type_of;
|
mod type_of;
|
||||||
mod value;
|
mod value;
|
||||||
|
|
||||||
use rustc::ty::{self, TyCtxt, CrateAnalysis};
|
use std::sync::mpsc;
|
||||||
|
use std::any::Any;
|
||||||
|
use rustc::ty::{self, TyCtxt};
|
||||||
use rustc::session::Session;
|
use rustc::session::Session;
|
||||||
use rustc::session::config::OutputFilenames;
|
use rustc::session::config::OutputFilenames;
|
||||||
use rustc::middle::cstore::MetadataLoader;
|
use rustc::middle::cstore::MetadataLoader;
|
||||||
use rustc::dep_graph::DepGraph;
|
use rustc::dep_graph::DepGraph;
|
||||||
use rustc_incremental::IncrementalHashesMap;
|
|
||||||
|
|
||||||
pub struct LlvmTransCrate(());
|
pub struct LlvmTransCrate(());
|
||||||
|
|
||||||
|
@ -162,17 +163,19 @@ impl rustc_trans_utils::trans_crate::TransCrate for LlvmTransCrate {
|
||||||
box metadata::LlvmMetadataLoader
|
box metadata::LlvmMetadataLoader
|
||||||
}
|
}
|
||||||
|
|
||||||
fn provide(providers: &mut ty::maps::Providers) {
|
fn provide_local(providers: &mut ty::maps::Providers) {
|
||||||
back::symbol_names::provide(providers);
|
provide_local(providers);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn provide_extern(providers: &mut ty::maps::Providers) {
|
||||||
|
provide_extern(providers);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn trans_crate<'a, 'tcx>(
|
fn trans_crate<'a, 'tcx>(
|
||||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||||
analysis: CrateAnalysis,
|
rx: mpsc::Receiver<Box<Any + Send>>
|
||||||
incr_hashes_map: IncrementalHashesMap,
|
|
||||||
output_filenames: &OutputFilenames
|
|
||||||
) -> Self::OngoingCrateTranslation {
|
) -> Self::OngoingCrateTranslation {
|
||||||
base::trans_crate(tcx, analysis, incr_hashes_map, output_filenames)
|
base::trans_crate(tcx, rx)
|
||||||
}
|
}
|
||||||
|
|
||||||
fn join_trans(
|
fn join_trans(
|
||||||
|
|
|
@ -19,4 +19,3 @@ syntax = { path = "../libsyntax" }
|
||||||
syntax_pos = { path = "../libsyntax_pos" }
|
syntax_pos = { path = "../libsyntax_pos" }
|
||||||
rustc = { path = "../librustc" }
|
rustc = { path = "../librustc" }
|
||||||
rustc_back = { path = "../librustc_back" }
|
rustc_back = { path = "../librustc_back" }
|
||||||
rustc_incremental = { path = "../librustc_incremental" }
|
|
||||||
|
|
|
@ -38,12 +38,12 @@ extern crate log;
|
||||||
#[macro_use]
|
#[macro_use]
|
||||||
extern crate rustc;
|
extern crate rustc;
|
||||||
extern crate rustc_back;
|
extern crate rustc_back;
|
||||||
extern crate rustc_incremental;
|
|
||||||
extern crate syntax;
|
extern crate syntax;
|
||||||
extern crate syntax_pos;
|
extern crate syntax_pos;
|
||||||
|
|
||||||
use rustc::ty::TyCtxt;
|
use rustc::ty::TyCtxt;
|
||||||
use rustc::hir;
|
use rustc::hir;
|
||||||
|
use rustc::hir::def_id::LOCAL_CRATE;
|
||||||
use rustc::hir::map as hir_map;
|
use rustc::hir::map as hir_map;
|
||||||
use rustc::util::nodemap::NodeSet;
|
use rustc::util::nodemap::NodeSet;
|
||||||
|
|
||||||
|
@ -60,8 +60,8 @@ pub mod trans_crate;
|
||||||
///
|
///
|
||||||
/// This list is later used by linkers to determine the set of symbols needed to
|
/// This list is later used by linkers to determine the set of symbols needed to
|
||||||
/// be exposed from a dynamic library and it's also encoded into the metadata.
|
/// be exposed from a dynamic library and it's also encoded into the metadata.
|
||||||
pub fn find_exported_symbols(tcx: TyCtxt, reachable: &NodeSet) -> NodeSet {
|
pub fn find_exported_symbols(tcx: TyCtxt) -> NodeSet {
|
||||||
reachable.iter().cloned().filter(|&id| {
|
tcx.reachable_set(LOCAL_CRATE).0.iter().cloned().filter(|&id| {
|
||||||
// Next, we want to ignore some FFI functions that are not exposed from
|
// Next, we want to ignore some FFI functions that are not exposed from
|
||||||
// this crate. Reachable FFI functions can be lumped into two
|
// this crate. Reachable FFI functions can be lumped into two
|
||||||
// categories:
|
// categories:
|
||||||
|
|
|
@ -8,12 +8,11 @@
|
||||||
// option. This file may not be copied, modified, or distributed
|
// option. This file may not be copied, modified, or distributed
|
||||||
// except according to those terms.
|
// except according to those terms.
|
||||||
|
|
||||||
|
use rustc::ich::Fingerprint;
|
||||||
use rustc::session::config::{self, OutputFilenames, Input, OutputType};
|
use rustc::session::config::{self, OutputFilenames, Input, OutputType};
|
||||||
use rustc::session::Session;
|
use rustc::session::Session;
|
||||||
use rustc::middle::cstore::{self, LinkMeta};
|
use rustc::middle::cstore::{self, LinkMeta};
|
||||||
use rustc::dep_graph::{DepKind, DepNode};
|
|
||||||
use rustc::hir::svh::Svh;
|
use rustc::hir::svh::Svh;
|
||||||
use rustc_incremental::IncrementalHashesMap;
|
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use syntax::ast;
|
use syntax::ast;
|
||||||
use syntax_pos::Span;
|
use syntax_pos::Span;
|
||||||
|
@ -51,10 +50,9 @@ fn is_writeable(p: &Path) -> bool {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn build_link_meta(incremental_hashes_map: &IncrementalHashesMap) -> LinkMeta {
|
pub fn build_link_meta(crate_hash: Fingerprint) -> LinkMeta {
|
||||||
let krate_dep_node = &DepNode::new_no_params(DepKind::Krate);
|
|
||||||
let r = LinkMeta {
|
let r = LinkMeta {
|
||||||
crate_hash: Svh::new(incremental_hashes_map[krate_dep_node].to_smaller_hash()),
|
crate_hash: Svh::new(crate_hash.to_smaller_hash()),
|
||||||
};
|
};
|
||||||
info!("{:?}", r);
|
info!("{:?}", r);
|
||||||
return r;
|
return r;
|
||||||
|
|
|
@ -21,10 +21,12 @@
|
||||||
|
|
||||||
#![feature(box_syntax)]
|
#![feature(box_syntax)]
|
||||||
|
|
||||||
|
use std::any::Any;
|
||||||
use std::io::prelude::*;
|
use std::io::prelude::*;
|
||||||
use std::io::{self, Cursor};
|
use std::io::{self, Cursor};
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
use std::sync::mpsc;
|
||||||
|
|
||||||
use owning_ref::{ErasedBoxRef, OwningRef};
|
use owning_ref::{ErasedBoxRef, OwningRef};
|
||||||
use ar::{Archive, Builder, Header};
|
use ar::{Archive, Builder, Header};
|
||||||
|
@ -35,13 +37,12 @@ use syntax::symbol::Symbol;
|
||||||
use rustc::hir::def_id::LOCAL_CRATE;
|
use rustc::hir::def_id::LOCAL_CRATE;
|
||||||
use rustc::session::Session;
|
use rustc::session::Session;
|
||||||
use rustc::session::config::{CrateType, OutputFilenames};
|
use rustc::session::config::{CrateType, OutputFilenames};
|
||||||
use rustc::ty::{CrateAnalysis, TyCtxt};
|
use rustc::ty::TyCtxt;
|
||||||
use rustc::ty::maps::Providers;
|
use rustc::ty::maps::Providers;
|
||||||
use rustc::middle::cstore::EncodedMetadata;
|
use rustc::middle::cstore::EncodedMetadata;
|
||||||
use rustc::middle::cstore::MetadataLoader as MetadataLoaderTrait;
|
use rustc::middle::cstore::MetadataLoader as MetadataLoaderTrait;
|
||||||
use rustc::dep_graph::DepGraph;
|
use rustc::dep_graph::{DepGraph, DepNode, DepKind};
|
||||||
use rustc_back::target::Target;
|
use rustc_back::target::Target;
|
||||||
use rustc_incremental::IncrementalHashesMap;
|
|
||||||
use link::{build_link_meta, out_filename};
|
use link::{build_link_meta, out_filename};
|
||||||
|
|
||||||
pub trait TransCrate {
|
pub trait TransCrate {
|
||||||
|
@ -50,12 +51,11 @@ pub trait TransCrate {
|
||||||
type TranslatedCrate;
|
type TranslatedCrate;
|
||||||
|
|
||||||
fn metadata_loader() -> Box<MetadataLoaderTrait>;
|
fn metadata_loader() -> Box<MetadataLoaderTrait>;
|
||||||
fn provide(_providers: &mut Providers);
|
fn provide_local(_providers: &mut Providers);
|
||||||
|
fn provide_extern(_providers: &mut Providers);
|
||||||
fn trans_crate<'a, 'tcx>(
|
fn trans_crate<'a, 'tcx>(
|
||||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||||
analysis: CrateAnalysis,
|
rx: mpsc::Receiver<Box<Any + Send>>
|
||||||
incr_hashes_map: IncrementalHashesMap,
|
|
||||||
output_filenames: &OutputFilenames
|
|
||||||
) -> Self::OngoingCrateTranslation;
|
) -> Self::OngoingCrateTranslation;
|
||||||
fn join_trans(
|
fn join_trans(
|
||||||
trans: Self::OngoingCrateTranslation,
|
trans: Self::OngoingCrateTranslation,
|
||||||
|
@ -77,15 +77,17 @@ impl TransCrate for DummyTransCrate {
|
||||||
box DummyMetadataLoader(())
|
box DummyMetadataLoader(())
|
||||||
}
|
}
|
||||||
|
|
||||||
fn provide(_providers: &mut Providers) {
|
fn provide_local(_providers: &mut Providers) {
|
||||||
bug!("DummyTransCrate::provide");
|
bug!("DummyTransCrate::provide_local");
|
||||||
|
}
|
||||||
|
|
||||||
|
fn provide_extern(_providers: &mut Providers) {
|
||||||
|
bug!("DummyTransCrate::provide_extern");
|
||||||
}
|
}
|
||||||
|
|
||||||
fn trans_crate<'a, 'tcx>(
|
fn trans_crate<'a, 'tcx>(
|
||||||
_tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
_tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||||
_analysis: CrateAnalysis,
|
_rx: mpsc::Receiver<Box<Any + Send>>
|
||||||
_incr_hashes_map: IncrementalHashesMap,
|
|
||||||
_output_filenames: &OutputFilenames
|
|
||||||
) -> Self::OngoingCrateTranslation {
|
) -> Self::OngoingCrateTranslation {
|
||||||
bug!("DummyTransCrate::trans_crate");
|
bug!("DummyTransCrate::trans_crate");
|
||||||
}
|
}
|
||||||
|
@ -176,16 +178,18 @@ impl TransCrate for MetadataOnlyTransCrate {
|
||||||
box NoLlvmMetadataLoader
|
box NoLlvmMetadataLoader
|
||||||
}
|
}
|
||||||
|
|
||||||
fn provide(_providers: &mut Providers) {}
|
fn provide_local(_providers: &mut Providers) {}
|
||||||
|
fn provide_extern(_providers: &mut Providers) {}
|
||||||
|
|
||||||
fn trans_crate<'a, 'tcx>(
|
fn trans_crate<'a, 'tcx>(
|
||||||
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
tcx: TyCtxt<'a, 'tcx, 'tcx>,
|
||||||
analysis: CrateAnalysis,
|
_rx: mpsc::Receiver<Box<Any + Send>>
|
||||||
incr_hashes_map: IncrementalHashesMap,
|
|
||||||
_output_filenames: &OutputFilenames,
|
|
||||||
) -> Self::OngoingCrateTranslation {
|
) -> Self::OngoingCrateTranslation {
|
||||||
let link_meta = build_link_meta(&incr_hashes_map);
|
let crate_hash = tcx.dep_graph
|
||||||
let exported_symbols = ::find_exported_symbols(tcx, &analysis.reachable);
|
.fingerprint_of(&DepNode::new_no_params(DepKind::Krate))
|
||||||
|
.unwrap();
|
||||||
|
let link_meta = build_link_meta(crate_hash);
|
||||||
|
let exported_symbols = ::find_exported_symbols(tcx);
|
||||||
let (metadata, _hashes) = tcx.encode_metadata(&link_meta, &exported_symbols);
|
let (metadata, _hashes) = tcx.encode_metadata(&link_meta, &exported_symbols);
|
||||||
|
|
||||||
OngoingCrateTranslation {
|
OngoingCrateTranslation {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue