Skip to content

Check //~ERROR comments in ui tests #46116

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 4 commits into from
Nov 24, 2017
Merged

Check //~ERROR comments in ui tests #46116

merged 4 commits into from
Nov 24, 2017

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Nov 20, 2017

r? @nikomatsakis

cc #44844 @Phlosioneer @estebank @petrochenkov

this depends on #46052 getting merged first (the commits are included in here)

The relevant changes of this PR are c2f0af7 and 979269b

@kennytm kennytm added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 20, 2017
@nikomatsakis
Copy link
Contributor

I'm very excited to see this PR!

One minor thing is that I think there was some minor advantage in trying to capture the exact output we gave to the user (versus relying on JSON). But I think having just a test or two that checks that would be good enough -- and really we weren't checking colors anyhow.

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()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The motivation for defining the do_method closure was to avoid repeating the match method code for the JSON and human-friendly cases: if we're going to start treating these the same, we can delete lines 362–371 and put the match here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed


warning: unreachable pattern
--> $DIR/issue-43253.rs:49:9
|
49 | 9...9 => {},
| ^^^^^
|
note: lint level defined here
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a regression in one-time diagnostics (the motivation for which was avoiding too many "lint level defined here"s), but it's not immediately clear why that would happen ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is just a mixup that happened due to the update-all script not actually updating everything after it produced the expected output once. I need to touch all files in order to have them regenerate their stderr files.

@Phlosioneer
Copy link
Contributor

I'm glad someone's taken over for me. Thanks.

@bors
Copy link
Collaborator

bors commented Nov 21, 2017

☔ The latest upstream changes (presumably #45545) made this pull request unmergeable. Please resolve the merge conflicts.

@oli-obk
Copy link
Contributor Author

oli-obk commented Nov 21, 2017

But I think having just a test or two that checks that would be good enough -- and really we weren't checking colors anyhow.

I added one. It's just a matter of adding // compile-flags: --error-format=human to the file. In that case the //~ ERROR comments won't work anymore

@oli-obk oli-obk force-pushed the json_ui branch 2 times, most recently from a30ef3f to f40b805 Compare November 21, 2017 10:01
@oli-obk
Copy link
Contributor Author

oli-obk commented Nov 21, 2017

Travis should pass now. At least both ui and ui-fulldeps run through locally on my machine.

@bors
Copy link
Collaborator

bors commented Nov 21, 2017

☔ The latest upstream changes (presumably #46166) made this pull request unmergeable. Please resolve the merge conflicts.

Copy link
Contributor

@nikomatsakis nikomatsakis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

r=me

I'm sure this is prone to bitrot, so p=1 as well.

@@ -170,6 +171,27 @@ impl Diagnostic {
rendered: None,
}
});

// generate regular command line output and store it in the json
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As an aside, one thing I have long wanted is precisely this: to have the full formatted output in the JSON. The only thing missing here are the colors, but I guess we could add that in a side "attribute" table saying like "the text from this column to that column is this color".

cc @estebank

@nikomatsakis
Copy link
Contributor

Travis result:

failures:
[00:49:26]     [compile-fail] compile-fail/issue-31221.rs
[00:49:26]     [compile-fail] compile-fail/lint-output-format-2.rs
[00:49:26]     [compile-fail] compile-fail/lint-unconditional-recursion.rs

@oli-obk oli-obk force-pushed the json_ui branch 2 times, most recently from f4cc0f6 to 5a6da19 Compare November 22, 2017 14:57
@oli-obk
Copy link
Contributor Author

oli-obk commented Nov 22, 2017

tests pass locally now

@kennytm
Copy link
Member

kennytm commented Nov 22, 2017

@bors r=nikomatsakis p=1

@bors
Copy link
Collaborator

bors commented Nov 22, 2017

📌 Commit 5a6da19 has been approved by nikomatsakis

@bors
Copy link
Collaborator

bors commented Nov 22, 2017

⌛ Testing commit 5a6da1969c0e5f74866ca6d0cec62aeca8948c95 with merge 8b0d1bb4012f71191363fdf3d024eb72454ab84c...

@bors
Copy link
Collaborator

bors commented Nov 22, 2017

💔 Test failed - status-travis

@kennytm
Copy link
Member

kennytm commented Nov 22, 2017

The UI tests need to be updated to account for the recent merges. Please rebase on latest master.

[00:38:49] failures:
[00:38:49] 
[00:38:49] ---- [ui] ui/fmt/send-sync.rs stdout ----
[00:38:49] 	
[00:38:49] error: /checkout/src/test/ui/fmt/send-sync.rs:18: unexpected error: '18:5: 18:9: the trait bound `*mut std::ops::Fn() + 'static: std::marker::Sync` is not satisfied in `[std::fmt::ArgumentV1<'_>]` [E0277]'
[00:38:49] 
[00:38:49] error: /checkout/src/test/ui/fmt/send-sync.rs:19: unexpected error: '19:5: 19:9: the trait bound `*mut std::ops::Fn() + 'static: std::marker::Sync` is not satisfied in `std::fmt::Arguments<'_>` [E0277]'
[00:38:49] 
[00:38:49] error: 2 unexpected errors found, 0 expected errors not found
[00:38:49] status: exit code: 101
[00:38:49] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/fmt/send-sync.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--target=x86_64-unknown-linux-musl" "--error-format" "json" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/fmt/send-sync.stage2-x86_64-unknown-linux-musl" "-Crpath" "-O" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-musl/native/rust-test-helpers" "-Clinker=/musl-x86_64/bin/musl-gcc" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/fmt/send-sync.stage2-x86_64-unknown-linux-musl.aux" "-A" "unused"
[00:38:49] unexpected errors (from JSON output): [
[00:38:49]     Error {
[00:38:49]         line_num: 18,
[00:38:49]         kind: Some(
[00:38:49]             Error
[00:38:49]         ),
[00:38:49]         msg: "18:5: 18:9: the trait bound `*mut std::ops::Fn() + \'static: std::marker::Sync` is not satisfied in `[std::fmt::ArgumentV1<\'_>]` [E0277]"
[00:38:49]     },
[00:38:49]     Error {
[00:38:49]         line_num: 19,
[00:38:49]         kind: Some(
[00:38:49]             Error
[00:38:49]         ),
[00:38:49]         msg: "19:5: 19:9: the trait bound `*mut std::ops::Fn() + \'static: std::marker::Sync` is not satisfied in `std::fmt::Arguments<\'_>` [E0277]"
[00:38:49]     }
[00:38:49] ]
[00:38:49] 
[00:38:49] thread '[ui] ui/fmt/send-sync.rs' panicked at 'explicit panic', /checkout/src/tools/compiletest/src/runtest.rs:1086:12
[00:38:49] note: Run with `RUST_BACKTRACE=1` for a backtrace.
[00:38:49] 
[00:38:49] ---- [ui] ui/impl-trait/no-method-suggested-traits.rs stdout ----
[00:38:49] 	
[00:38:49] error: /checkout/src/test/ui/impl-trait/no-method-suggested-traits.rs:14: unexpected help message: '14:1: 14:1: the following traits are implemented but not in scope, perhaps add a `use` for one of them:'
[00:38:49] 
[00:38:49] error: /checkout/src/test/ui/impl-trait/no-method-suggested-traits.rs:14: unexpected help message: '14:1: 14:1: the following traits are implemented but not in scope, perhaps add a `use` for one of them:'
[00:38:49] 
[00:38:49] error: /checkout/src/test/ui/impl-trait/no-method-suggested-traits.rs:14: unexpected help message: '14:1: 14:1: the following trait is implemented but not in scope, perhaps add a `use` for it:'
[00:38:49] 
[00:38:49] error: /checkout/src/test/ui/impl-trait/no-method-suggested-traits.rs:14: unexpected help message: '14:1: 14:1: the following trait is implemented but not in scope, perhaps add a `use` for it:'
[00:38:49] 
[00:38:49] error: /checkout/src/test/ui/impl-trait/no-method-suggested-traits.rs:14: unexpected help message: '14:1: 14:1: the following trait is implemented but not in scope, perhaps add a `use` for it:'
[00:38:49] 
[00:38:49] error: /checkout/src/test/ui/impl-trait/no-method-suggested-traits.rs:14: unexpected help message: '14:1: 14:1: the following trait is implemented but not in scope, perhaps add a `use` for it:'
[00:38:49] 
[00:38:49] error: 6 unexpected errors found, 0 expected errors not found
[00:38:49] status: exit code: 101
[00:38:49] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/impl-trait/no-method-suggested-traits.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--target=x86_64-unknown-linux-musl" "--error-format" "json" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/impl-trait/no-method-suggested-traits.stage2-x86_64-unknown-linux-musl" "-Crpath" "-O" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-musl/native/rust-test-helpers" "-Clinker=/musl-x86_64/bin/musl-gcc" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/impl-trait/no-method-suggested-traits.stage2-x86_64-unknown-linux-musl.aux" "-A" "unused"
[00:38:49] unexpected errors (from JSON output): [
[00:38:49]     Error {
[00:38:49]         line_num: 14,
[00:38:49]         kind: Some(
[00:38:49]             Help
[00:38:49]         ),
[00:38:49]         msg: "14:1: 14:1: the following traits are implemented but not in scope, perhaps add a `use` for one of them:"
[00:38:49]     },
[00:38:49]     Error {
[00:38:49]         line_num: 14,
[00:38:49]         kind: Some(
[00:38:49]             Help
[00:38:49]         ),
[00:38:49]         msg: "14:1: 14:1: the following traits are implemented but not in scope, perhaps add a `use` for one of them:"
[00:38:49]     },
[00:38:49]     Error {
[00:38:49]         line_num: 14,
[00:38:49]         kind: Some(
[00:38:49]             Help
[00:38:49]         ),
[00:38:49]         msg: "14:1: 14:1: the following trait is implemented but not in scope, perhaps add a `use` for it:"
[00:38:49]     },
[00:38:49]     Error {
[00:38:49]         line_num: 14,
[00:38:49]         kind: Some(
[00:38:49]             Help
[00:38:49]         ),
[00:38:49]         msg: "14:1: 14:1: the following trait is implemented but not in scope, perhaps add a `use` for it:"
[00:38:49]     },
[00:38:49]     Error {
[00:38:49]         line_num: 14,
[00:38:49]         kind: Some(
[00:38:49]             Help
[00:38:49]         ),
[00:38:49]         msg: "14:1: 14:1: the following trait is implemented but not in scope, perhaps add a `use` for it:"
[00:38:49]     },
[00:38:49]     Error {
[00:38:49]         line_num: 14,
[00:38:49]         kind: Some(
[00:38:49]             Help
[00:38:49]         ),
[00:38:49]         msg: "14:1: 14:1: the following trait is implemented but not in scope, perhaps add a `use` for it:"
[00:38:49]     }
[00:38:49] ]
[00:38:49] 
[00:38:49] thread '[ui] ui/impl-trait/no-method-suggested-traits.rs' panicked at 'explicit panic', /checkout/src/tools/compiletest/src/runtest.rs:1086:12
[00:38:49] 
[00:38:49] ---- [ui] ui/issue-35976.rs stdout ----
[00:38:49] 	
[00:38:49] error: /checkout/src/test/ui/issue-35976.rs:24: expected message not found: another candidate was found in the following trait, perhaps add a `use` for it:
[00:38:49] 
[00:38:49] error: 0 unexpected errors found, 1 expected errors not found
[00:38:49] status: exit code: 101
[00:38:49] command: "/checkout/obj/build/x86_64-unknown-linux-gnu/stage2/bin/rustc" "/checkout/src/test/ui/issue-35976.rs" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui" "--target=x86_64-unknown-linux-musl" "--error-format" "json" "-C" "prefer-dynamic" "-o" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issue-35976.stage2-x86_64-unknown-linux-musl" "-Crpath" "-O" "-Lnative=/checkout/obj/build/x86_64-unknown-linux-musl/native/rust-test-helpers" "-Clinker=/musl-x86_64/bin/musl-gcc" "-L" "/checkout/obj/build/x86_64-unknown-linux-gnu/test/ui/issue-35976.stage2-x86_64-unknown-linux-musl.aux" "-A" "unused"
[00:38:49] not found errors (from test file): [
[00:38:49]     Error {
[00:38:49]         line_num: 24,
[00:38:49]         kind: None,
[00:38:49]         msg: "another candidate was found in the following trait, perhaps add a `use` for it:"
[00:38:49]     }
[00:38:49] ]
[00:38:49] 
[00:38:49] thread '[ui] ui/issue-35976.rs' panicked at 'explicit panic', /checkout/src/tools/compiletest/src/runtest.rs:1086:12
[00:38:49] 
[00:38:49] 
[00:38:49] failures:
[00:38:49]     [ui] ui/fmt/send-sync.rs
[00:38:49]     [ui] ui/impl-trait/no-method-suggested-traits.rs
[00:38:49]     [ui] ui/issue-35976.rs
[00:38:49] 
[00:38:49] test result: FAILED. 462 passed; 3 failed; 1 ignored; 0 measured; 0 filtered out

@kennytm kennytm added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 22, 2017
@oli-obk
Copy link
Contributor Author

oli-obk commented Nov 23, 2017

updated

@bors
Copy link
Collaborator

bors commented Nov 23, 2017

☔ The latest upstream changes (presumably #46024) made this pull request unmergeable. Please resolve the merge conflicts.

@oli-obk
Copy link
Contributor Author

oli-obk commented Nov 23, 2017

rebased again

@oli-obk
Copy link
Contributor Author

oli-obk commented Nov 23, 2017

The PR in the queue (#46051) will break this again.

The next one after that (#46054) should be fine though.

@oli-obk
Copy link
Contributor Author

oli-obk commented Nov 23, 2017

I have not been able to fix it in time (gotta run, and rebase + test is taking too long). Will try again tomorrow.

Can I have bors delegation rights so I can immediately put it in the queue when I fix it?

@petrochenkov
Copy link
Contributor

@bors delegate+

@bors
Copy link
Collaborator

bors commented Nov 23, 2017

✌️ @oli-obk can now approve this pull request

@oli-obk
Copy link
Contributor Author

oli-obk commented Nov 24, 2017

@bors r=nikomatsakis p=1

@bors
Copy link
Collaborator

bors commented Nov 24, 2017

📌 Commit 8c1f9ef has been approved by nikomatsakis

@bors
Copy link
Collaborator

bors commented Nov 24, 2017

⌛ Testing commit 8c1f9ef with merge cc8ceb0...

bors added a commit that referenced this pull request Nov 24, 2017
Check //~ERROR comments in ui tests

r? @nikomatsakis

cc #44844 @Phlosioneer @estebank @petrochenkov

this depends on #46052 getting merged first (the commits are included in here)

The relevant changes of this PR are c2f0af7 and 979269b
@bors
Copy link
Collaborator

bors commented Nov 24, 2017

💔 Test failed - status-appveyor

@oli-obk
Copy link
Contributor Author

oli-obk commented Nov 24, 2017

legit:

-$DIR/short-error-format.rs:16:9 - error[E0308]: mismatched types
-$DIR/short-error-format.rs:18:7 - error[E0599]: no method named `salut` found for type `u32` in the current scope
+C:/projects/rust/src/test/ui/short-error-format.rs:16:9 - error[E0308]: mismatched types
+C:/projects/rust/src/test/ui/short-error-format.rs:18:7 - error[E0599]: no method named `salut` found for type `u32` in the current scope

@oli-obk
Copy link
Contributor Author

oli-obk commented Nov 24, 2017

I wasn't able to test on windows, but I undid the change that lead to the problem (replacing \ with \\ whenever --error-format was passed to a ui test, when it should only be done if the format is json)

@bors r=nikomatsakis p=1

@bors
Copy link
Collaborator

bors commented Nov 24, 2017

📌 Commit 8937d6a has been approved by nikomatsakis

@bors
Copy link
Collaborator

bors commented Nov 24, 2017

⌛ Testing commit 8937d6a with merge 71da1c2...

bors added a commit that referenced this pull request Nov 24, 2017
Check //~ERROR comments in ui tests

r? @nikomatsakis

cc #44844 @Phlosioneer @estebank @petrochenkov

this depends on #46052 getting merged first (the commits are included in here)

The relevant changes of this PR are c2f0af7 and 979269b
@bors
Copy link
Collaborator

bors commented Nov 24, 2017

☀️ Test successful - status-appveyor, status-travis
Approved by: nikomatsakis
Pushing 71da1c2 to master...

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants