Skip to content

Commit

Permalink
Merge cfail and ui tests into ui tests
Browse files Browse the repository at this point in the history
  • Loading branch information
oli-obk committed Nov 24, 2017
1 parent 36066d8 commit 8c1f9ef
Show file tree
Hide file tree
Showing 670 changed files with 2,181 additions and 2,112 deletions.
13 changes: 5 additions & 8 deletions src/librustc/session/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,11 @@ impl Session {
diag_builder: &'b mut DiagnosticBuilder<'a>,
method: DiagnosticBuilderMethod,
lint: &'static lint::Lint, message: &str, span: Option<Span>) {
let mut do_method = || {

let lint_id = DiagnosticMessageId::LintId(lint::LintId::of(lint));
let id_span_message = (lint_id, span, message.to_owned());
let fresh = self.one_time_diagnostics.borrow_mut().insert(id_span_message);
if fresh {
match method {
DiagnosticBuilderMethod::Note => {
diag_builder.note(message);
Expand All @@ -368,13 +372,6 @@ impl Session {
diag_builder.span_note(span.expect("span_note expects a span"), message);
}
}
};

let lint_id = DiagnosticMessageId::LintId(lint::LintId::of(lint));
let id_span_message = (lint_id, span, message.to_owned());
let fresh = self.one_time_diagnostics.borrow_mut().insert(id_span_message);
if fresh {
do_method()
}
}

Expand Down
2 changes: 0 additions & 2 deletions src/test/compile-fail/issue-31221.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@
#![allow(non_snake_case)]
#![deny(unreachable_patterns)]
//~^ NOTE lint level defined here
//~^^ NOTE lint level defined here
//~^^^ NOTE lint level defined here

#[derive(Clone, Copy)]
enum Enum {
Expand Down
1 change: 0 additions & 1 deletion src/test/compile-fail/lint-output-format-2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,5 @@ use lint_output_format::{foo, bar};
fn main() { //~ ERROR: compilation successful
let _x = foo();
//~^ WARNING use of deprecated item 'lint_output_format::foo': text
//~| NOTE #[warn(deprecated)] on by default
let _y = bar();
}
14 changes: 1 addition & 13 deletions src/test/compile-fail/lint-unconditional-recursion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,7 @@

#![deny(unconditional_recursion)]
//~^ NOTE lint level defined here
//~| NOTE lint level defined here
//~| NOTE lint level defined here
//~| NOTE lint level defined here
//~| NOTE lint level defined here
//~| NOTE lint level defined here
//~| NOTE lint level defined here
//~| NOTE lint level defined here
//~| NOTE lint level defined here
//~| NOTE lint level defined here
//~| NOTE lint level defined here
//~| NOTE lint level defined here
//~| NOTE lint level defined here
//~| NOTE lint level defined here

#![allow(dead_code)]
fn foo() { //~ ERROR function cannot return without recurring
foo(); //~ NOTE recursive call site
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui-fulldeps/custom-derive/issue-36935.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#[macro_use] extern crate plugin;

#[derive(Foo, Bar)]
#[derive(Foo, Bar)] //~ ERROR proc-macro derive panicked
struct Baz {
a: i32,
b: i32,
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui-fulldeps/custom-derive/issue-36935.stderr
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
error: proc-macro derive panicked
--> $DIR/issue-36935.rs:18:15
|
18 | #[derive(Foo, Bar)]
18 | #[derive(Foo, Bar)] //~ ERROR proc-macro derive panicked
| ^^^
|
= help: message: lolnope
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui-fulldeps/issue-44953/issue-44953.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#![feature(proc_macro)]
#![allow(unused_macros)]

#[macro_use] extern crate log;
#[macro_use] extern crate log; //~ ERROR use of unstable library feature

pub fn main() {
info!("This is a log message.");
Expand Down
2 changes: 1 addition & 1 deletion src/test/ui-fulldeps/issue-44953/issue-44953.stderr
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
error: use of unstable library feature 'rustc_private': this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via `Cargo.toml` instead? (see issue #27812)
--> $DIR/issue-44953.rs:16:14
|
16 | #[macro_use] extern crate log;
16 | #[macro_use] extern crate log; //~ ERROR use of unstable library feature
| ^^^^^^^^^^^^^^^^^
|
= help: add #![feature(rustc_private)] to the crate attributes to enable
Expand Down
10 changes: 5 additions & 5 deletions src/test/ui-fulldeps/proc-macro/three-equals.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,17 @@ fn main() {
three_equals!(===);

// Need exactly three equals.
three_equals!(==);
three_equals!(==); //~ ERROR found 2 equal signs, need exactly 3

// Need exactly three equals.
three_equals!(=====);
three_equals!(=====); //~ ERROR expected EOF

// Only equals accepted.
three_equals!(abc);
three_equals!(abc); //~ ERROR expected `=`

// Only equals accepted.
three_equals!(!!);
three_equals!(!!); //~ ERROR expected `=`

// Only three characters expected.
three_equals!(===a);
three_equals!(===a); //~ ERROR expected EOF
}
14 changes: 7 additions & 7 deletions src/test/ui-fulldeps/proc-macro/three-equals.stderr
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
error: found 2 equal signs, need exactly 3
--> $DIR/three-equals.rs:25:5
|
25 | three_equals!(==);
25 | three_equals!(==); //~ ERROR found 2 equal signs, need exactly 3
| ^^^^^^^^^^^^^^^^^^
|
= help: input must be: `===`

error: expected EOF, found `=`.
--> $DIR/three-equals.rs:28:21
|
28 | three_equals!(=====);
28 | three_equals!(=====); //~ ERROR expected EOF
| ^^
|
note: last good input was here
--> $DIR/three-equals.rs:28:21
|
28 | three_equals!(=====);
28 | three_equals!(=====); //~ ERROR expected EOF
| ^^
= help: input must be: `===`

error: expected `=`, found `abc`.
--> $DIR/three-equals.rs:31:19
|
31 | three_equals!(abc);
31 | three_equals!(abc); //~ ERROR expected `=`
| ^^^

error: expected `=`, found `!`.
--> $DIR/three-equals.rs:34:19
|
34 | three_equals!(!!);
34 | three_equals!(!!); //~ ERROR expected `=`
| ^

error: expected EOF, found `a`.
--> $DIR/three-equals.rs:37:22
|
37 | three_equals!(===a);
37 | three_equals!(===a); //~ ERROR expected EOF
| ^
|
note: last good input was here
--> $DIR/three-equals.rs:37:21
|
37 | three_equals!(===a);
37 | three_equals!(===a); //~ ERROR expected EOF
| ^
= help: input must be: `===`

Expand Down
10 changes: 10 additions & 0 deletions src/test/ui-fulldeps/resolve-error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,29 +35,39 @@ macro_rules! attr_proc_mac {
}

#[derive(FooWithLongNan)]
//~^ ERROR cannot find
struct Foo;

#[attr_proc_macra]
//~^ ERROR cannot find
struct Bar;

#[FooWithLongNan]
//~^ ERROR cannot find
struct Asdf;

#[derive(Dlone)]
//~^ ERROR cannot find
struct A;

#[derive(Dlona)]
//~^ ERROR cannot find
struct B;

#[derive(attr_proc_macra)]
//~^ ERROR cannot find
struct C;

fn main() {
FooWithLongNama!();
//~^ ERROR cannot find

attr_proc_macra!();
//~^ ERROR cannot find

Dlona!();
//~^ ERROR cannot find

bang_proc_macrp!();
//~^ ERROR cannot find
}
36 changes: 18 additions & 18 deletions src/test/ui-fulldeps/resolve-error.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -5,57 +5,57 @@ error: cannot find derive macro `FooWithLongNan` in this scope
| ^^^^^^^^^^^^^^ help: try: `FooWithLongName`

error: cannot find attribute macro `attr_proc_macra` in this scope
--> $DIR/resolve-error.rs:40:3
--> $DIR/resolve-error.rs:41:3
|
40 | #[attr_proc_macra]
41 | #[attr_proc_macra]
| ^^^^^^^^^^^^^^^ help: try: `attr_proc_macro`

error: cannot find attribute macro `FooWithLongNan` in this scope
--> $DIR/resolve-error.rs:43:3
--> $DIR/resolve-error.rs:45:3
|
43 | #[FooWithLongNan]
45 | #[FooWithLongNan]
| ^^^^^^^^^^^^^^

error: cannot find derive macro `Dlone` in this scope
--> $DIR/resolve-error.rs:46:10
--> $DIR/resolve-error.rs:49:10
|
46 | #[derive(Dlone)]
49 | #[derive(Dlone)]
| ^^^^^ help: try: `Clone`

error: cannot find derive macro `Dlona` in this scope
--> $DIR/resolve-error.rs:49:10
--> $DIR/resolve-error.rs:53:10
|
49 | #[derive(Dlona)]
53 | #[derive(Dlona)]
| ^^^^^ help: try: `Clona`

error: cannot find derive macro `attr_proc_macra` in this scope
--> $DIR/resolve-error.rs:52:10
--> $DIR/resolve-error.rs:57:10
|
52 | #[derive(attr_proc_macra)]
57 | #[derive(attr_proc_macra)]
| ^^^^^^^^^^^^^^^

error: cannot find macro `FooWithLongNama!` in this scope
--> $DIR/resolve-error.rs:56:5
--> $DIR/resolve-error.rs:62:5
|
56 | FooWithLongNama!();
62 | FooWithLongNama!();
| ^^^^^^^^^^^^^^^ help: you could try the macro: `FooWithLongNam!`

error: cannot find macro `attr_proc_macra!` in this scope
--> $DIR/resolve-error.rs:58:5
--> $DIR/resolve-error.rs:65:5
|
58 | attr_proc_macra!();
65 | attr_proc_macra!();
| ^^^^^^^^^^^^^^^ help: you could try the macro: `attr_proc_mac!`

error: cannot find macro `Dlona!` in this scope
--> $DIR/resolve-error.rs:60:5
--> $DIR/resolve-error.rs:68:5
|
60 | Dlona!();
68 | Dlona!();
| ^^^^^

error: cannot find macro `bang_proc_macrp!` in this scope
--> $DIR/resolve-error.rs:62:5
--> $DIR/resolve-error.rs:71:5
|
62 | bang_proc_macrp!();
71 | bang_proc_macrp!();
| ^^^^^^^^^^^^^^^ help: you could try the macro: `bang_proc_macro!`

error: aborting due to 10 previous errors
Expand Down
22 changes: 11 additions & 11 deletions src/test/ui/anonymous-higher-ranked-lifetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@
// except according to those terms.

fn main() {
f1(|_: (), _: ()| {});
f2(|_: (), _: ()| {});
f3(|_: (), _: ()| {});
f4(|_: (), _: ()| {});
f5(|_: (), _: ()| {});
g1(|_: (), _: ()| {});
g2(|_: (), _: ()| {});
g3(|_: (), _: ()| {});
g4(|_: (), _: ()| {});
h1(|_: (), _: (), _: (), _: ()| {});
h2(|_: (), _: (), _: (), _: ()| {});
f1(|_: (), _: ()| {}); //~ ERROR type mismatch
f2(|_: (), _: ()| {}); //~ ERROR type mismatch
f3(|_: (), _: ()| {}); //~ ERROR type mismatch
f4(|_: (), _: ()| {}); //~ ERROR type mismatch
f5(|_: (), _: ()| {}); //~ ERROR type mismatch
g1(|_: (), _: ()| {}); //~ ERROR type mismatch
g2(|_: (), _: ()| {}); //~ ERROR type mismatch
g3(|_: (), _: ()| {}); //~ ERROR type mismatch
g4(|_: (), _: ()| {}); //~ ERROR type mismatch
h1(|_: (), _: (), _: (), _: ()| {}); //~ ERROR type mismatch
h2(|_: (), _: (), _: (), _: ()| {}); //~ ERROR type mismatch
}

// Basic
Expand Down
Loading

0 comments on commit 8c1f9ef

Please sign in to comment.