mirror of
https://github.com/rust-lang/rust.git
synced 2025-01-10 06:47:34 +00:00
rustc: Extract session::basic_options from rustdoc
This commit is contained in:
parent
d21d1ecad5
commit
d41af13334
@ -6,6 +6,7 @@ import syntax::ast::{int_ty, uint_ty, float_ty};
|
||||
import syntax::parse::parse_sess;
|
||||
import util::filesearch;
|
||||
import back::target_strs;
|
||||
import back::link;
|
||||
import middle::lint;
|
||||
|
||||
enum os { os_win32, os_macos, os_linux, os_freebsd, }
|
||||
@ -113,6 +114,34 @@ impl session for session {
|
||||
}
|
||||
}
|
||||
|
||||
#[doc = "Some reasonable defaults"]
|
||||
fn basic_options() -> @options {
|
||||
@{
|
||||
crate_type: session::lib_crate,
|
||||
static: false,
|
||||
optimize: 0u,
|
||||
debuginfo: false,
|
||||
extra_debuginfo: false,
|
||||
verify: false,
|
||||
lint_opts: [],
|
||||
save_temps: false,
|
||||
stats: false,
|
||||
time_passes: false,
|
||||
count_llvm_insns: false,
|
||||
time_llvm_passes: false,
|
||||
output_type: link::output_type_exe,
|
||||
addl_lib_search_paths: [],
|
||||
maybe_sysroot: none,
|
||||
target_triple: driver::host_triple(),
|
||||
cfg: [],
|
||||
test: false,
|
||||
parse_only: false,
|
||||
no_trans: false,
|
||||
no_asm_comments: false,
|
||||
debug_rustc: false,
|
||||
}
|
||||
}
|
||||
|
||||
// Seems out of place, but it uses session, so I'm putting it here
|
||||
fn expect<T: copy>(sess: session, opt: option<T>, msg: fn() -> str) -> T {
|
||||
alt opt {
|
||||
|
@ -123,34 +123,8 @@ fn build_ctxt(sess: session::session, ast: @ast::crate,
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: this whole structure should not be duplicated here. makes it
|
||||
// painful to add or remove options.
|
||||
fn build_session() -> (session::session, @mut bool) {
|
||||
let sopts: @session::options = @{
|
||||
crate_type: session::lib_crate,
|
||||
static: false,
|
||||
optimize: 0u,
|
||||
debuginfo: false,
|
||||
extra_debuginfo: false,
|
||||
verify: false,
|
||||
lint_opts: [],
|
||||
save_temps: false,
|
||||
stats: false,
|
||||
time_passes: false,
|
||||
count_llvm_insns: false,
|
||||
time_llvm_passes: false,
|
||||
output_type: link::output_type_exe,
|
||||
addl_lib_search_paths: [],
|
||||
maybe_sysroot: none,
|
||||
target_triple: driver::host_triple(),
|
||||
cfg: [],
|
||||
test: false,
|
||||
parse_only: false,
|
||||
no_trans: false,
|
||||
no_asm_comments: false,
|
||||
debug_rustc: false,
|
||||
};
|
||||
|
||||
let sopts: @session::options = session::basic_options();
|
||||
let codemap = codemap::new_codemap();
|
||||
let error_handlers = build_error_handlers(codemap);
|
||||
let {emitter, span_handler, ignore_errors} = error_handlers;
|
||||
|
Loading…
Reference in New Issue
Block a user