Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

do not print panic message on doctest failures #60549

Merged
merged 1 commit into from May 29, 2019

Conversation

Projects
None yet
6 participants
@euclio
Copy link
Contributor

commented May 4, 2019

This PR cleans up rustdoc test output by silently unwinding on failure instead of using panic!. It also improves the clarity and consistency of the output on test failure, and adds test cases for failure modes that were previously untested.

@euclio

This comment has been minimized.

Copy link
Contributor Author

commented May 4, 2019

@QuietMisdreavus
Copy link
Member

left a comment

Looks like this fixes #48394, which i'd originally closed as "not a bug". >_>

I'll take another look at this soon, but i like what i see so far! I'm going to rope in the rest of @rust-lang/rustdoc and @rep-nop since this was a big doctest thing for this year. It doesn't even seem like that much of a code change, either!

}
}

panic::resume_unwind(box ());

This comment has been minimized.

Copy link
@QuietMisdreavus

QuietMisdreavus May 6, 2019

Member

This is clever! I wouldn't think that resume_unwind would suppress the panic message, but i guess that that only happens in the panic hook, not in the pre-main landing pad.

This comment has been minimized.

Copy link
@euclio

euclio May 6, 2019

Author Contributor

Yeah! I got the idea from this PR: #59990

This comment has been minimized.

Copy link
@RalfJung

RalfJung May 29, 2019

Member

Would have been nice to also copy the explanatory comment from that PR. :)

@GuillaumeGomez

This comment has been minimized.

Copy link
Member

commented May 7, 2019

That's way better! Thanks a lot!

@QuietMisdreavus
Copy link
Member

left a comment

One little nit, otherwise the rest of this looks great!

if !stdout.is_empty() || !stderr.is_empty() {
if !stdout.is_empty() {
eprintln!("{}", stdout);
}

This comment has been minimized.

Copy link
@QuietMisdreavus

QuietMisdreavus May 7, 2019

Member

I feel like this printout would be better served by bringing back the "Test executable failed" message and maybe also prefixing each printout with stdout:\n{} and stderr:\n{} so it's obvious what's going on.

This comment has been minimized.

Copy link
@ollie27

ollie27 May 7, 2019

Contributor

How about including the exit code as well?


if let Err(err) = res {
match err {
TestFailure::CompileError => (), // The compiler errors are enough

This comment has been minimized.

Copy link
@ollie27

ollie27 May 7, 2019

Contributor

I think there should still be a message like "Couldn't compile the test." in this case.

@euclio euclio force-pushed the euclio:doctest-panic-messages branch 2 times, most recently from f1c60e7 to 0a1ee14 May 11, 2019

@euclio

This comment has been minimized.

Copy link
Contributor Author

commented May 11, 2019

Comments addressed.

@bors

This comment has been minimized.

Copy link
Contributor

commented May 22, 2019

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

@euclio euclio force-pushed the euclio:doctest-panic-messages branch from 0a1ee14 to 89d437e May 22, 2019

@euclio

This comment has been minimized.

Copy link
Contributor Author

commented May 22, 2019

@QuietMisdreavus Rebased.

@GuillaumeGomez

This comment has been minimized.

Copy link
Member

commented May 29, 2019

Thanks!

@bors: r+

@bors

This comment has been minimized.

Copy link
Contributor

commented May 29, 2019

📌 Commit 89d437e has been approved by GuillaumeGomez

Centril added a commit to Centril/rust that referenced this pull request May 29, 2019

Rollup merge of rust-lang#60549 - euclio:doctest-panic-messages, r=Gu…
…illaumeGomez

do not print panic message on doctest failures

This PR cleans up rustdoc test output by silently unwinding on failure instead of using `panic!`. It also improves the clarity and consistency of the output on test failure, and adds test cases for failure modes that were previously untested.

bors added a commit that referenced this pull request May 29, 2019

Auto merge of #61314 - Centril:rollup-5q563os, r=Centril
Rollup of 7 pull requests

Successful merges:

 - #60549 (do not print panic message on doctest failures)
 - #60885 (strip synstructure consts from compiler docs)
 - #61192 (Do not ICE on missing access place description during mutability error reporting)
 - #61217 (Account for short-hand init structs when suggesting conversion)
 - #61261 (is_union returns ty to avoid computing it twice)
 - #61293 (Print const generics properly in rustdoc)
 - #61313 (Simplify Set1::insert)

Failed merges:

r? @ghost

Centril added a commit to Centril/rust that referenced this pull request May 29, 2019

Rollup merge of rust-lang#60549 - euclio:doctest-panic-messages, r=Gu…
…illaumeGomez

do not print panic message on doctest failures

This PR cleans up rustdoc test output by silently unwinding on failure instead of using `panic!`. It also improves the clarity and consistency of the output on test failure, and adds test cases for failure modes that were previously untested.

bors added a commit that referenced this pull request May 29, 2019

Auto merge of #61316 - Centril:rollup-yhfxrqo, r=Centril
Rollup of 8 pull requests

Successful merges:

 - #60549 (do not print panic message on doctest failures)
 - #60885 (strip synstructure consts from compiler docs)
 - #61192 (Do not ICE on missing access place description during mutability error reporting)
 - #61217 (Account for short-hand init structs when suggesting conversion)
 - #61261 (is_union returns ty to avoid computing it twice)
 - #61293 (Print const generics properly in rustdoc)
 - #61310 (split libcore::mem into multiple files)
 - #61313 (Simplify Set1::insert)

Failed merges:

r? @ghost

oli-obk added a commit to oli-obk/rust that referenced this pull request May 29, 2019

Rollup merge of rust-lang#60549 - euclio:doctest-panic-messages, r=Gu…
…illaumeGomez

do not print panic message on doctest failures

This PR cleans up rustdoc test output by silently unwinding on failure instead of using `panic!`. It also improves the clarity and consistency of the output on test failure, and adds test cases for failure modes that were previously untested.

bors added a commit that referenced this pull request May 29, 2019

Auto merge of #61317 - oli-obk:rollup-tm5qivq, r=oli-obk
Rollup of 7 pull requests

Successful merges:

 - #60549 (do not print panic message on doctest failures)
 - #60885 (strip synstructure consts from compiler docs)
 - #61217 (Account for short-hand init structs when suggesting conversion)
 - #61261 (is_union returns ty to avoid computing it twice)
 - #61293 (Print const generics properly in rustdoc)
 - #61310 (split libcore::mem into multiple files)
 - #61313 (Simplify Set1::insert)

Failed merges:

r? @ghost

@bors bors merged commit 89d437e into rust-lang:master May 29, 2019

1 check passed

Travis CI - Pull Request Build Passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.