diff --git a/src/compiletest/common.rs b/src/compiletest/common.rs index ef8b48a053564..ca59f344e288f 100644 --- a/src/compiletest/common.rs +++ b/src/compiletest/common.rs @@ -8,19 +8,52 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +use std::from_str::FromStr; +use std::fmt; + #[deriving(Clone, Eq)] -pub enum mode { - mode_compile_fail, - mode_run_fail, - mode_run_pass, - mode_pretty, - mode_debug_info_gdb, - mode_debug_info_lldb, - mode_codegen +pub enum Mode { + CompileFail, + RunFail, + RunPass, + Pretty, + DebugInfoGdb, + DebugInfoLldb, + Codegen +} + +impl FromStr for Mode { + fn from_str(s: &str) -> Option { + match s { + "compile-fail" => Some(CompileFail), + "run-fail" => Some(RunFail), + "run-pass" => Some(RunPass), + "pretty" => Some(Pretty), + "debuginfo-lldb" => Some(DebugInfoLldb), + "debuginfo-gdb" => Some(DebugInfoGdb), + "codegen" => Some(Codegen), + _ => None, + } + } +} + +impl fmt::Show for Mode { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let msg = match *self { + CompileFail => "compile-fail", + RunFail => "run-fail", + RunPass => "run-pass", + Pretty => "pretty", + DebugInfoGdb => "debuginfo-gdb", + DebugInfoLldb => "debuginfo-lldb", + Codegen => "codegen", + }; + write!(f.buf, "{}", msg) + } } #[deriving(Clone)] -pub struct config { +pub struct Config { // The library paths required for running the compiler pub compile_lib_path: ~str, @@ -49,7 +82,7 @@ pub struct config { pub stage_id: ~str, // The test mode, compile-fail, run-fail, run-pass - pub mode: mode, + pub mode: Mode, // Run ignored tests pub run_ignored: bool, diff --git a/src/compiletest/compiletest.rs b/src/compiletest/compiletest.rs index f484ea5a8f1fd..ee0fe2065303b 100644 --- a/src/compiletest/compiletest.rs +++ b/src/compiletest/compiletest.rs @@ -14,7 +14,6 @@ // we use our own (green) start below; do not link in libnative; issue #13247. #![no_start] -#![allow(non_camel_case_types)] #![deny(warnings)] extern crate test; @@ -27,9 +26,10 @@ extern crate rustuv; use std::os; use std::io; use std::io::fs; +use std::from_str::FromStr; use getopts::{optopt, optflag, reqopt}; -use common::{config, mode_run_pass, mode_run_fail, mode_compile_fail, mode_pretty, - mode_debug_info_gdb, mode_debug_info_lldb, mode_codegen, mode}; +use common::Config; +use common::{Pretty, DebugInfoGdb, Codegen}; use util::logv; pub mod procsrv; @@ -51,7 +51,7 @@ pub fn main() { run_tests(&config); } -pub fn parse_config(args: Vec<~str> ) -> config { +pub fn parse_config(args: Vec<~str> ) -> Config { let groups : Vec = vec!(reqopt("", "compile-lib-path", "path to host shared libraries", "PATH"), @@ -112,7 +112,7 @@ pub fn parse_config(args: Vec<~str> ) -> config { Path::new(m.opt_str(nm).unwrap()) } - config { + Config { compile_lib_path: matches.opt_str("compile-lib-path").unwrap(), run_lib_path: matches.opt_str("run-lib-path").unwrap(), rustc_path: opt_path(matches, "rustc-path"), @@ -122,7 +122,7 @@ pub fn parse_config(args: Vec<~str> ) -> config { build_base: opt_path(matches, "build-base"), aux_base: opt_path(matches, "aux-base"), stage_id: matches.opt_str("stage-id").unwrap(), - mode: str_mode(matches.opt_str("mode").unwrap()), + mode: FromStr::from_str(matches.opt_str("mode").unwrap()).expect("invalid mode"), run_ignored: matches.opt_present("ignored"), filter: if !matches.free.is_empty() { @@ -155,7 +155,7 @@ pub fn parse_config(args: Vec<~str> ) -> config { } } -pub fn log_config(config: &config) { +pub fn log_config(config: &Config) { let c = config; logv(c, format!("configuration:")); logv(c, format!("compile_lib_path: {}", config.compile_lib_path)); @@ -164,7 +164,7 @@ pub fn log_config(config: &config) { logv(c, format!("src_base: {}", config.src_base.display())); logv(c, format!("build_base: {}", config.build_base.display())); logv(c, format!("stage_id: {}", config.stage_id)); - logv(c, format!("mode: {}", mode_str(config.mode))); + logv(c, format!("mode: {}", config.mode)); logv(c, format!("run_ignored: {}", config.run_ignored)); logv(c, format!("filter: {}", opt_str(&config.filter))); logv(c, format!("runtool: {}", opt_str(&config.runtool))); @@ -198,35 +198,10 @@ pub fn opt_str2(maybestr: Option<~str>) -> ~str { match maybestr { None => "(none)".to_owned(), Some(s) => { s } } } -pub fn str_mode(s: ~str) -> mode { - match s.as_slice() { - "compile-fail" => mode_compile_fail, - "run-fail" => mode_run_fail, - "run-pass" => mode_run_pass, - "pretty" => mode_pretty, - "debuginfo-gdb" => mode_debug_info_gdb, - "debuginfo-lldb" => mode_debug_info_lldb, - "codegen" => mode_codegen, - s => fail!("invalid mode: " + s) - } -} - -pub fn mode_str(mode: mode) -> ~str { - match mode { - mode_compile_fail => "compile-fail".to_owned(), - mode_run_fail => "run-fail".to_owned(), - mode_run_pass => "run-pass".to_owned(), - mode_pretty => "pretty".to_owned(), - mode_debug_info_gdb => "debuginfo-gdb".to_owned(), - mode_debug_info_lldb => "debuginfo-lldb".to_owned(), - mode_codegen => "codegen".to_owned(), - } -} - -pub fn run_tests(config: &config) { +pub fn run_tests(config: &Config) { if config.target == "arm-linux-androideabi".to_owned() { - match config.mode{ - mode_debug_info_gdb => { + match config.mode { + DebugInfoGdb => { println!("arm-linux-androideabi debug-info \ test uses tcp 5039 port. please reserve it"); } @@ -255,7 +230,7 @@ pub fn run_tests(config: &config) { } } -pub fn test_opts(config: &config) -> test::TestOpts { +pub fn test_opts(config: &Config) -> test::TestOpts { test::TestOpts { filter: config.filter.clone(), run_ignored: config.run_ignored, @@ -270,7 +245,7 @@ pub fn test_opts(config: &config) -> test::TestOpts { } } -pub fn make_tests(config: &config) -> Vec { +pub fn make_tests(config: &Config) -> Vec { debug!("making tests from {}", config.src_base.display()); let mut tests = Vec::new(); @@ -281,7 +256,7 @@ pub fn make_tests(config: &config) -> Vec { if is_test(config, &file) { let t = make_test(config, &file, || { match config.mode { - mode_codegen => make_metrics_test_closure(config, &file), + Codegen => make_metrics_test_closure(config, &file), _ => make_test_closure(config, &file) } }); @@ -291,11 +266,11 @@ pub fn make_tests(config: &config) -> Vec { tests } -pub fn is_test(config: &config, testfile: &Path) -> bool { +pub fn is_test(config: &Config, testfile: &Path) -> bool { // Pretty-printer does not work with .rc files yet let valid_extensions = match config.mode { - mode_pretty => vec!(".rs".to_owned()), + Pretty => vec!(".rs".to_owned()), _ => vec!(".rc".to_owned(), ".rs".to_owned()) }; let invalid_prefixes = vec!(".".to_owned(), "#".to_owned(), "~".to_owned()); @@ -314,7 +289,7 @@ pub fn is_test(config: &config, testfile: &Path) -> bool { return valid; } -pub fn make_test(config: &config, testfile: &Path, f: || -> test::TestFn) +pub fn make_test(config: &Config, testfile: &Path, f: || -> test::TestFn) -> test::TestDescAndFn { test::TestDescAndFn { desc: test::TestDesc { @@ -326,7 +301,7 @@ pub fn make_test(config: &config, testfile: &Path, f: || -> test::TestFn) } } -pub fn make_test_name(config: &config, testfile: &Path) -> test::TestName { +pub fn make_test_name(config: &Config, testfile: &Path) -> test::TestName { // Try to elide redundant long paths fn shorten(path: &Path) -> ~str { @@ -336,19 +311,17 @@ pub fn make_test_name(config: &config, testfile: &Path) -> test::TestName { format!("{}/{}", dir.unwrap_or(""), filename.unwrap_or("")) } - test::DynTestName(format!("[{}] {}", - mode_str(config.mode), - shorten(testfile))) + test::DynTestName(format!("[{}] {}", config.mode, shorten(testfile))) } -pub fn make_test_closure(config: &config, testfile: &Path) -> test::TestFn { +pub fn make_test_closure(config: &Config, testfile: &Path) -> test::TestFn { let config = (*config).clone(); // FIXME (#9639): This needs to handle non-utf8 paths let testfile = testfile.as_str().unwrap().to_owned(); test::DynTestFn(proc() { runtest::run(config, testfile) }) } -pub fn make_metrics_test_closure(config: &config, testfile: &Path) -> test::TestFn { +pub fn make_metrics_test_closure(config: &Config, testfile: &Path) -> test::TestFn { let config = (*config).clone(); // FIXME (#9639): This needs to handle non-utf8 paths let testfile = testfile.as_str().unwrap().to_owned(); diff --git a/src/compiletest/header.rs b/src/compiletest/header.rs index 3d954a33a0029..047be95547746 100644 --- a/src/compiletest/header.rs +++ b/src/compiletest/header.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use common::config; +use common::Config; use common; use util; @@ -34,6 +34,8 @@ pub struct TestProps { pub check_stdout: bool, // Don't force a --crate-type=dylib flag on the command line pub no_prefer_dynamic: bool, + // Don't run --pretty expanded when running pretty printing tests + pub no_pretty_expanded: bool, } // Load any test directives embedded in the file @@ -48,6 +50,7 @@ pub fn load_props(testfile: &Path) -> TestProps { let mut force_host = false; let mut check_stdout = false; let mut no_prefer_dynamic = false; + let mut no_pretty_expanded = false; iter_header(testfile, |ln| { match parse_error_pattern(ln) { Some(ep) => error_patterns.push(ep), @@ -78,6 +81,10 @@ pub fn load_props(testfile: &Path) -> TestProps { no_prefer_dynamic = parse_no_prefer_dynamic(ln); } + if !no_pretty_expanded { + no_pretty_expanded = parse_no_pretty_expanded(ln); + } + match parse_aux_build(ln) { Some(ab) => { aux_builds.push(ab); } None => {} @@ -107,14 +114,15 @@ pub fn load_props(testfile: &Path) -> TestProps { force_host: force_host, check_stdout: check_stdout, no_prefer_dynamic: no_prefer_dynamic, + no_pretty_expanded: no_pretty_expanded, } } -pub fn is_test_ignored(config: &config, testfile: &Path) -> bool { - fn ignore_target(config: &config) -> ~str { +pub fn is_test_ignored(config: &Config, testfile: &Path) -> bool { + fn ignore_target(config: &Config) -> ~str { "ignore-".to_owned() + util::get_os(config.target) } - fn ignore_stage(config: &config) -> ~str { + fn ignore_stage(config: &Config) -> ~str { "ignore-".to_owned() + config.stage_id.split('-').next().unwrap() } @@ -122,7 +130,7 @@ pub fn is_test_ignored(config: &config, testfile: &Path) -> bool { if parse_name_directive(ln, "ignore-test") { false } else if parse_name_directive(ln, ignore_target(config)) { false } else if parse_name_directive(ln, ignore_stage(config)) { false } - else if config.mode == common::mode_pretty && + else if config.mode == common::Pretty && parse_name_directive(ln, "ignore-pretty") { false } else if config.target != config.host && parse_name_directive(ln, "ignore-cross-compile") { false } @@ -180,6 +188,10 @@ fn parse_no_prefer_dynamic(line: &str) -> bool { parse_name_directive(line, "no-prefer-dynamic") } +fn parse_no_pretty_expanded(line: &str) -> bool { + parse_name_directive(line, "no-pretty-expanded") +} + fn parse_exec_env(line: &str) -> Option<(~str, ~str)> { parse_name_value_directive(line, "exec-env".to_owned()).map(|nv| { // nv is either FOO or FOO=BAR diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs index e47e7dc33d8e4..29f7a771e86fb 100644 --- a/src/compiletest/runtest.rs +++ b/src/compiletest/runtest.rs @@ -8,7 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use common::{config, mode_compile_fail, mode_pretty, mode_run_fail, mode_run_pass}; +use common::Config; +use common::{CompileFail, Pretty, RunFail, RunPass, DebugInfoGdb, DebugInfoLldb}; use errors; use header::TestProps; use header; @@ -30,7 +31,7 @@ use std::strbuf::StrBuf; use std::task; use test::MetricMap; -pub fn run(config: config, testfile: ~str) { +pub fn run(config: Config, testfile: ~str) { match config.target.as_slice() { @@ -47,7 +48,7 @@ pub fn run(config: config, testfile: ~str) { run_metrics(config, testfile, &mut _mm); } -pub fn run_metrics(config: config, testfile: ~str, mm: &mut MetricMap) { +pub fn run_metrics(config: Config, testfile: ~str, mm: &mut MetricMap) { if config.verbose { // We're going to be dumping a lot of info. Start on a new line. print!("\n\n"); @@ -57,17 +58,17 @@ pub fn run_metrics(config: config, testfile: ~str, mm: &mut MetricMap) { let props = header::load_props(&testfile); debug!("loaded props"); match config.mode { - mode_compile_fail => run_cfail_test(&config, &props, &testfile), - mode_run_fail => run_rfail_test(&config, &props, &testfile), - mode_run_pass => run_rpass_test(&config, &props, &testfile), - mode_pretty => run_pretty_test(&config, &props, &testfile), - mode_debug_info_gdb => run_debuginfo_gdb_test(&config, &props, &testfile), - mode_debug_info_lldb => run_debuginfo_lldb_test(&config, &props, &testfile), - mode_codegen => run_codegen_test(&config, &props, &testfile, mm) + CompileFail => run_cfail_test(&config, &props, &testfile), + RunFail => run_rfail_test(&config, &props, &testfile), + RunPass => run_rpass_test(&config, &props, &testfile), + Pretty => run_pretty_test(&config, &props, &testfile), + DebugInfoGdb => run_debuginfo_gdb_test(&config, &props, &testfile), + DebugInfoLldb => run_debuginfo_lldb_test(&config, &props, &testfile), + Codegen => run_codegen_test(&config, &props, &testfile, mm), } } -fn run_cfail_test(config: &config, props: &TestProps, testfile: &Path) { +fn run_cfail_test(config: &Config, props: &TestProps, testfile: &Path) { let proc_res = compile_test(config, props, testfile); if proc_res.status.success() { @@ -88,7 +89,7 @@ fn run_cfail_test(config: &config, props: &TestProps, testfile: &Path) { check_no_compiler_crash(&proc_res); } -fn run_rfail_test(config: &config, props: &TestProps, testfile: &Path) { +fn run_rfail_test(config: &Config, props: &TestProps, testfile: &Path) { let proc_res = if !config.jit { let proc_res = compile_test(config, props, testfile); @@ -121,7 +122,7 @@ fn check_correct_failure_status(proc_res: &ProcRes) { } } -fn run_rpass_test(config: &config, props: &TestProps, testfile: &Path) { +fn run_rpass_test(config: &Config, props: &TestProps, testfile: &Path) { if !config.jit { let mut proc_res = compile_test(config, props, testfile); @@ -141,7 +142,7 @@ fn run_rpass_test(config: &config, props: &TestProps, testfile: &Path) { } } -fn run_pretty_test(config: &config, props: &TestProps, testfile: &Path) { +fn run_pretty_test(config: &Config, props: &TestProps, testfile: &Path) { if props.pp_exact.is_some() { logv(config, "testing for exact pretty-printing".to_owned()); } else { logv(config, "testing for converging pretty-printing".to_owned()); } @@ -156,9 +157,7 @@ fn run_pretty_test(config: &config, props: &TestProps, testfile: &Path) { let mut round = 0; while round < rounds { logv(config, format!("pretty-printing round {}", round)); - let proc_res = print_source(config, - testfile, - (*srcs.get(round)).clone()); + let proc_res = print_source(config, props, testfile, (*srcs.get(round)).clone(), "normal"); if !proc_res.status.success() { fatal_ProcRes(format!("pretty-printing failed in round {}", round), @@ -195,18 +194,43 @@ fn run_pretty_test(config: &config, props: &TestProps, testfile: &Path) { if !proc_res.status.success() { fatal_ProcRes("pretty-printed source does not typecheck".to_owned(), &proc_res); } + if props.no_pretty_expanded { return } + + // additionally, run `--pretty expanded` and try to build it. + let proc_res = print_source(config, props, testfile, (*srcs.get(round)).clone(), "expanded"); + if !proc_res.status.success() { + fatal_ProcRes(format!("pretty-printing (expanded) failed"), &proc_res); + } + + let ProcRes{ stdout: expanded_src, .. } = proc_res; + let proc_res = typecheck_source(config, props, testfile, expanded_src); + if !proc_res.status.success() { + fatal_ProcRes(format!("pretty-printed source (expanded) does not typecheck"), &proc_res); + } return; - fn print_source(config: &config, testfile: &Path, src: ~str) -> ProcRes { - compose_and_run(config, testfile, make_pp_args(config, testfile), - Vec::new(), config.compile_lib_path, Some(src)) + fn print_source(config: &Config, + props: &TestProps, + testfile: &Path, + src: ~str, + pretty_type: &str) -> ProcRes { + compose_and_run(config, testfile, + make_pp_args(config, props, testfile, pretty_type.to_owned()), + props.exec_env.clone(), config.compile_lib_path, Some(src)) } - fn make_pp_args(config: &config, _testfile: &Path) -> ProcArgs { - let args = vec!("-".to_owned(), "--pretty".to_owned(), "normal".to_owned(), - "--target=".to_owned() + config.target); + fn make_pp_args(config: &Config, + props: &TestProps, + testfile: &Path, + pretty_type: ~str) -> ProcArgs { + let aux_dir = aux_output_dir_name(config, testfile); // FIXME (#9639): This needs to handle non-utf8 paths + let mut args = vec!("-".to_owned(), "--pretty".to_owned(), pretty_type, + "--target=".to_owned() + config.target, + "-L".to_owned(), aux_dir.as_str().unwrap().to_owned()); + args.push_all_move(split_maybe_args(&config.target_rustcflags)); + args.push_all_move(split_maybe_args(&props.compile_flags)); return ProcArgs {prog: config.rustc_path.as_str().unwrap().to_owned(), args: args}; } @@ -228,13 +252,13 @@ actual:\n\ } } - fn typecheck_source(config: &config, props: &TestProps, + fn typecheck_source(config: &Config, props: &TestProps, testfile: &Path, src: ~str) -> ProcRes { let args = make_typecheck_args(config, props, testfile); compose_and_run_compiler(config, props, testfile, args, Some(src)) } - fn make_typecheck_args(config: &config, props: &TestProps, testfile: &Path) -> ProcArgs { + fn make_typecheck_args(config: &Config, props: &TestProps, testfile: &Path) -> ProcArgs { let aux_dir = aux_output_dir_name(config, testfile); let target = if props.force_host { config.host.as_slice() @@ -255,8 +279,8 @@ actual:\n\ } } -fn run_debuginfo_gdb_test(config: &config, props: &TestProps, testfile: &Path) { - let mut config = config { +fn run_debuginfo_gdb_test(config: &Config, props: &TestProps, testfile: &Path) { + let mut config = Config { target_rustcflags: cleanup_debug_info_options(&config.target_rustcflags), host_rustcflags: cleanup_debug_info_options(&config.host_rustcflags), .. config.clone() @@ -403,14 +427,14 @@ fn run_debuginfo_gdb_test(config: &config, props: &TestProps, testfile: &Path) { check_debugger_output(&debugger_run_result, check_lines.as_slice()); } -fn run_debuginfo_lldb_test(config: &config, props: &TestProps, testfile: &Path) { +fn run_debuginfo_lldb_test(config: &Config, props: &TestProps, testfile: &Path) { use std::io::process::{Process, ProcessConfig, ProcessOutput}; if config.lldb_python_dir.is_none() { fatal("Can't run LLDB test because LLDB's python path is not set.".to_owned()); } - let mut config = config { + let mut config = Config { target_rustcflags: cleanup_debug_info_options(&config.target_rustcflags), host_rustcflags: cleanup_debug_info_options(&config.host_rustcflags), .. config.clone() @@ -465,7 +489,7 @@ fn run_debuginfo_lldb_test(config: &config, props: &TestProps, testfile: &Path) check_debugger_output(&debugger_run_result, check_lines.as_slice()); - fn run_lldb(config: &config, test_executable: &Path, debugger_script: &Path) -> ProcRes { + fn run_lldb(config: &Config, test_executable: &Path, debugger_script: &Path) -> ProcRes { // Prepare the lldb_batchmode which executes the debugger script let lldb_batchmode_script = "./src/etc/lldb_batchmode.py".to_owned(); let test_executable_str = test_executable.as_str().unwrap().to_owned(); @@ -834,16 +858,16 @@ struct ProcArgs {prog: ~str, args: Vec<~str> } struct ProcRes {status: ProcessExit, stdout: ~str, stderr: ~str, cmdline: ~str} -fn compile_test(config: &config, props: &TestProps, +fn compile_test(config: &Config, props: &TestProps, testfile: &Path) -> ProcRes { compile_test_(config, props, testfile, []) } -fn jit_test(config: &config, props: &TestProps, testfile: &Path) -> ProcRes { +fn jit_test(config: &Config, props: &TestProps, testfile: &Path) -> ProcRes { compile_test_(config, props, testfile, ["--jit".to_owned()]) } -fn compile_test_(config: &config, props: &TestProps, +fn compile_test_(config: &Config, props: &TestProps, testfile: &Path, extra_args: &[~str]) -> ProcRes { let aux_dir = aux_output_dir_name(config, testfile); // FIXME (#9639): This needs to handle non-utf8 paths @@ -855,7 +879,7 @@ fn compile_test_(config: &config, props: &TestProps, compose_and_run_compiler(config, props, testfile, args, None) } -fn exec_compiled_test(config: &config, props: &TestProps, +fn exec_compiled_test(config: &Config, props: &TestProps, testfile: &Path) -> ProcRes { let env = props.exec_env.clone(); @@ -876,7 +900,7 @@ fn exec_compiled_test(config: &config, props: &TestProps, } fn compose_and_run_compiler( - config: &config, + config: &Config, props: &TestProps, testfile: &Path, args: ProcArgs, @@ -934,7 +958,7 @@ fn ensure_dir(path: &Path) { fs::mkdir(path, io::UserRWX).unwrap(); } -fn compose_and_run(config: &config, testfile: &Path, +fn compose_and_run(config: &Config, testfile: &Path, ProcArgs{ args, prog }: ProcArgs, procenv: Vec<(~str, ~str)> , lib_path: &str, @@ -948,10 +972,10 @@ enum TargetLocation { ThisDirectory(Path), } -fn make_compile_args(config: &config, +fn make_compile_args(config: &Config, props: &TestProps, extras: Vec<~str> , - xform: |&config, &Path| -> TargetLocation, + xform: |&Config, &Path| -> TargetLocation, testfile: &Path) -> ProcArgs { let xform_file = xform(config, testfile); @@ -983,14 +1007,14 @@ fn make_compile_args(config: &config, return ProcArgs {prog: config.rustc_path.as_str().unwrap().to_owned(), args: args}; } -fn make_lib_name(config: &config, auxfile: &Path, testfile: &Path) -> Path { +fn make_lib_name(config: &Config, auxfile: &Path, testfile: &Path) -> Path { // what we return here is not particularly important, as it // happens; rustc ignores everything except for the directory. let auxname = output_testname(auxfile); aux_output_dir_name(config, testfile).join(&auxname) } -fn make_exe_name(config: &config, testfile: &Path) -> Path { +fn make_exe_name(config: &Config, testfile: &Path) -> Path { let mut f = output_base_name(config, testfile); if !os::consts::EXE_SUFFIX.is_empty() { match f.filename().map(|s| Vec::from_slice(s).append(os::consts::EXE_SUFFIX.as_bytes())) { @@ -1001,7 +1025,7 @@ fn make_exe_name(config: &config, testfile: &Path) -> Path { f } -fn make_run_args(config: &config, props: &TestProps, testfile: &Path) -> +fn make_run_args(config: &Config, props: &TestProps, testfile: &Path) -> ProcArgs { // If we've got another tool to run under (valgrind), // then split apart its command @@ -1029,7 +1053,7 @@ fn split_maybe_args(argstr: &Option<~str>) -> Vec<~str> { } } -fn program_output(config: &config, testfile: &Path, lib_path: &str, prog: ~str, +fn program_output(config: &Config, testfile: &Path, lib_path: &str, prog: ~str, args: Vec<~str> , env: Vec<(~str, ~str)> , input: Option<~str>) -> ProcRes { let cmdline = @@ -1069,23 +1093,23 @@ fn lib_path_cmd_prefix(path: &str) -> ~str { format!("{}=\"{}\"", util::lib_path_env_var(), util::make_new_path(path)) } -fn dump_output(config: &config, testfile: &Path, out: &str, err: &str) { +fn dump_output(config: &Config, testfile: &Path, out: &str, err: &str) { dump_output_file(config, testfile, out, "out"); dump_output_file(config, testfile, err, "err"); maybe_dump_to_stdout(config, out, err); } -fn dump_output_file(config: &config, testfile: &Path, +fn dump_output_file(config: &Config, testfile: &Path, out: &str, extension: &str) { let outfile = make_out_name(config, testfile, extension); File::create(&outfile).write(out.as_bytes()).unwrap(); } -fn make_out_name(config: &config, testfile: &Path, extension: &str) -> Path { +fn make_out_name(config: &Config, testfile: &Path, extension: &str) -> Path { output_base_name(config, testfile).with_extension(extension) } -fn aux_output_dir_name(config: &config, testfile: &Path) -> Path { +fn aux_output_dir_name(config: &Config, testfile: &Path) -> Path { let mut f = output_base_name(config, testfile); match f.filename().map(|s| Vec::from_slice(s).append(bytes!(".libaux"))) { Some(v) => f.set_filename(v), @@ -1098,13 +1122,13 @@ fn output_testname(testfile: &Path) -> Path { Path::new(testfile.filestem().unwrap()) } -fn output_base_name(config: &config, testfile: &Path) -> Path { +fn output_base_name(config: &Config, testfile: &Path) -> Path { config.build_base .join(&output_testname(testfile)) .with_extension(config.stage_id.as_slice()) } -fn maybe_dump_to_stdout(config: &config, out: &str, err: &str) { +fn maybe_dump_to_stdout(config: &Config, out: &str, err: &str) { if config.verbose { println!("------{}------------------------------", "stdout"); println!("{}", out); @@ -1137,7 +1161,7 @@ stderr:\n\ fail!(); } -fn _arm_exec_compiled_test(config: &config, props: &TestProps, +fn _arm_exec_compiled_test(config: &Config, props: &TestProps, testfile: &Path, env: Vec<(~str, ~str)> ) -> ProcRes { let args = make_run_args(config, props, testfile); @@ -1237,7 +1261,7 @@ fn _arm_exec_compiled_test(config: &config, props: &TestProps, } } -fn _arm_push_aux_shared_library(config: &config, testfile: &Path) { +fn _arm_push_aux_shared_library(config: &Config, testfile: &Path) { let tdir = aux_output_dir_name(config, testfile); let dirs = fs::readdir(&tdir).unwrap(); @@ -1260,7 +1284,7 @@ fn _arm_push_aux_shared_library(config: &config, testfile: &Path) { // codegen tests (vs. clang) -fn make_o_name(config: &config, testfile: &Path) -> Path { +fn make_o_name(config: &Config, testfile: &Path) -> Path { output_base_name(config, testfile).with_extension("o") } @@ -1273,7 +1297,7 @@ fn append_suffix_to_stem(p: &Path, suffix: &str) -> Path { } } -fn compile_test_and_save_bitcode(config: &config, props: &TestProps, +fn compile_test_and_save_bitcode(config: &Config, props: &TestProps, testfile: &Path) -> ProcRes { let aux_dir = aux_output_dir_name(config, testfile); // FIXME (#9639): This needs to handle non-utf8 paths @@ -1287,7 +1311,7 @@ fn compile_test_and_save_bitcode(config: &config, props: &TestProps, compose_and_run_compiler(config, props, testfile, args, None) } -fn compile_cc_with_clang_and_save_bitcode(config: &config, _props: &TestProps, +fn compile_cc_with_clang_and_save_bitcode(config: &Config, _props: &TestProps, testfile: &Path) -> ProcRes { let bitcodefile = output_base_name(config, testfile).with_extension("bc"); let bitcodefile = append_suffix_to_stem(&bitcodefile, "clang"); @@ -1303,7 +1327,7 @@ fn compile_cc_with_clang_and_save_bitcode(config: &config, _props: &TestProps, compose_and_run(config, testfile, proc_args, Vec::new(), "", None) } -fn extract_function_from_bitcode(config: &config, _props: &TestProps, +fn extract_function_from_bitcode(config: &Config, _props: &TestProps, fname: &str, testfile: &Path, suffix: &str) -> ProcRes { let bitcodefile = output_base_name(config, testfile).with_extension("bc"); @@ -1320,7 +1344,7 @@ fn extract_function_from_bitcode(config: &config, _props: &TestProps, compose_and_run(config, testfile, proc_args, Vec::new(), "", None) } -fn disassemble_extract(config: &config, _props: &TestProps, +fn disassemble_extract(config: &Config, _props: &TestProps, testfile: &Path, suffix: &str) -> ProcRes { let bitcodefile = output_base_name(config, testfile).with_extension("bc"); let bitcodefile = append_suffix_to_stem(&bitcodefile, suffix); @@ -1344,7 +1368,7 @@ fn count_extracted_lines(p: &Path) -> uint { } -fn run_codegen_test(config: &config, props: &TestProps, +fn run_codegen_test(config: &Config, props: &TestProps, testfile: &Path, mm: &mut MetricMap) { if config.llvm_bin_path.is_none() { diff --git a/src/compiletest/util.rs b/src/compiletest/util.rs index e0afd57adf04b..253b7e87d0223 100644 --- a/src/compiletest/util.rs +++ b/src/compiletest/util.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -use common::config; +use common::Config; #[cfg(target_os = "win32")] use std::os::getenv; @@ -51,7 +51,7 @@ pub fn lib_path_env_var() -> ~str { "PATH".to_owned() } #[cfg(target_os = "win32")] pub fn path_div() -> ~str { ";".to_owned() } -pub fn logv(config: &config, s: ~str) { +pub fn logv(config: &Config, s: ~str) { debug!("{}", s); if config.verbose { println!("{}", s); } } diff --git a/src/librustc/front/std_inject.rs b/src/librustc/front/std_inject.rs index 66bf6a77f8cfc..f6e6875f0e71f 100644 --- a/src/librustc/front/std_inject.rs +++ b/src/librustc/front/std_inject.rs @@ -100,6 +100,7 @@ impl<'a> fold::Folder for StandardLibraryInjector<'a> { }); } + // `extern crate` must be precede `use` items vis.push_all_move(krate.module.view_items.clone()); let new_module = ast::Mod { view_items: vis, @@ -130,8 +131,20 @@ impl<'a> fold::Folder for PreludeInjector<'a> { if !no_prelude(krate.attrs.as_slice()) { // only add `use std::prelude::*;` if there wasn't a // `#![no_implicit_prelude]` at the crate level. + + let mut attrs = krate.attrs.clone(); + + // fold_mod() will insert glob path. + let globs_attr = attr::mk_attr(attr::mk_list_item( + InternedString::new("feature"), + vec!( + attr::mk_word_item(InternedString::new("globs")), + ))); + attrs.push(globs_attr); + ast::Crate { module: self.fold_mod(&krate.module), + attrs: attrs, ..krate } } else { @@ -175,11 +188,20 @@ impl<'a> fold::Folder for PreludeInjector<'a> { span: DUMMY_SP, }; - let vis = (vec!(vi2)).append(module.view_items.as_slice()); + let (crates, uses) = module.view_items.partitioned(|x| { + match x.node { + ast::ViewItemExternCrate(..) => true, + _ => false, + } + }); + + // add vi2 after any `extern crate` but before any `use` + let mut view_items = crates; + view_items.push(vi2); + view_items.push_all_move(uses); - // FIXME #2543: Bad copy. let new_module = ast::Mod { - view_items: vis, + view_items: view_items, ..(*module).clone() }; fold::noop_fold_mod(&new_module, self) diff --git a/src/librustc/middle/lint.rs b/src/librustc/middle/lint.rs index cc0697ce52769..1bf4d0a02faf0 100644 --- a/src/librustc/middle/lint.rs +++ b/src/librustc/middle/lint.rs @@ -46,6 +46,7 @@ use middle::typeck::astconv::{ast_ty_to_ty, AstConv}; use middle::typeck::infer; use middle::typeck; use util::ppaux::{ty_to_str}; +use util::nodemap::NodeSet; use std::cmp; use collections::HashMap; @@ -453,10 +454,13 @@ struct Context<'a> { // When recursing into an attributed node of the ast which modifies lint // levels, this stack keeps track of the previous lint levels of whatever // was modified. - lint_stack: Vec<(Lint, level, LintSource)> , + lint_stack: Vec<(Lint, level, LintSource)>, // id of the last visited negated expression - negated_expr_id: ast::NodeId + negated_expr_id: ast::NodeId, + + // ids of structs/enums which have been checked for raw_pointer_deriving + checked_raw_pointers: NodeSet, } impl<'a> Context<'a> { @@ -1014,10 +1018,26 @@ impl<'a> Visitor<()> for RawPtrDerivingVisitor<'a> { fn visit_block(&mut self, _: &ast::Block, _: ()) {} } -fn check_raw_ptr_deriving(cx: &Context, item: &ast::Item) { - if !attr::contains_name(item.attrs.as_slice(), "deriving") { +fn check_raw_ptr_deriving(cx: &mut Context, item: &ast::Item) { + if !attr::contains_name(item.attrs.as_slice(), "automatically_derived") { return } + let did = match item.node { + ast::ItemImpl(..) => { + match ty::get(ty::node_id_to_type(cx.tcx, item.id)).sty { + ty::ty_enum(did, _) => did, + ty::ty_struct(did, _) => did, + _ => return, + } + } + _ => return, + }; + if !ast_util::is_local(did) { return } + let item = match cx.tcx.map.find(did.node) { + Some(ast_map::NodeItem(item)) => item, + _ => return, + }; + if !cx.checked_raw_pointers.insert(item.id) { return } match item.node { ast::ItemStruct(..) | ast::ItemEnum(..) => { let mut visitor = RawPtrDerivingVisitor { cx: cx }; @@ -1848,7 +1868,8 @@ pub fn check_crate(tcx: &ty::ctxt, cur_struct_def_id: -1, is_doc_hidden: false, lint_stack: Vec::new(), - negated_expr_id: -1 + negated_expr_id: -1, + checked_raw_pointers: NodeSet::new(), }; // Install default lint levels, followed by the command line levels, and diff --git a/src/librustc/util/ppaux.rs b/src/librustc/util/ppaux.rs index 5060c5572cdbb..95ae05985d38e 100644 --- a/src/librustc/util/ppaux.rs +++ b/src/librustc/util/ppaux.rs @@ -355,18 +355,14 @@ pub fn ty_to_str(cx: &ctxt, typ: t) -> StrBuf { ty_bot => "!".to_strbuf(), ty_bool => "bool".to_strbuf(), ty_char => "char".to_strbuf(), - ty_int(t) => ast_util::int_ty_to_str(t, None), - ty_uint(t) => ast_util::uint_ty_to_str(t, None), - ty_float(t) => ast_util::float_ty_to_str(t), - ty_box(typ) => { - ("@".to_owned() + ty_to_str(cx, typ).as_slice()).to_strbuf() - } - ty_uniq(typ) => { - ("~".to_owned() + ty_to_str(cx, typ).as_slice()).to_strbuf() - } - ty_ptr(ref tm) => { - ("*".to_owned() + mt_to_str(cx, tm).as_slice()).to_strbuf() - } + ty_int(t) => ast_util::int_ty_to_str(t, None, + ast_util::AutoSuffix).to_strbuf(), + ty_uint(t) => ast_util::uint_ty_to_str(t, None, + ast_util::AutoSuffix).to_strbuf(), + ty_float(t) => ast_util::float_ty_to_str(t).to_strbuf(), + ty_box(typ) => format_strbuf!("@{}", ty_to_str(cx, typ)), + ty_uniq(typ) => format_strbuf!("~{}", ty_to_str(cx, typ)), + ty_ptr(ref tm) => format_strbuf!("*{}", mt_to_str(cx, tm)), ty_rptr(r, ref tm) => { let mut buf = region_ptr_to_str(cx, r); buf.push_str(mt_to_str(cx, tm).as_slice()); @@ -374,7 +370,7 @@ pub fn ty_to_str(cx: &ctxt, typ: t) -> StrBuf { } ty_tup(ref elems) => { let strs: Vec = elems.iter().map(|elem| ty_to_str(cx, *elem)).collect(); - ("(".to_owned() + strs.connect(",") + ")").to_strbuf() + format_strbuf!("({})", strs.connect(",")) } ty_closure(ref f) => { closure_to_str(cx, *f) diff --git a/src/librustdoc/html/highlight.rs b/src/librustdoc/html/highlight.rs index 590086e9d3ac1..5d4350f8fb5cd 100644 --- a/src/librustdoc/html/highlight.rs +++ b/src/librustdoc/html/highlight.rs @@ -26,6 +26,7 @@ use t = syntax::parse::token; /// Highlights some source code, returning the HTML output. pub fn highlight(src: &str, class: Option<&str>) -> StrBuf { + debug!("highlighting: ================\n{}\n==============", src); let sess = parse::new_parse_sess(); let fm = parse::string_to_filemap(&sess, src.to_strbuf(), diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs index 76f7949bcf9c2..d6831e225bc29 100644 --- a/src/librustdoc/html/markdown.rs +++ b/src/librustdoc/html/markdown.rs @@ -149,6 +149,7 @@ pub fn render(w: &mut io::Writer, s: &str, print_toc: bool) -> fmt::Result { let my_opaque: &MyOpaque = &*((*opaque).opaque as *MyOpaque); slice::raw::buf_as_slice((*text).data, (*text).size as uint, |text| { let text = str::from_utf8(text).unwrap(); + debug!("docblock: ==============\n{}\n=======", text); let mut lines = text.lines().filter(|l| { stripped_filtered_line(*l).is_none() }); diff --git a/src/libsyntax/ast.rs b/src/libsyntax/ast.rs index 391116d2dbcd2..e5ef31a95a38b 100644 --- a/src/libsyntax/ast.rs +++ b/src/libsyntax/ast.rs @@ -711,7 +711,8 @@ pub enum IntTy { impl fmt::Show for IntTy { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f.buf, "{}", ast_util::int_ty_to_str(*self, None)) + write!(f.buf, "{}", + ast_util::int_ty_to_str(*self, None, ast_util::AutoSuffix)) } } @@ -726,7 +727,8 @@ pub enum UintTy { impl fmt::Show for UintTy { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f.buf, "{}", ast_util::uint_ty_to_str(*self, None)) + write!(f.buf, "{}", + ast_util::uint_ty_to_str(*self, None, ast_util::AutoSuffix)) } } diff --git a/src/libsyntax/ast_util.rs b/src/libsyntax/ast_util.rs index 550b6603d5d55..fb69e440b2fb4 100644 --- a/src/libsyntax/ast_util.rs +++ b/src/libsyntax/ast_util.rs @@ -132,11 +132,19 @@ pub fn is_path(e: @Expr) -> bool { return match e.node { ExprPath(_) => true, _ => false }; } +pub enum SuffixMode { + ForceSuffix, + AutoSuffix, +} + // Get a string representation of a signed int type, with its value. // We want to avoid "45int" and "-3int" in favor of "45" and "-3" -pub fn int_ty_to_str(t: IntTy, val: Option) -> StrBuf { +pub fn int_ty_to_str(t: IntTy, val: Option, mode: SuffixMode) -> StrBuf { let s = match t { - TyI if val.is_some() => "", + TyI if val.is_some() => match mode { + AutoSuffix => "", + ForceSuffix => "i", + }, TyI => "int", TyI8 => "i8", TyI16 => "i16", @@ -145,7 +153,10 @@ pub fn int_ty_to_str(t: IntTy, val: Option) -> StrBuf { }; match val { - Some(n) => format!("{}{}", n, s).to_strbuf(), + // cast to a u64 so we can correctly print INT64_MIN. All integral types + // are parsed as u64, so we wouldn't want to print an extra negative + // sign. + Some(n) => format!("{}{}", n as u64, s).to_strbuf(), None => s.to_strbuf() } } @@ -161,9 +172,12 @@ pub fn int_ty_max(t: IntTy) -> u64 { // Get a string representation of an unsigned int type, with its value. // We want to avoid "42uint" in favor of "42u" -pub fn uint_ty_to_str(t: UintTy, val: Option) -> StrBuf { +pub fn uint_ty_to_str(t: UintTy, val: Option, mode: SuffixMode) -> StrBuf { let s = match t { - TyU if val.is_some() => "u", + TyU if val.is_some() => match mode { + AutoSuffix => "", + ForceSuffix => "u", + }, TyU => "uint", TyU8 => "u8", TyU16 => "u16", diff --git a/src/libsyntax/ext/deriving/generic.rs b/src/libsyntax/ext/deriving/generic.rs index 9c967cfb4eeaa..6df4da8940219 100644 --- a/src/libsyntax/ext/deriving/generic.rs +++ b/src/libsyntax/ext/deriving/generic.rs @@ -182,6 +182,7 @@ use std::cell::RefCell; use ast; use ast::{P, EnumDef, Expr, Ident, Generics, StructDef}; use ast_util; +use attr::AttrMetaMethods; use ext::base::ExtCtxt; use ext::build::AstBuilder; use codemap; @@ -330,21 +331,34 @@ impl<'a> TraitDef<'a> { _mitem: @ast::MetaItem, item: @ast::Item, push: |@ast::Item|) { - match item.node { + let newitem = match item.node { ast::ItemStruct(struct_def, ref generics) => { - push(self.expand_struct_def(cx, - struct_def, - item.ident, - generics)); + self.expand_struct_def(cx, + struct_def, + item.ident, + generics) } ast::ItemEnum(ref enum_def, ref generics) => { - push(self.expand_enum_def(cx, - enum_def, - item.ident, - generics)); + self.expand_enum_def(cx, + enum_def, + item.ident, + generics) } - _ => () - } + _ => return + }; + // Keep the lint attributes of the previous item to control how the + // generated implementations are linted + let mut attrs = newitem.attrs.clone(); + attrs.extend(item.attrs.iter().filter(|a| { + match a.name().get() { + "allow" | "warn" | "deny" | "forbid" => true, + _ => false, + } + }).map(|a| a.clone())); + push(@ast::Item { + attrs: attrs, + ..(*newitem).clone() + }) } /** diff --git a/src/libsyntax/ext/expand.rs b/src/libsyntax/ext/expand.rs index 84525718bd95b..1898e8bf000a8 100644 --- a/src/libsyntax/ext/expand.rs +++ b/src/libsyntax/ext/expand.rs @@ -156,7 +156,7 @@ pub fn expand_expr(e: @ast::Expr, fld: &mut MacroExpander) -> @ast::Expr { // } // } - let local_ident = token::gensym_ident("i"); + let local_ident = token::gensym_ident("__i"); // FIXME #13573 let next_ident = fld.cx.ident_of("next"); let none_ident = fld.cx.ident_of("None"); @@ -262,7 +262,8 @@ pub fn expand_item(it: @ast::Item, fld: &mut MacroExpander) let it = expand_item_modifiers(it, fld); let mut decorator_items = SmallVector::zero(); - for attr in it.attrs.iter().rev() { + let mut new_attrs = Vec::new(); + for attr in it.attrs.iter() { let mname = attr.name(); match fld.extsbox.find(&intern(mname.get())) { @@ -286,7 +287,7 @@ pub fn expand_item(it: @ast::Item, fld: &mut MacroExpander) fld.cx.bt_pop(); } - _ => {} + _ => new_attrs.push((*attr).clone()), } } @@ -294,14 +295,21 @@ pub fn expand_item(it: @ast::Item, fld: &mut MacroExpander) ast::ItemMac(..) => expand_item_mac(it, fld), ast::ItemMod(_) | ast::ItemForeignMod(_) => { fld.cx.mod_push(it.ident); - let macro_escape = contains_macro_escape(it.attrs.as_slice()); + let macro_escape = contains_macro_escape(new_attrs.as_slice()); let result = with_exts_frame!(fld.extsbox, macro_escape, noop_fold_item(it, fld)); fld.cx.mod_pop(); result }, - _ => noop_fold_item(it, fld) + _ => { + let it = @ast::Item { + attrs: new_attrs, + ..(*it).clone() + + }; + noop_fold_item(it, fld) + } }; new_items.push_all(decorator_items); diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs index 2201b08f2ca48..92e5f8da6aa7e 100644 --- a/src/libsyntax/parse/parser.rs +++ b/src/libsyntax/parse/parser.rs @@ -587,16 +587,64 @@ impl<'a> Parser<'a> { self.replace_token(token::BINOP(token::OR), lo, self.span.hi) } _ => { - let token_str = self.this_token_to_str(); - let found_token = + let found_token = self.this_token_to_str(); + let token_str = Parser::token_to_str(&token::BINOP(token::OR)); self.fatal(format!("expected `{}`, found `{}`", - found_token, - token_str)) + token_str, found_token)) } } } + // Attempt to consume a `<`. If `<<` is seen, replace it with a single + // `<` and continue. If a `<` is not seen, return false. + // + // This is meant to be used when parsing generics on a path to get the + // starting token. The `force` parameter is used to forcefully break up a + // `<<` token. If `force` is false, then `<<` is only broken when a lifetime + // shows up next. For example, consider the expression: + // + // foo as bar << test + // + // The parser needs to know if `bar <<` is the start of a generic path or if + // it's a left-shift token. If `test` were a lifetime, then it's impossible + // for the token to be a left-shift, but if it's not a lifetime, then it's + // considered a left-shift. + // + // The reason for this is that the only current ambiguity with `<<` is when + // parsing closure types: + // + // foo::<<'a> ||>(); + // impl Foo<<'a> ||>() { ... } + fn eat_lt(&mut self, force: bool) -> bool { + match self.token { + token::LT => { self.bump(); true } + token::BINOP(token::SHL) => { + let next_lifetime = self.look_ahead(1, |t| match *t { + token::LIFETIME(..) => true, + _ => false, + }); + if force || next_lifetime { + let lo = self.span.lo + BytePos(1); + self.replace_token(token::LT, lo, self.span.hi); + true + } else { + false + } + } + _ => false, + } + } + + fn expect_lt(&mut self) { + if !self.eat_lt(true) { + let found_token = self.this_token_to_str(); + let token_str = Parser::token_to_str(&token::LT); + self.fatal(format!("expected `{}`, found `{}`", + token_str, found_token)) + } + } + // Parse a sequence bracketed by `|` and `|`, stopping before the `|`. fn parse_seq_to_before_or( &mut self, @@ -1500,7 +1548,7 @@ impl<'a> Parser<'a> { // Parse the `<` before the lifetime and types, if applicable. let (any_lifetime_or_types, lifetimes, types) = { - if mode != NoTypesAllowed && self.eat(&token::LT) { + if mode != NoTypesAllowed && self.eat_lt(false) { let (lifetimes, types) = self.parse_generic_values_after_lt(); (true, lifetimes, OwnedSlice::from_vec(types)) @@ -1948,7 +1996,7 @@ impl<'a> Parser<'a> { hi = self.span.hi; self.bump(); let (_, tys) = if self.eat(&token::MOD_SEP) { - self.expect(&token::LT); + self.expect_lt(); self.parse_generic_values_after_lt() } else { (Vec::new(), Vec::new()) @@ -2241,9 +2289,6 @@ impl<'a> Parser<'a> { ExprVec(..) if m == MutImmutable => { ExprVstore(e, ExprVstoreSlice) } - ExprLit(lit) if lit_is_str(lit) && m == MutImmutable => { - ExprVstore(e, ExprVstoreSlice) - } ExprVec(..) if m == MutMutable => { ExprVstore(e, ExprVstoreMutSlice) } diff --git a/src/libsyntax/parse/token.rs b/src/libsyntax/parse/token.rs index 3888ed6b8d1d4..68ce8cb2bc123 100644 --- a/src/libsyntax/parse/token.rs +++ b/src/libsyntax/parse/token.rs @@ -203,9 +203,11 @@ pub fn to_str(t: &Token) -> StrBuf { res.push_char('\''); res } - LIT_INT(i, t) => ast_util::int_ty_to_str(t, Some(i)), - LIT_UINT(u, t) => ast_util::uint_ty_to_str(t, Some(u)), - LIT_INT_UNSUFFIXED(i) => { i.to_str().to_strbuf() } + LIT_INT(i, t) => ast_util::int_ty_to_str(t, Some(i), + ast_util::ForceSuffix), + LIT_UINT(u, t) => ast_util::uint_ty_to_str(t, Some(u), + ast_util::ForceSuffix), + LIT_INT_UNSUFFIXED(i) => { (i as u64).to_str().to_strbuf() } LIT_FLOAT(s, t) => { let mut body = StrBuf::from_str(get_ident(s).get()); if body.as_slice().ends_with(".") { diff --git a/src/libsyntax/print/pprust.rs b/src/libsyntax/print/pprust.rs index 71c2f6337e0e6..15b931d58545e 100644 --- a/src/libsyntax/print/pprust.rs +++ b/src/libsyntax/print/pprust.rs @@ -168,7 +168,7 @@ pub fn tt_to_str(tt: &ast::TokenTree) -> StrBuf { } pub fn tts_to_str(tts: &[ast::TokenTree]) -> StrBuf { - to_str(|s| s.print_tts(&tts)) + to_str(|s| s.print_tts(tts)) } pub fn stmt_to_str(stmt: &ast::Stmt) -> StrBuf { @@ -247,6 +247,15 @@ pub fn visibility_qualified(vis: ast::Visibility, s: &str) -> StrBuf { } } +fn needs_parentheses(expr: &ast::Expr) -> bool { + match expr.node { + ast::ExprAssign(..) | ast::ExprBinary(..) | + ast::ExprFnBlock(..) | ast::ExprProc(..) | + ast::ExprAssignOp(..) | ast::ExprCast(..) => true, + _ => false, + } +} + impl<'a> State<'a> { pub fn ibox(&mut self, u: uint) -> IoResult<()> { self.boxes.push(pp::Inconsistent); @@ -714,7 +723,7 @@ impl<'a> State<'a> { try!(self.print_ident(item.ident)); try!(self.cbox(indent_unit)); try!(self.popen()); - try!(self.print_tts(&(tts.as_slice()))); + try!(self.print_tts(tts.as_slice())); try!(self.pclose()); try!(self.end()); } @@ -830,9 +839,15 @@ impl<'a> State<'a> { /// expression arguments as expressions). It can be done! I think. pub fn print_tt(&mut self, tt: &ast::TokenTree) -> IoResult<()> { match *tt { - ast::TTDelim(ref tts) => self.print_tts(&(tts.as_slice())), + ast::TTDelim(ref tts) => self.print_tts(tts.as_slice()), ast::TTTok(_, ref tk) => { - word(&mut self.s, parse::token::to_str(tk).as_slice()) + try!(word(&mut self.s, parse::token::to_str(tk).as_slice())); + match *tk { + parse::token::DOC_COMMENT(..) => { + hardbreak(&mut self.s) + } + _ => Ok(()) + } } ast::TTSeq(_, ref tts, ref sep, zerok) => { try!(word(&mut self.s, "$(")); @@ -856,7 +871,7 @@ impl<'a> State<'a> { } } - pub fn print_tts(&mut self, tts: & &[ast::TokenTree]) -> IoResult<()> { + pub fn print_tts(&mut self, tts: &[ast::TokenTree]) -> IoResult<()> { try!(self.ibox(0)); for (i, tt) in tts.iter().enumerate() { if i != 0 { @@ -1113,7 +1128,7 @@ impl<'a> State<'a> { try!(self.print_path(pth, false)); try!(word(&mut self.s, "!")); try!(self.popen()); - try!(self.print_tts(&tts.as_slice())); + try!(self.print_tts(tts.as_slice())); self.pclose() } } @@ -1136,6 +1151,18 @@ impl<'a> State<'a> { self.pclose() } + pub fn print_expr_maybe_paren(&mut self, expr: &ast::Expr) -> IoResult<()> { + let needs_par = needs_parentheses(expr); + if needs_par { + try!(self.popen()); + } + try!(self.print_expr(expr)); + if needs_par { + try!(self.pclose()); + } + Ok(()) + } + pub fn print_expr(&mut self, expr: &ast::Expr) -> IoResult<()> { try!(self.maybe_print_comment(expr.span.lo)); try!(self.ibox(indent_unit)); @@ -1209,7 +1236,7 @@ impl<'a> State<'a> { try!(self.pclose()); } ast::ExprCall(func, ref args) => { - try!(self.print_expr(func)); + try!(self.print_expr_maybe_paren(func)); try!(self.print_call_post(args.as_slice())); } ast::ExprMethodCall(ident, ref tys, ref args) => { @@ -1233,17 +1260,12 @@ impl<'a> State<'a> { } ast::ExprUnary(op, expr) => { try!(word(&mut self.s, ast_util::unop_to_str(op))); - try!(self.print_expr(expr)); + try!(self.print_expr_maybe_paren(expr)); } ast::ExprAddrOf(m, expr) => { try!(word(&mut self.s, "&")); try!(self.print_mutability(m)); - // Avoid `& &e` => `&&e`. - match (m, &expr.node) { - (ast::MutImmutable, &ast::ExprAddrOf(..)) => try!(space(&mut self.s)), - _ => { } - } - try!(self.print_expr(expr)); + try!(self.print_expr_maybe_paren(expr)); } ast::ExprLit(lit) => try!(self.print_literal(lit)), ast::ExprCast(expr, ty) => { @@ -1474,22 +1496,27 @@ impl<'a> State<'a> { try!(self.popen()); try!(self.print_string(a.asm.get(), a.asm_str_style)); try!(self.word_space(":")); - for &(ref co, o) in a.outputs.iter() { - try!(self.print_string(co.get(), ast::CookedStr)); - try!(self.popen()); - try!(self.print_expr(o)); - try!(self.pclose()); - try!(self.word_space(",")); - } + + try!(self.commasep(Inconsistent, a.outputs.as_slice(), |s, &(ref co, o)| { + try!(s.print_string(co.get(), ast::CookedStr)); + try!(s.popen()); + try!(s.print_expr(o)); + try!(s.pclose()); + Ok(()) + })); + try!(space(&mut self.s)); try!(self.word_space(":")); - for &(ref co, o) in a.inputs.iter() { - try!(self.print_string(co.get(), ast::CookedStr)); - try!(self.popen()); - try!(self.print_expr(o)); - try!(self.pclose()); - try!(self.word_space(",")); - } + + try!(self.commasep(Inconsistent, a.inputs.as_slice(), |s, &(ref co, o)| { + try!(s.print_string(co.get(), ast::CookedStr)); + try!(s.popen()); + try!(s.print_expr(o)); + try!(s.pclose()); + Ok(()) + })); + try!(space(&mut self.s)); try!(self.word_space(":")); + try!(self.print_string(a.clobbers.get(), ast::CookedStr)); try!(self.pclose()); } @@ -2211,11 +2238,13 @@ impl<'a> State<'a> { } ast::LitInt(i, t) => { word(&mut self.s, - ast_util::int_ty_to_str(t, Some(i)).as_slice()) + ast_util::int_ty_to_str(t, Some(i), + ast_util::AutoSuffix).as_slice()) } ast::LitUint(u, t) => { word(&mut self.s, - ast_util::uint_ty_to_str(t, Some(u)).as_slice()) + ast_util::uint_ty_to_str(t, Some(u), + ast_util::ForceSuffix).as_slice()) } ast::LitIntUnsuffixed(i) => { word(&mut self.s, format!("{}", i)) diff --git a/src/test/bench/core-set.rs b/src/test/bench/core-set.rs index b1181a3c17c5a..53b371e06cbe0 100644 --- a/src/test/bench/core-set.rs +++ b/src/test/bench/core-set.rs @@ -1,5 +1,3 @@ -// ignore-pretty - // Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. @@ -10,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// ignore-pretty very bad with line comments + extern crate collections; extern crate rand; extern crate time; diff --git a/src/test/bench/shootout-k-nucleotide-pipes.rs b/src/test/bench/shootout-k-nucleotide-pipes.rs index e2bcc55d13982..04032c4aa3903 100644 --- a/src/test/bench/shootout-k-nucleotide-pipes.rs +++ b/src/test/bench/shootout-k-nucleotide-pipes.rs @@ -9,8 +9,8 @@ // except according to those terms. // ignore-android: FIXME(#10393) +// ignore-pretty very bad with line comments -// ignore-pretty the `let to_child` line gets an extra newline // multi tasking k-nucleotide extern crate collections; diff --git a/src/test/bench/shootout-k-nucleotide.rs b/src/test/bench/shootout-k-nucleotide.rs index dfa287459f33c..1434838e59bce 100644 --- a/src/test/bench/shootout-k-nucleotide.rs +++ b/src/test/bench/shootout-k-nucleotide.rs @@ -9,7 +9,6 @@ // except according to those terms. // ignore-android see #10393 #13206 -// ignore-pretty extern crate sync; diff --git a/src/test/bench/shootout-mandelbrot.rs b/src/test/bench/shootout-mandelbrot.rs index ee715aecec4fc..e17324ee59649 100644 --- a/src/test/bench/shootout-mandelbrot.rs +++ b/src/test/bench/shootout-mandelbrot.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// ignore-pretty very bad with line comments + extern crate sync; use std::io; diff --git a/src/test/bench/shootout-reverse-complement.rs b/src/test/bench/shootout-reverse-complement.rs index 4ee4f94d4354b..fdd711d22c760 100644 --- a/src/test/bench/shootout-reverse-complement.rs +++ b/src/test/bench/shootout-reverse-complement.rs @@ -8,8 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// ignore-pretty very bad with line comments // ignore-android doesn't terminate? -// ignore-pretty use std::iter::range_step; use std::io::{stdin, stdout, File}; diff --git a/src/test/bench/sudoku.rs b/src/test/bench/sudoku.rs index bd47734c3da89..58568282e1584 100644 --- a/src/test/bench/sudoku.rs +++ b/src/test/bench/sudoku.rs @@ -1,5 +1,3 @@ -// ignore-pretty - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. @@ -10,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// ignore-pretty very bad with line comments + #![feature(managed_boxes)] use std::io; diff --git a/src/test/bench/task-perf-jargon-metal-smoke.rs b/src/test/bench/task-perf-jargon-metal-smoke.rs index 35c314dac93cc..442386e30586e 100644 --- a/src/test/bench/task-perf-jargon-metal-smoke.rs +++ b/src/test/bench/task-perf-jargon-metal-smoke.rs @@ -1,5 +1,3 @@ -// ignore-pretty - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. @@ -17,6 +15,8 @@ // // The filename is a song reference; google it in quotes. +// ignore-pretty very bad with line comments + use std::comm; use std::os; use std::task; diff --git a/src/test/compile-fail/borrowck-lend-flow-match.rs b/src/test/compile-fail/borrowck-lend-flow-match.rs index ea0f5d34b72e5..6b875ff268dd8 100644 --- a/src/test/compile-fail/borrowck-lend-flow-match.rs +++ b/src/test/compile-fail/borrowck-lend-flow-match.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-pretty -- comments are unfaithfully preserved - #![allow(unused_variable)] #![allow(dead_assignment)] diff --git a/src/test/compile-fail/borrowck-pat-reassign-binding.rs b/src/test/compile-fail/borrowck-pat-reassign-binding.rs index 47f92d9f4b1a0..f33e5e9b02d59 100644 --- a/src/test/compile-fail/borrowck-pat-reassign-binding.rs +++ b/src/test/compile-fail/borrowck-pat-reassign-binding.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-pretty -- comments are unfaithfully preserved - fn main() { let mut x: Option = None; match x { diff --git a/src/test/compile-fail/borrowck-preserve-box-in-field.rs b/src/test/compile-fail/borrowck-preserve-box-in-field.rs index 168a331e9fe29..68410ae4fe196 100644 --- a/src/test/compile-fail/borrowck-preserve-box-in-field.rs +++ b/src/test/compile-fail/borrowck-preserve-box-in-field.rs @@ -1,5 +1,3 @@ -// ignore-pretty - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/compile-fail/borrowck-preserve-box-in-uniq.rs b/src/test/compile-fail/borrowck-preserve-box-in-uniq.rs index d79b7e040c769..0db097ec003c2 100644 --- a/src/test/compile-fail/borrowck-preserve-box-in-uniq.rs +++ b/src/test/compile-fail/borrowck-preserve-box-in-uniq.rs @@ -1,5 +1,3 @@ -// ignore-pretty - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/compile-fail/borrowck-preserve-box.rs b/src/test/compile-fail/borrowck-preserve-box.rs index 1a920c7871e1c..cd36d93060462 100644 --- a/src/test/compile-fail/borrowck-preserve-box.rs +++ b/src/test/compile-fail/borrowck-preserve-box.rs @@ -1,5 +1,3 @@ -// ignore-pretty - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/compile-fail/borrowck-preserve-expl-deref.rs b/src/test/compile-fail/borrowck-preserve-expl-deref.rs index 9b7966b0af05b..ca24192e797e2 100644 --- a/src/test/compile-fail/borrowck-preserve-expl-deref.rs +++ b/src/test/compile-fail/borrowck-preserve-expl-deref.rs @@ -1,5 +1,3 @@ -// ignore-pretty - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-fail/run-unexported-tests.rs b/src/test/run-fail/run-unexported-tests.rs index b894127559161..70ef4a0c0c3d3 100644 --- a/src/test/run-fail/run-unexported-tests.rs +++ b/src/test/run-fail/run-unexported-tests.rs @@ -11,6 +11,7 @@ // error-pattern:runned an unexported test // compile-flags:--test // check-stdout +// ignore-pretty: does not work well with `--test` mod m { pub fn exported() { } diff --git a/src/test/run-fail/test-fail.rs b/src/test/run-fail/test-fail.rs index 77d87c22c6f1c..b628f101fd576 100644 --- a/src/test/run-fail/test-fail.rs +++ b/src/test/run-fail/test-fail.rs @@ -11,6 +11,7 @@ // check-stdout // error-pattern:task 'test_foo' failed at // compile-flags: --test +// ignore-pretty: does not work well with `--test` #[test] fn test_foo() { diff --git a/src/test/run-fail/test-tasks-invalid-value.rs b/src/test/run-fail/test-tasks-invalid-value.rs index 74531deb58ef6..8c9cd2d63cb47 100644 --- a/src/test/run-fail/test-tasks-invalid-value.rs +++ b/src/test/run-fail/test-tasks-invalid-value.rs @@ -14,6 +14,7 @@ // error-pattern:should be a positive integer // compile-flags: --test // exec-env:RUST_TEST_TASKS=foo +// ignore-pretty: does not work well with `--test` #[test] fn do_nothing() {} diff --git a/src/test/run-pass-fulldeps/quote-unused-sp-no-warning.rs b/src/test/run-pass-fulldeps/quote-unused-sp-no-warning.rs index 5025cc12b4a64..2d5bbd43e826f 100644 --- a/src/test/run-pass-fulldeps/quote-unused-sp-no-warning.rs +++ b/src/test/run-pass-fulldeps/quote-unused-sp-no-warning.rs @@ -9,6 +9,8 @@ // except according to those terms. // ignore-android +// ignore-pretty: does not work well with `--test` + #![feature(quote)] #![deny(unused_variable)] diff --git a/src/test/run-pass/anon-extern-mod-cross-crate-2.rs b/src/test/run-pass/anon-extern-mod-cross-crate-2.rs index fd600907ddb2b..0ef666031114e 100644 --- a/src/test/run-pass/anon-extern-mod-cross-crate-2.rs +++ b/src/test/run-pass/anon-extern-mod-cross-crate-2.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-pretty // aux-build:anon-extern-mod-cross-crate-1.rs extern crate anonexternmod; diff --git a/src/test/run-pass/assert-eq-macro-success.rs b/src/test/run-pass/assert-eq-macro-success.rs index 4aea57871b94d..c32d513f07455 100644 --- a/src/test/run-pass/assert-eq-macro-success.rs +++ b/src/test/run-pass/assert-eq-macro-success.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +#![feature(managed_boxes)] + #[deriving(Eq, Show)] struct Point { x : int } diff --git a/src/test/run-pass/big-literals.rs b/src/test/run-pass/big-literals.rs index 9da3a7079df62..3b2618c060d00 100644 --- a/src/test/run-pass/big-literals.rs +++ b/src/test/run-pass/big-literals.rs @@ -1,5 +1,3 @@ -// ignore-pretty - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. @@ -18,4 +16,5 @@ pub fn main() { assert_eq!(-2147483648i32 - 1i32, 2147483647i32); assert_eq!(-9223372036854775808i64 - 1i64, 9223372036854775807i64); + assert_eq!(-9223372036854775808 - 1, 9223372036854775807); } diff --git a/src/test/run-pass/binops.rs b/src/test/run-pass/binops.rs index 331e947586ab8..69705996fadda 100644 --- a/src/test/run-pass/binops.rs +++ b/src/test/run-pass/binops.rs @@ -10,6 +10,8 @@ // Binop corner cases +#![feature(managed_boxes)] + fn test_nil() { assert_eq!((), ()); assert!((!(() != ()))); diff --git a/src/test/run-pass/borrowck-pat-enum.rs b/src/test/run-pass/borrowck-pat-enum.rs index ade286663a19c..74ce8ef2e4531 100644 --- a/src/test/run-pass/borrowck-pat-enum.rs +++ b/src/test/run-pass/borrowck-pat-enum.rs @@ -1,5 +1,3 @@ -// ignore-pretty - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. @@ -10,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// ignore-pretty + fn match_ref(v: Option) -> int { match v { Some(ref i) => { diff --git a/src/test/run-pass/box-compare.rs b/src/test/run-pass/box-compare.rs index 2e90fba122e09..10a3db5808e2d 100644 --- a/src/test/run-pass/box-compare.rs +++ b/src/test/run-pass/box-compare.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. - +#![feature(managed_boxes)] pub fn main() { assert!((@1 < @3)); diff --git a/src/test/run-pass/closure-syntax.rs b/src/test/run-pass/closure-syntax.rs index 983cd00f39cb8..2bb0e6fa19c15 100644 --- a/src/test/run-pass/closure-syntax.rs +++ b/src/test/run-pass/closure-syntax.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-pretty #13324 - #![allow(dead_code)] fn foo() {} @@ -45,6 +43,12 @@ fn g<'a>(a: &'a int, f: proc<'b>(&'b int) -> &'b int) -> &'a int { f(a) } +struct A; + +impl A { + fn foo(&self) {} +} + fn bar<'b>() { foo::<||>(); foo::<|| -> ()>(); @@ -60,17 +64,25 @@ fn bar<'b>() { foo::(); foo::(int, f32, &'a int):'static + Share -> &'a int>(); + foo::<<'a>||>(); + // issue #11209 let _: ||: 'b; // for comparison let _: <'a> ||; let _: Option<||:'b>; - // let _: Option<<'a>||>; + let _: Option<<'a>||>; let _: Option< <'a>||>; // issue #11210 let _: ||: 'static; + + let a = A; + a.foo::<<'a>||>(); } +struct B; +impl<'b> B<<'a>||: 'b> {} + pub fn main() { } diff --git a/src/test/run-pass/deriving-global.rs b/src/test/run-pass/deriving-global.rs index 55e2615835ab4..cbf6a1c50df1d 100644 --- a/src/test/run-pass/deriving-global.rs +++ b/src/test/run-pass/deriving-global.rs @@ -8,20 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-pretty - does not converge - -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -extern crate serialize; // {En,De}codable -extern crate rand; // Rand +extern crate serialize; +extern crate rand; mod submod { // if any of these are implemented without global calls for any diff --git a/src/test/run-pass/hygienic-labels-in-let.rs b/src/test/run-pass/hygienic-labels-in-let.rs index 22523f5e6ccb7..ee90cfd3475b1 100644 --- a/src/test/run-pass/hygienic-labels-in-let.rs +++ b/src/test/run-pass/hygienic-labels-in-let.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// ignore-pretty: pprust doesn't print hygiene output + #![feature(macro_rules)] macro_rules! loop_x { diff --git a/src/test/run-pass/ifmt.rs b/src/test/run-pass/ifmt.rs index 1ac3602293807..56d265233baf1 100644 --- a/src/test/run-pass/ifmt.rs +++ b/src/test/run-pass/ifmt.rs @@ -8,8 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// no-pretty-expanded unnecessary unsafe block generated -#![feature(macro_rules)] +#![feature(macro_rules, managed_boxes)] #![deny(warnings)] #![allow(unused_must_use)] #![allow(deprecated_owned_vector)] @@ -76,6 +77,7 @@ pub fn main() { t!(format!("{foo} {1} {bar} {0}", 0, 1, foo=2, bar=3), "2 1 3 0"); t!(format!("{} {0}", "a"), "a a"); t!(format!("{foo_bar}", foo_bar=1), "1"); + t!(format!("{:d}", 5 + 5), "10"); // Methods should probably work t!(format!("{0, plural, =1{a#} =2{b#} zero{c#} other{d#}}", 0u), "c0"); diff --git a/src/test/run-pass/invoke-external-foreign.rs b/src/test/run-pass/invoke-external-foreign.rs index 2603e2d1b099c..ef5ef2f215cc2 100644 --- a/src/test/run-pass/invoke-external-foreign.rs +++ b/src/test/run-pass/invoke-external-foreign.rs @@ -8,7 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-pretty // aux-build:foreign_lib.rs // The purpose of this test is to check that we can diff --git a/src/test/run-pass/nullable-pointer-iotareduction.rs b/src/test/run-pass/nullable-pointer-iotareduction.rs index fb61bea83da8d..728c0154a90e9 100644 --- a/src/test/run-pass/nullable-pointer-iotareduction.rs +++ b/src/test/run-pass/nullable-pointer-iotareduction.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(macro_rules)] +#![feature(macro_rules, managed_boxes)] use std::{option, mem}; diff --git a/src/test/run-pass/nullable-pointer-size.rs b/src/test/run-pass/nullable-pointer-size.rs index 00edcd6a0924b..0ca8efb3fdc91 100644 --- a/src/test/run-pass/nullable-pointer-size.rs +++ b/src/test/run-pass/nullable-pointer-size.rs @@ -8,7 +8,7 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -#![feature(macro_rules)] +#![feature(macro_rules, managed_boxes)] use std::mem; diff --git a/src/test/run-pass/numeric-method-autoexport.rs b/src/test/run-pass/numeric-method-autoexport.rs index fbb404b3809d7..585ade71fc603 100644 --- a/src/test/run-pass/numeric-method-autoexport.rs +++ b/src/test/run-pass/numeric-method-autoexport.rs @@ -1,5 +1,3 @@ -// ignore-pretty - // Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. @@ -10,10 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// no-pretty-expanded + // This file is intended to test only that methods are automatically // reachable for each numeric type, for each exported impl, with no imports // necessary. Testing the methods of the impls is done within the source // file for each numeric type. + pub fn main() { // ints // num diff --git a/src/test/run-pass/objects-owned-object-borrowed-method-header.rs b/src/test/run-pass/objects-owned-object-borrowed-method-header.rs index 456a5c5d29753..7752aed7236a6 100644 --- a/src/test/run-pass/objects-owned-object-borrowed-method-header.rs +++ b/src/test/run-pass/objects-owned-object-borrowed-method-header.rs @@ -1,5 +1,3 @@ -// ignore-pretty - // Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. diff --git a/src/test/run-pass/shebang.rs b/src/test/run-pass/shebang.rs index b6451c5777266..2f78513b95cf9 100644 --- a/src/test/run-pass/shebang.rs +++ b/src/test/run-pass/shebang.rs @@ -9,6 +9,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// pp-exact +// ignore-pretty: `expand` addes some preludes before shebang pub fn main() { println!("Hello World"); } diff --git a/src/test/run-pass/super-fast-paren-parsing.rs b/src/test/run-pass/super-fast-paren-parsing.rs index 70c7200bee9ae..1204efc29ebd3 100644 --- a/src/test/run-pass/super-fast-paren-parsing.rs +++ b/src/test/run-pass/super-fast-paren-parsing.rs @@ -8,7 +8,9 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// ignore-pretty +// exec-env:RUST_MIN_STACK=8000000 +// +// Big stack is needed for pretty printing, a little sad... static a: int = ((((((((((((((((((((((((((((((((((((((((((((((((((( diff --git a/src/test/run-pass/test-ignore-cfg.rs b/src/test/run-pass/test-ignore-cfg.rs index e8d36dad20877..309325ab7db4a 100644 --- a/src/test/run-pass/test-ignore-cfg.rs +++ b/src/test/run-pass/test-ignore-cfg.rs @@ -9,6 +9,7 @@ // except according to those terms. // compile-flags: --test --cfg ignorecfg +// ignore-pretty: does not work well with `--test` #[test] #[ignore(cfg(ignorecfg))] diff --git a/src/test/run-pass/test-runner-hides-main.rs b/src/test/run-pass/test-runner-hides-main.rs index 954d88c0bdc5e..05d5506f0a6b0 100644 --- a/src/test/run-pass/test-runner-hides-main.rs +++ b/src/test/run-pass/test-runner-hides-main.rs @@ -10,6 +10,7 @@ // compile-flags:--test // ignore-win32 #10872 +// ignore-pretty: does not work well with `--test` // Building as a test runner means that a synthetic main will be run, // not ours diff --git a/src/test/run-pass/trait-bounds-in-arc.rs b/src/test/run-pass/trait-bounds-in-arc.rs index 0a6e5ce0b6796..98dd3772a4f92 100644 --- a/src/test/run-pass/trait-bounds-in-arc.rs +++ b/src/test/run-pass/trait-bounds-in-arc.rs @@ -1,5 +1,3 @@ -// ignore-pretty - // Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT.