-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
doctest: Reset errors before dropping the parse session #81040
Conversation
r? @jyn514 (rust-highfive has picked a reviewer for you, use r? to override) |
I'll be adding a test if I can figure out how ... |
I added a test but it doesn't pass even though I added a stdout file with (I think) right contents. Details here: https://rust-lang.zulipchat.com/#narrow/stream/182449-t-compiler.2Fhelp/topic/Unable.20to.20add.20failing.20rustdoc.20test |
The first parse is to collect whether the code contains macros, has `main`, and uses other crates. In that pass we ignore errors as those will be reported when the test file is actually built. For that we need to reset errors in the `Diagnostic` otherwise when dropping it unhandled errors will be reported as compiler bugs. Fixes rust-lang#80992
I added a regression test. The test is a @jyn514 this is now ready for reviews. Thanks for the help! |
r=me with CI passing. Thanks for the fix! |
err - actually I don't think this tests anything, won't ICEs be marked as |
@jyn514 If I keep the test, but revert the fix, then the test fails with this:
Is this not good enough? |
Oh interesting, I didn't realize rustdoc treated ICEs different from compile errors. Yes, that's good enough. @bors r+ |
📌 Commit 0ef5557 has been approved by |
But the test is |
So my understanding is if a rustdoc compilation fails with ICE, then that's not considered a success for "compile_fail". I'd expect an ICE to never be considered good for compile_fail tests as I'm think the compiler should never panic. (instead fail with a good error message when things go wrong) |
The compiletest test is
Make sense to me :) |
doctest: Reset errors before dropping the parse session The first parse is to collect whether the code contains macros, has `main`, and uses other crates. In that pass we ignore errors as those will be reported when the test file is actually built. For that we need to reset errors in the `Diagnostic` otherwise when dropping it unhandled errors will be reported as compiler bugs. Fixes rust-lang#80992
doctest: Reset errors before dropping the parse session The first parse is to collect whether the code contains macros, has `main`, and uses other crates. In that pass we ignore errors as those will be reported when the test file is actually built. For that we need to reset errors in the `Diagnostic` otherwise when dropping it unhandled errors will be reported as compiler bugs. Fixes rust-lang#80992
Rollup of 17 pull requests Successful merges: - rust-lang#78455 (Introduce {Ref, RefMut}::try_map for optional projections in RefCell) - rust-lang#80144 (Remove giant badge in README) - rust-lang#80614 (Explain why borrows can't be held across yield point in async blocks) - rust-lang#80670 (TrustedRandomAaccess specialization composes incorrectly for nested iter::Zips) - rust-lang#80681 (Clarify what the effects of a 'logic error' are) - rust-lang#80764 (Re-stabilize Weak::as_ptr and friends for unsized T) - rust-lang#80901 (Make `x.py --color always` apply to logging too) - rust-lang#80902 (Add a regression test for rust-lang#76281) - rust-lang#80941 (Do not suggest invalid code in pattern with loop) - rust-lang#80968 (Stabilize the poll_map feature) - rust-lang#80971 (Put all feature gate tests under `feature-gates/`) - rust-lang#81021 (Remove doctree::Import) - rust-lang#81040 (doctest: Reset errors before dropping the parse session) - rust-lang#81060 (Add a regression test for rust-lang#50041) - rust-lang#81065 (codegen_cranelift: Fix redundant semicolon warn) - rust-lang#81069 (Add sample code for Rc::new_cyclic) - rust-lang#81081 (Add test for rust-lang#34792) Failed merges: r? `@ghost` `@rustbot` modify labels: rollup
The first parse is to collect whether the code contains macros, has
main
, and uses other crates. In that pass we ignore errors as thosewill be reported when the test file is actually built.
For that we need to reset errors in the
Diagnostic
otherwise whendropping it unhandled errors will be reported as compiler bugs.
Fixes #80992