#![feature(slicing_syntax, unsafe_destructor)]
#![feature(rustc_diagnostic_macros)]
#![feature(unboxed_closures)]
+#![feature(associated_types)]
extern crate arena;
extern crate flate;
use rustc::metadata;
use rustc::DIAGNOSTICS;
-use std::any::AnyRefExt;
+use std::cmp::Ordering::Equal;
use std::io;
use std::iter::repeat;
use std::os;
+use std::sync::mpsc::channel;
use std::thread;
use rustc::session::early_error;
_ => early_error("multiple input filenames provided")
};
- let sess = build_session(sopts, input_file_path, descriptions);
+ let mut sess = build_session(sopts, input_file_path, descriptions);
let cfg = config::build_configuration(&sess);
if print_crate_info(&sess, Some(&input), &odir, &ofile) {
return
pretty::parse_pretty(&sess, a.as_slice(), false)
});
let pretty = if pretty.is_none() &&
- sess.debugging_opt(config::UNSTABLE_OPTIONS) {
+ sess.unstable_options() {
matches.opt_str("xpretty").map(|a| {
// extended with unstable pretty-print variants
pretty::parse_pretty(&sess, a.as_slice(), true)
None => {/* continue */ }
}
+ if sess.unstable_options() {
+ sess.opts.show_span = matches.opt_str("show-span");
+ }
+
let r = matches.opt_strs("Z");
if r.contains(&("ls".to_string())) {
match input {
lints
}
- let (plugin, builtin) = lint_store.get_lints().partitioned(|&(_, p)| p);
+ let (plugin, builtin): (Vec<_>, _) = lint_store.get_lints()
+ .iter().cloned().partition(|&(_, p)| p);
let plugin = sort_lints(plugin);
let builtin = sort_lints(builtin);
- let (plugin_groups, builtin_groups) = lint_store.get_lint_groups().partitioned(|&(_, _, p)| p);
+ let (plugin_groups, builtin_groups): (Vec<_>, _) = lint_store.get_lint_groups()
+ .iter().cloned().partition(|&(_, _, p)| p);
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))
.max().unwrap_or(0);
- let padded = |x: &str| {
+ let padded = |&: x: &str| {
let mut s = repeat(" ").take(max_name_len - x.chars().count())
.collect::<String>();
s.push_str(x);
println!(" {} {:7.7} {}", padded("name"), "default", "meaning");
println!(" {} {:7.7} {}", padded("----"), "-------", "-------");
- let print_lints = |lints: Vec<&Lint>| {
+ let print_lints = |&: lints: Vec<&Lint>| {
for lint in lints.into_iter() {
let name = lint.name_lower().replace("_", "-");
println!(" {} {:7.7} {}",
let max_name_len = plugin_groups.iter().chain(builtin_groups.iter())
.map(|&(s, _)| s.width(true))
.max().unwrap_or(0);
- let padded = |x: &str| {
+ let padded = |&: x: &str| {
let mut s = repeat(" ").take(max_name_len - x.chars().count())
.collect::<String>();
s.push_str(x);
println!(" {} {}", padded("name"), "sub-lints");
println!(" {} {}", padded("----"), "---------");
- let print_lint_groups = |lints: Vec<(&'static str, Vec<lint::LintId>)>| {
+ let print_lint_groups = |&: lints: Vec<(&'static str, Vec<lint::LintId>)>| {
for (name, to) in lints.into_iter() {
let name = name.chars().map(|x| x.to_lowercase())
.collect::<String>().replace("_", "-");
/// returns None.
pub fn handle_options(mut args: Vec<String>) -> Option<getopts::Matches> {
// Throw away the first argument, the name of the binary
- let _binary = args.remove(0).unwrap();
+ let _binary = args.remove(0);
if args.is_empty() {
// user did not write `-v` nor `-Z unstable-options`, so do not