Less cfg's
This commit is contained in:
parent
bffc973da8
commit
03584a2d8c
@ -73,10 +73,7 @@ pub fn compile_input(sess: &Session,
|
||||
output: &Option<PathBuf>,
|
||||
addl_plugins: Option<Vec<String>>,
|
||||
control: &CompileController) -> CompileResult {
|
||||
#[cfg(feature="llvm")]
|
||||
use rustc_trans::back::write::OngoingCrateTranslation;
|
||||
#[cfg(not(feature="llvm"))]
|
||||
type OngoingCrateTranslation = ();
|
||||
|
||||
macro_rules! controller_entry_point {
|
||||
($point: ident, $tsess: expr, $make_state: expr, $phase_result: expr) => {{
|
||||
@ -393,7 +390,6 @@ pub struct CompileState<'a, 'tcx: 'a> {
|
||||
pub resolutions: Option<&'a Resolutions>,
|
||||
pub analysis: Option<&'a ty::CrateAnalysis>,
|
||||
pub tcx: Option<TyCtxt<'a, 'tcx, 'tcx>>,
|
||||
#[cfg(feature="llvm")]
|
||||
pub trans: Option<&'a trans::CrateTranslation>,
|
||||
}
|
||||
|
||||
@ -420,7 +416,6 @@ impl<'a, 'tcx> CompileState<'a, 'tcx> {
|
||||
resolutions: None,
|
||||
analysis: None,
|
||||
tcx: None,
|
||||
#[cfg(feature="llvm")]
|
||||
trans: None,
|
||||
}
|
||||
}
|
||||
@ -942,7 +937,6 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
|
||||
mir::provide(&mut local_providers);
|
||||
reachable::provide(&mut local_providers);
|
||||
rustc_privacy::provide(&mut local_providers);
|
||||
#[cfg(feature="llvm")]
|
||||
trans::provide(&mut local_providers);
|
||||
typeck::provide(&mut local_providers);
|
||||
ty::provide(&mut local_providers);
|
||||
@ -955,7 +949,6 @@ pub fn phase_3_run_analysis_passes<'tcx, F, R>(sess: &'tcx Session,
|
||||
|
||||
let mut extern_providers = ty::maps::Providers::default();
|
||||
cstore::provide(&mut extern_providers);
|
||||
#[cfg(feature="llvm")]
|
||||
trans::provide(&mut extern_providers);
|
||||
ty::provide_extern(&mut extern_providers);
|
||||
traits::provide_extern(&mut extern_providers);
|
||||
|
@ -71,8 +71,6 @@ use pretty::{PpMode, UserIdentifiedItem};
|
||||
use rustc_resolve as resolve;
|
||||
use rustc_save_analysis as save;
|
||||
use rustc_save_analysis::DumpHandler;
|
||||
#[cfg(feature="llvm")]
|
||||
use rustc_trans::back::write::{RELOC_MODEL_ARGS, CODE_GEN_MODEL_ARGS};
|
||||
use rustc::dep_graph::DepGraph;
|
||||
use rustc::session::{self, config, Session, build_session, CompileResult};
|
||||
use rustc::session::CompileIncomplete;
|
||||
@ -207,6 +205,25 @@ impl MetadataLoaderTrait for NoLLvmMetadataLoader {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature="llvm")]
|
||||
mod rustc_trans {
|
||||
use rustc::ty::maps::Providers;
|
||||
pub fn init(_sess: &Session) {}
|
||||
pub fn enable_llvm_debug() {}
|
||||
pub fn provide(_providers: &mut Providers) {}
|
||||
pub struct CrateTranslation(());
|
||||
pub mod back {
|
||||
pub mod write {
|
||||
pub struct OngoingCrateTranslation(());
|
||||
}
|
||||
}
|
||||
mod diagnostics {
|
||||
register_long_diagnostics! {}
|
||||
}
|
||||
|
||||
pub use diagnostics::DIAGNOSTICS;
|
||||
}
|
||||
|
||||
// Parse args and run the compiler. This is the primary entry point for rustc.
|
||||
// See comments on CompilerCalls below for details about the callbacks argument.
|
||||
// The FileLoader provides a way to load files from sources other than the file system.
|
||||
@ -232,7 +249,6 @@ pub fn run_compiler<'a>(args: &[String],
|
||||
let (sopts, cfg) = config::build_session_options_and_crate_config(&matches);
|
||||
|
||||
if sopts.debugging_opts.debug_llvm {
|
||||
#[cfg(feature="llvm")]
|
||||
rustc_trans::enable_llvm_debug();
|
||||
}
|
||||
|
||||
@ -262,7 +278,6 @@ pub fn run_compiler<'a>(args: &[String],
|
||||
let mut sess = session::build_session_with_codemap(
|
||||
sopts, &dep_graph, input_file_path, descriptions, cstore.clone(), codemap, emitter_dest,
|
||||
);
|
||||
#[cfg(feature="llvm")]
|
||||
rustc_trans::init(&sess);
|
||||
rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess));
|
||||
|
||||
@ -544,7 +559,6 @@ impl<'a> CompilerCalls<'a> for RustcDefaultCalls {
|
||||
None,
|
||||
descriptions.clone(),
|
||||
cstore.clone());
|
||||
#[cfg(feature="llvm")]
|
||||
rustc_trans::init(&sess);
|
||||
rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess));
|
||||
let mut cfg = config::build_configuration(&sess, cfg.clone());
|
||||
@ -803,7 +817,7 @@ impl RustcDefaultCalls {
|
||||
PrintRequest::RelocationModels => {
|
||||
println!("Available relocation models:");
|
||||
#[cfg(feature="llvm")]
|
||||
for &(name, _) in RELOC_MODEL_ARGS.iter() {
|
||||
for &(name, _) in rustc_trans::back::write::RELOC_MODEL_ARGS.iter() {
|
||||
println!(" {}", name);
|
||||
}
|
||||
println!("");
|
||||
@ -811,7 +825,7 @@ impl RustcDefaultCalls {
|
||||
PrintRequest::CodeModels => {
|
||||
println!("Available code models:");
|
||||
#[cfg(feature="llvm")]
|
||||
for &(name, _) in CODE_GEN_MODEL_ARGS.iter(){
|
||||
for &(name, _) in rustc_trans::back::write::CODE_GEN_MODEL_ARGS.iter(){
|
||||
println!(" {}", name);
|
||||
}
|
||||
println!("");
|
||||
@ -1285,7 +1299,6 @@ pub fn diagnostics_registry() -> errors::registry::Registry {
|
||||
all_errors.extend_from_slice(&rustc_borrowck::DIAGNOSTICS);
|
||||
all_errors.extend_from_slice(&rustc_resolve::DIAGNOSTICS);
|
||||
all_errors.extend_from_slice(&rustc_privacy::DIAGNOSTICS);
|
||||
#[cfg(feature="llvm")]
|
||||
all_errors.extend_from_slice(&rustc_trans::DIAGNOSTICS);
|
||||
all_errors.extend_from_slice(&rustc_const_eval::DIAGNOSTICS);
|
||||
all_errors.extend_from_slice(&rustc_metadata::DIAGNOSTICS);
|
||||
|
@ -114,7 +114,6 @@ fn test_env<F>(source_string: &str,
|
||||
diagnostic_handler,
|
||||
Rc::new(CodeMap::new(FilePathMapping::empty())),
|
||||
cstore.clone());
|
||||
#[cfg(feature="llvm")]
|
||||
rustc_trans::init(&sess);
|
||||
rustc_lint::register_builtins(&mut sess.lint_store.borrow_mut(), Some(&sess));
|
||||
let input = config::Input::Str {
|
||||
|
@ -8,34 +8,11 @@
|
||||
// option. This file may not be copied, modified, or distributed
|
||||
// except according to those terms.
|
||||
|
||||
use rustc::session::config::{self, /*NoDebugInfo,*/ OutputFilenames, Input, OutputType};
|
||||
/*use rustc::session::filesearch;
|
||||
use rustc::session::search_paths::PathKind;
|
||||
*/use rustc::session::Session;
|
||||
use rustc::middle::cstore;/*::{self, LinkMeta, NativeLibrary, LibSource, LinkagePreference,
|
||||
NativeLibraryKind};*/
|
||||
/*use rustc::middle::dependency_format::Linkage;
|
||||
use rustc::util::common::time;
|
||||
use rustc::util::fs::fix_windows_verbatim_for_gcc;
|
||||
use rustc::dep_graph::{DepKind, DepNode};
|
||||
use rustc::hir::def_id::CrateNum;
|
||||
use rustc::hir::svh::Svh;
|
||||
use rustc_back::tempdir::TempDir;
|
||||
use rustc_back::{PanicStrategy, RelroLevel};
|
||||
use rustc_incremental::IncrementalHashesMap;*/
|
||||
|
||||
/*use std::ascii;
|
||||
use std::char;
|
||||
use std::env;
|
||||
use std::ffi::OsString;
|
||||
use std::fs;
|
||||
use std::io::{self, Read, Write};
|
||||
use std::mem;
|
||||
*/use std::path::PathBuf;/*{Path, PathBuf};
|
||||
use std::process::Command;
|
||||
use std::str;*/
|
||||
use rustc::session::config::{self, OutputFilenames, Input, OutputType};
|
||||
use rustc::session::Session;
|
||||
use rustc::middle::cstore;
|
||||
use std::path::PathBuf;
|
||||
use syntax::ast;
|
||||
//use syntax::attr;
|
||||
use syntax_pos::Span;
|
||||
|
||||
pub fn find_crate_name(sess: Option<&Session>,
|
||||
|
Loading…
x
Reference in New Issue
Block a user