Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 7 pull requests #42010

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
63ecd6a
Prohibit parenthesized params in more types.
qnighy May 9, 2017
a9cb094
Explain why `thread::yield_now` could be used.
May 13, 2017
a51777e
Improve `thread::Builder` documentation.
May 14, 2017
1a24a59
Remove rustc_llvm dependency from rustc_metadata
Apr 26, 2017
93f78bc
rustdoc: Display `extern "C" fn` instead of `extern fn`
ollie27 May 14, 2017
c0d5aa8
Make unsatisfied trait bounds note multiline
estebank Apr 24, 2017
f92bd3d
Add links to the `thread::LocalKey` doc.
May 14, 2017
2a20073
Prohibit parenthesized params in bounds etc.
qnighy May 15, 2017
8e4f315
Remove rustc_llvm dependency from librustc
Apr 30, 2017
e3f6e68
Remove (direct) rustc_llvm dependency from rustc_driver
Apr 30, 2017
acdeedc
Use AtomicBool instead of a 'static mut' for LLVM init posioning
May 14, 2017
04a16ff
Fix run-make/llvm-pass
May 15, 2017
5f50f4d
Rollup merge of #41489 - estebank:trait-bounds-diagnosstic, r=arielb1
frewsxcv May 15, 2017
4e61eb7
Rollup merge of #41565 - rkruppe:llvm-sys, r=eddyb
frewsxcv May 15, 2017
59d5f1b
Rollup merge of #41856 - qnighy:prohibit-parenthesized-params-in-more…
frewsxcv May 15, 2017
69d50aa
Rollup merge of #41982 - gamazeps:thread-yield-now, r=GuillaumeGomez
frewsxcv May 15, 2017
d4545f6
Rollup merge of #41994 - gamazeps:thread-builder, r=GuillaumeGomez
frewsxcv May 15, 2017
0b3456f
Rollup merge of #41995 - gamazeps:thread-localkey, r=frewsxcv
frewsxcv May 15, 2017
09bdb9d
Rollup merge of #42001 - ollie27:rustdoc_extern_fn, r=GuillaumeGomez
frewsxcv May 15, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions src/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/librustc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ arena = { path = "../libarena" }
fmt_macros = { path = "../libfmt_macros" }
graphviz = { path = "../libgraphviz" }
log = "0.3"
owning_ref = "0.3.3"
rustc_back = { path = "../librustc_back" }
rustc_bitflags = { path = "../librustc_bitflags" }
rustc_const_math = { path = "../librustc_const_math" }
rustc_data_structures = { path = "../librustc_data_structures" }
rustc_errors = { path = "../librustc_errors" }
rustc_llvm = { path = "../librustc_llvm" }
serialize = { path = "../libserialize" }
syntax = { path = "../libsyntax" }
syntax_pos = { path = "../libsyntax_pos" }
2 changes: 1 addition & 1 deletion src/librustc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ extern crate fmt_macros;
extern crate getopts;
extern crate graphviz;
extern crate libc;
extern crate rustc_llvm as llvm;
extern crate owning_ref;
extern crate rustc_back;
extern crate rustc_data_structures;
extern crate serialize;
Expand Down
32 changes: 27 additions & 5 deletions src/librustc/middle/cstore.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ use session::search_paths::PathKind;
use util::nodemap::{NodeSet, DefIdMap};

use std::any::Any;
use std::path::PathBuf;
use std::path::{Path, PathBuf};
use std::rc::Rc;
use owning_ref::ErasedBoxRef;
use syntax::ast;
use syntax::ext::base::SyntaxExtension;
use syntax::symbol::Symbol;
Expand Down Expand Up @@ -201,11 +202,33 @@ impl EncodedMetadataHashes {
}
}

/// The backend's way to give the crate store access to the metadata in a library.
/// Note that it returns the raw metadata bytes stored in the library file, whether
/// it is compressed, uncompressed, some weird mix, etc.
/// rmeta files are backend independent and not handled here.
///
/// At the time of this writing, there is only one backend and one way to store
/// metadata in library -- this trait just serves to decouple rustc_metadata from
/// the archive reader, which depends on LLVM.
pub trait MetadataLoader {
fn get_rlib_metadata(&self,
target: &Target,
filename: &Path)
-> Result<ErasedBoxRef<[u8]>, String>;
fn get_dylib_metadata(&self,
target: &Target,
filename: &Path)
-> Result<ErasedBoxRef<[u8]>, String>;
}

/// A store of Rust crates, through with their metadata
/// can be accessed.
pub trait CrateStore {
fn crate_data_as_rc_any(&self, krate: CrateNum) -> Rc<Any>;

// access to the metadata loader
fn metadata_loader(&self) -> &MetadataLoader;

// item info
fn visibility(&self, def: DefId) -> ty::Visibility;
fn visible_parent_map<'a>(&'a self) -> ::std::cell::Ref<'a, DefIdMap<DefId>>;
Expand Down Expand Up @@ -275,8 +298,6 @@ pub trait CrateStore {
fn used_link_args(&self) -> Vec<String>;

// utility functions
fn metadata_filename(&self) -> &str;
fn metadata_section_name(&self, target: &Target) -> &str;
fn used_crates(&self, prefer: LinkagePreference) -> Vec<(CrateNum, LibSource)>;
fn used_crate_source(&self, cnum: CrateNum) -> CrateSource;
fn extern_mod_stmt_cnum(&self, emod_id: ast::NodeId) -> Option<CrateNum>;
Expand Down Expand Up @@ -413,8 +434,6 @@ impl CrateStore for DummyCrateStore {
fn used_link_args(&self) -> Vec<String> { vec![] }

// utility functions
fn metadata_filename(&self) -> &str { bug!("metadata_filename") }
fn metadata_section_name(&self, target: &Target) -> &str { bug!("metadata_section_name") }
fn used_crates(&self, prefer: LinkagePreference) -> Vec<(CrateNum, LibSource)>
{ vec![] }
fn used_crate_source(&self, cnum: CrateNum) -> CrateSource { bug!("used_crate_source") }
Expand All @@ -427,6 +446,9 @@ impl CrateStore for DummyCrateStore {
bug!("encode_metadata")
}
fn metadata_encoding_version(&self) -> &[u8] { bug!("metadata_encoding_version") }

// access to the metadata loader
fn metadata_loader(&self) -> &MetadataLoader { bug!("metadata_loader") }
}

pub trait CrateLoader {
Expand Down
2 changes: 1 addition & 1 deletion src/librustc/session/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ top_level_options!(
}
);

#[derive(Clone, PartialEq, Eq)]
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub enum PrintRequest {
FileNames,
Sysroot,
Expand Down
54 changes: 0 additions & 54 deletions src/librustc/session/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,19 +37,16 @@ use syntax_pos::{Span, MultiSpan, FileMap};
use rustc_back::{LinkerFlavor, PanicStrategy};
use rustc_back::target::Target;
use rustc_data_structures::flock;
use llvm;

use std::path::{Path, PathBuf};
use std::cell::{self, Cell, RefCell};
use std::collections::HashMap;
use std::env;
use std::ffi::CString;
use std::io::Write;
use std::rc::Rc;
use std::fmt;
use std::time::Duration;
use std::sync::Arc;
use libc::c_int;

mod code_stats;
pub mod config;
Expand Down Expand Up @@ -713,8 +710,6 @@ pub fn build_session_(sopts: config::Options,
out_of_fuel: Cell::new(false),
};

init_llvm(&sess);

sess
}

Expand Down Expand Up @@ -743,55 +738,6 @@ pub enum IncrCompSession {
}
}

fn init_llvm(sess: &Session) {
unsafe {
// Before we touch LLVM, make sure that multithreading is enabled.
use std::sync::Once;
static INIT: Once = Once::new();
static mut POISONED: bool = false;
INIT.call_once(|| {
if llvm::LLVMStartMultithreaded() != 1 {
// use an extra bool to make sure that all future usage of LLVM
// cannot proceed despite the Once not running more than once.
POISONED = true;
}

configure_llvm(sess);
});

if POISONED {
bug!("couldn't enable multi-threaded LLVM");
}
}
}

unsafe fn configure_llvm(sess: &Session) {
let mut llvm_c_strs = Vec::new();
let mut llvm_args = Vec::new();

{
let mut add = |arg: &str| {
let s = CString::new(arg).unwrap();
llvm_args.push(s.as_ptr());
llvm_c_strs.push(s);
};
add("rustc"); // fake program name
if sess.time_llvm_passes() { add("-time-passes"); }
if sess.print_llvm_passes() { add("-debug-pass=Structure"); }

for arg in &sess.opts.cg.llvm_args {
add(&(*arg));
}
}

llvm::LLVMInitializePasses();

llvm::initialize_available_targets();

llvm::LLVMRustSetLLVMOptions(llvm_args.len() as c_int,
llvm_args.as_ptr());
}

pub fn early_error(output: config::ErrorOutputType, msg: &str) -> ! {
let emitter: Box<Emitter> = match output {
config::ErrorOutputType::HumanReadable(color_config) => {
Expand Down
1 change: 0 additions & 1 deletion src/librustc_driver/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ rustc_data_structures = { path = "../librustc_data_structures" }
rustc_errors = { path = "../librustc_errors" }
rustc_incremental = { path = "../librustc_incremental" }
rustc_lint = { path = "../librustc_lint" }
rustc_llvm = { path = "../librustc_llvm" }
rustc_metadata = { path = "../librustc_metadata" }
rustc_mir = { path = "../librustc_mir" }
rustc_passes = { path = "../librustc_passes" }
Expand Down
Loading