diff --git a/src/compiletest/runtest.rs b/src/compiletest/runtest.rs index c7561248eb7fb..4abc4cce7273b 100644 --- a/src/compiletest/runtest.rs +++ b/src/compiletest/runtest.rs @@ -929,6 +929,13 @@ fn check_expected_errors(expected_errors: Vec, format!("{}:{}:", testfile.display(), ee.line) }).collect::>(); + let (expect_help, expect_note) = + expected_errors.iter() + .fold((false, false), + |(acc_help, acc_note), ee| + (acc_help || ee.kind == "help:", acc_note || + ee.kind == "note:")); + fn prefix_matches(line: &str, prefix: &str) -> bool { use std::ascii::AsciiExt; // On windows just translate all '\' path separators to '/' @@ -992,8 +999,8 @@ fn check_expected_errors(expected_errors: Vec, was_expected = true; } - if !was_expected && is_compiler_error_or_warning(line) { - fatal_proc_rec(&format!("unexpected compiler error or warning: '{}'", + if !was_expected && is_unexpected_compiler_message(line, expect_help, expect_note) { + fatal_proc_rec(&format!("unexpected compiler message: '{}'", line), proc_res); } @@ -1009,7 +1016,7 @@ fn check_expected_errors(expected_errors: Vec, } } -fn is_compiler_error_or_warning(line: &str) -> bool { +fn is_unexpected_compiler_message(line: &str, expect_help: bool, expect_note: bool) -> bool { let mut c = Path::new(line).components(); let line = match c.next() { Some(Component::Prefix(_)) => c.as_path().to_str().unwrap(), @@ -1017,8 +1024,7 @@ fn is_compiler_error_or_warning(line: &str) -> bool { }; let mut i = 0; - return - scan_until_char(line, ':', &mut i) && + return scan_until_char(line, ':', &mut i) && scan_char(line, ':', &mut i) && scan_integer(line, &mut i) && scan_char(line, ':', &mut i) && @@ -1030,7 +1036,10 @@ fn is_compiler_error_or_warning(line: &str) -> bool { scan_integer(line, &mut i) && scan_char(line, ' ', &mut i) && (scan_string(line, "error", &mut i) || - scan_string(line, "warning", &mut i)); + scan_string(line, "warning", &mut i) || + (expect_help && scan_string(line, "help", &mut i)) || + (expect_note && scan_string(line, "note", &mut i)) + ); } fn scan_until_char(haystack: &str, needle: char, idx: &mut usize) -> bool { diff --git a/src/test/compile-fail/changing-crates.rs b/src/test/compile-fail/changing-crates.rs index ae3ef76066710..0b42015848822 100644 --- a/src/test/compile-fail/changing-crates.rs +++ b/src/test/compile-fail/changing-crates.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// ignore-msvc FIXME #31306 + // note that these aux-build directives must be in this order // aux-build:changing-crates-a1.rs // aux-build:changing-crates-b.rs @@ -15,6 +17,8 @@ extern crate a; extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on -//~^ NOTE: perhaps this crate needs to be recompiled +//~| NOTE: perhaps this crate needs to be recompiled +//~| NOTE: crate `a` path #1: +//~| NOTE: crate `b` path #1: fn main() {} diff --git a/src/test/compile-fail/default_ty_param_conflict_cross_crate.rs b/src/test/compile-fail/default_ty_param_conflict_cross_crate.rs index 4d60724372ada..fc2c49d65affe 100644 --- a/src/test/compile-fail/default_ty_param_conflict_cross_crate.rs +++ b/src/test/compile-fail/default_ty_param_conflict_cross_crate.rs @@ -26,4 +26,5 @@ fn main() { meh(foo); //~^ ERROR: mismatched types: //~| NOTE: conflicting type parameter defaults `bool` and `char` + //~| NOTE: ...that was applied to an unconstrained type variable here } diff --git a/src/test/compile-fail/lifetime-inference-give-expl-lifetime-param.rs b/src/test/compile-fail/lifetime-inference-give-expl-lifetime-param.rs index a85776a938b44..e32ed1c42a090 100644 --- a/src/test/compile-fail/lifetime-inference-give-expl-lifetime-param.rs +++ b/src/test/compile-fail/lifetime-inference-give-expl-lifetime-param.rs @@ -49,6 +49,7 @@ struct Baz<'x> { impl<'a> Baz<'a> { fn baz2<'b>(&self, x: &isize) -> (&'b isize, &'b isize) { + //~^ HELP: parameter as shown: fn baz2<'b>(&self, x: &'b isize) -> (&'a isize, &'a isize) // The lifetime that gets assigned to `x` seems somewhat random. // I have disabled this test for the time being. --pcwalton (self.bar, x) //~ ERROR: cannot infer diff --git a/src/test/compile-fail/privacy1.rs b/src/test/compile-fail/privacy1.rs index 593068c2aea9d..495cdc3fe62e2 100644 --- a/src/test/compile-fail/privacy1.rs +++ b/src/test/compile-fail/privacy1.rs @@ -129,12 +129,17 @@ mod foo { ::bar::baz::foo(); //~ ERROR: function `foo` is inaccessible //~^ NOTE: module `baz` is private ::bar::baz::bar(); //~ ERROR: function `bar` is inaccessible + //~^ NOTE: module `baz` is private } fn test2() { use bar::baz::{foo, bar}; //~^ ERROR: function `foo` is inaccessible - //~^^ ERROR: function `bar` is inaccessible + //~| NOTE: module `baz` is private + //~| ERROR: function `bar` is inaccessible + //~| NOTE: module `baz` is private + + foo(); bar(); } diff --git a/src/test/compile-fail/svh-change-lit.rs b/src/test/compile-fail/svh-change-lit.rs index c839ade75cf29..eb92bcf065d3f 100644 --- a/src/test/compile-fail/svh-change-lit.rs +++ b/src/test/compile-fail/svh-change-lit.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// ignore-msvc FIXME #31306 + // note that these aux-build directives must be in this order // aux-build:svh-a-base.rs // aux-build:svh-b.rs @@ -15,7 +17,9 @@ extern crate a; extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on -//~^ NOTE: perhaps this crate needs to be recompiled +//~| NOTE: perhaps this crate needs to be recompiled +//~| NOTE: crate `a` path #1: +//~| NOTE: crate `b` path #1: fn main() { b::foo() diff --git a/src/test/compile-fail/svh-change-significant-cfg.rs b/src/test/compile-fail/svh-change-significant-cfg.rs index df0adf36ce2e6..7c9e0d3a92c98 100644 --- a/src/test/compile-fail/svh-change-significant-cfg.rs +++ b/src/test/compile-fail/svh-change-significant-cfg.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// ignore-msvc FIXME #31306 + // note that these aux-build directives must be in this order // aux-build:svh-a-base.rs // aux-build:svh-b.rs @@ -15,7 +17,9 @@ extern crate a; extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on -//~^ NOTE: perhaps this crate needs to be recompiled +//~| NOTE: perhaps this crate needs to be recompiled +//~| NOTE: crate `a` path #1: +//~| NOTE: crate `b` path #1: fn main() { b::foo() diff --git a/src/test/compile-fail/svh-change-trait-bound.rs b/src/test/compile-fail/svh-change-trait-bound.rs index 4774384fecd49..1e6a7232904a8 100644 --- a/src/test/compile-fail/svh-change-trait-bound.rs +++ b/src/test/compile-fail/svh-change-trait-bound.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// ignore-msvc FIXME #31306 + // note that these aux-build directives must be in this order // aux-build:svh-a-base.rs // aux-build:svh-b.rs @@ -15,7 +17,9 @@ extern crate a; extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on -//~^ NOTE: perhaps this crate needs to be recompiled +//~| NOTE: perhaps this crate needs to be recompiled +//~| NOTE: crate `a` path #1: +//~| NOTE: crate `b` path #1: fn main() { b::foo() diff --git a/src/test/compile-fail/svh-change-type-arg.rs b/src/test/compile-fail/svh-change-type-arg.rs index 51d3fd0a73a12..73c35ee6f82ca 100644 --- a/src/test/compile-fail/svh-change-type-arg.rs +++ b/src/test/compile-fail/svh-change-type-arg.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// ignore-msvc FIXME #31306 + // note that these aux-build directives must be in this order // aux-build:svh-a-base.rs // aux-build:svh-b.rs @@ -15,7 +17,9 @@ extern crate a; extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on -//~^ NOTE: perhaps this crate needs to be recompiled +//~| NOTE: perhaps this crate needs to be recompiled +//~| NOTE: crate `a` path #1: +//~| NOTE: crate `b` path #1: fn main() { b::foo() diff --git a/src/test/compile-fail/svh-change-type-ret.rs b/src/test/compile-fail/svh-change-type-ret.rs index 609e0f3689e5d..b8908e2cbd1e5 100644 --- a/src/test/compile-fail/svh-change-type-ret.rs +++ b/src/test/compile-fail/svh-change-type-ret.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// ignore-msvc FIXME #31306 + // note that these aux-build directives must be in this order // aux-build:svh-a-base.rs // aux-build:svh-b.rs @@ -15,7 +17,9 @@ extern crate a; extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on -//~^ NOTE: perhaps this crate needs to be recompiled +//~| NOTE: perhaps this crate needs to be recompiled +//~| NOTE: crate `a` path #1: +//~| NOTE: crate `b` path #1: fn main() { b::foo() diff --git a/src/test/compile-fail/svh-change-type-static.rs b/src/test/compile-fail/svh-change-type-static.rs index c42714609b6f8..291e441aa5e2d 100644 --- a/src/test/compile-fail/svh-change-type-static.rs +++ b/src/test/compile-fail/svh-change-type-static.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// ignore-msvc FIXME #31306 + // note that these aux-build directives must be in this order // aux-build:svh-a-base.rs // aux-build:svh-b.rs @@ -15,7 +17,9 @@ extern crate a; extern crate b; //~ ERROR: found possibly newer version of crate `a` which `b` depends on -//~^ NOTE: perhaps this crate needs to be recompiled +//~| NOTE: perhaps this crate needs to be recompiled +//~| NOTE: crate `a` path #1: +//~| NOTE: crate `b` path #1: fn main() { b::foo() diff --git a/src/test/compile-fail/svh-use-trait.rs b/src/test/compile-fail/svh-use-trait.rs index 7fdbf35fc6d59..ed816a93c52d2 100644 --- a/src/test/compile-fail/svh-use-trait.rs +++ b/src/test/compile-fail/svh-use-trait.rs @@ -8,6 +8,8 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. +// ignore-msvc FIXME #31306 + // note that these aux-build directives must be in this order // aux-build:svh-uta-base.rs // aux-build:svh-utb.rs @@ -20,7 +22,9 @@ extern crate uta; extern crate utb; //~ ERROR: found possibly newer version of crate `uta` which `utb` depends -//~^ NOTE: perhaps this crate needs to be recompiled +//~| NOTE: perhaps this crate needs to be recompiled? +//~| NOTE: crate `uta` path #1: +//~| NOTE: crate `utb` path #1: fn main() { utb::foo()