#![crate_type = "dylib"]
#![crate_type = "rlib"]
#![doc(html_logo_url = "http://www.rust-lang.org/logos/rust-logo-128x128-blk-v2.png",
- html_favicon_url = "http://www.rust-lang.org/favicon.ico",
+ html_favicon_url = "https://doc.rust-lang.org/favicon.ico",
html_root_url = "http://doc.rust-lang.org/nightly/")]
#![feature(box_syntax)]
-#![feature(collections)]
#![feature(libc)]
#![feature(quote)]
#![feature(rustc_diagnostic_macros)]
#![feature(rustc_private)]
-#![feature(unsafe_destructor)]
-#![feature(staged_api)]
-#![feature(exit_status)]
#![feature(set_stdio)]
-#![feature(unicode)]
+#![feature(staged_api)]
+#![feature(vec_push_all)]
extern crate arena;
extern crate flate;
use std::io::{self, Read, Write};
use std::iter::repeat;
use std::path::PathBuf;
+use std::process;
use std::str;
use std::sync::{Arc, Mutex};
use std::thread;
Some(ref code) => {
match descriptions.find_description(&code[..]) {
Some(ref description) => {
- println!("{}", description);
+ // Slice off the leading newline and print.
+ print!("{}", &description[1..]);
}
None => {
early_error(&format!("no extended information for {}", code));
if sess.opts.debugging_opts.save_analysis {
control.after_analysis.callback = box |state| {
time(state.session.time_passes(),
- "save analysis",
- state.expanded_crate.unwrap(),
- |krate| save::process_crate(state.session,
- krate,
- state.analysis.unwrap(),
- state.out_dir));
+ "save analysis", (),
+ |_| save::process_crate(state.tcx.unwrap(),
+ state.analysis.unwrap(),
+ state.out_dir));
};
control.make_glob_map = resolve::MakeGlobMap::Yes;
}
&Input::File(ref ifile) => {
let path = &(*ifile);
let mut v = Vec::new();
- metadata::loader::list_file_metadata(sess.target.target.options.is_like_osx,
+ metadata::loader::list_file_metadata(&sess.target.target,
path,
&mut v).unwrap();
println!("{}", String::from_utf8(v).unwrap());
odir: &Option<PathBuf>,
ofile: &Option<PathBuf>)
-> Compilation {
- if sess.opts.prints.len() == 0 {
+ if sess.opts.prints.is_empty() {
return Compilation::Continue;
}
option_env!("CFG_VER_DATE")
}
-pub fn build_date_str() -> Option<&'static str> {
- option_env!("CFG_BUILD_DATE")
-}
-
/// Prints version information and returns None on success or an error
/// message on panic.
pub fn version(binary: &str, matches: &getopts::Matches) {
println!("binary: {}", binary);
println!("commit-hash: {}", unw(commit_hash_str()));
println!("commit-date: {}", unw(commit_date_str()));
- println!("build-date: {}", unw(build_date_str()));
println!("host: {}", config::host_triple());
println!("release: {}", unw(release_str()));
}
let plugin_groups = sort_lint_groups(plugin_groups);
let builtin_groups = sort_lint_groups(builtin_groups);
- let max_name_len = plugin.iter().chain(builtin.iter())
- .map(|&s| s.name.width(true))
+ let max_name_len = plugin.iter().chain(&builtin)
+ .map(|&s| s.name.chars().count())
.max().unwrap_or(0);
let padded = |x: &str| {
let mut s = repeat(" ").take(max_name_len - x.chars().count())
- let max_name_len = plugin_groups.iter().chain(builtin_groups.iter())
- .map(|&(s, _)| s.width(true))
+ let max_name_len = plugin_groups.iter().chain(&builtin_groups)
+ .map(|&(s, _)| s.chars().count())
.max().unwrap_or(0);
let padded = |x: &str| {
let mut s = repeat(" ").take(max_name_len - x.chars().count())
///
/// The diagnostic emitter yielded to the procedure should be used for reporting
/// errors of the compiler.
-#[allow(deprecated)]
pub fn monitor<F:FnOnce()+Send+'static>(f: F) {
const STACK_SIZE: usize = 8 * 1024 * 1024; // 8MB
"the compiler unexpectedly panicked. this is a bug.".to_string(),
format!("we would appreciate a bug report: {}",
BUG_REPORT_URL),
- "run with `RUST_BACKTRACE=1` for a backtrace".to_string(),
];
for note in &xs {
emitter.emit(None, ¬e[..], None, diagnostic::Note)
}
+ if let None = env::var_os("RUST_BACKTRACE") {
+ emitter.emit(None, "run with `RUST_BACKTRACE=1` for a backtrace",
+ None, diagnostic::Note);
+ }
println!("{}", str::from_utf8(&data.lock().unwrap()).unwrap());
}
pub fn diagnostics_registry() -> diagnostics::registry::Registry {
use syntax::diagnostics::registry::Registry;
- let all_errors = Vec::new() +
- &rustc::diagnostics::DIAGNOSTICS[..] +
- &rustc_typeck::diagnostics::DIAGNOSTICS[..] +
- &rustc_resolve::diagnostics::DIAGNOSTICS[..];
+ let mut all_errors = Vec::new();
+ all_errors.push_all(&rustc::DIAGNOSTICS);
+ all_errors.push_all(&rustc_typeck::DIAGNOSTICS);
+ all_errors.push_all(&rustc_borrowck::DIAGNOSTICS);
+ all_errors.push_all(&rustc_resolve::DIAGNOSTICS);
Registry::new(&*all_errors)
}
pub fn main() {
let result = run(env::args().collect());
- std::env::set_exit_status(result as i32);
+ process::exit(result as i32);
}