-
Notifications
You must be signed in to change notification settings - Fork 13.3k
doctests: Assertion panic message is escaped and is unreadable terrible on 2024 edition. #137970
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
Comments
Hi, I'm experiencing the same issue since migrating to Rust edition 2024. Notes:
Impact:
My setup:
|
Marking this issue as a high priority item. CC @rust-lang/rustdoc |
Gonna take a look tomorrow. |
Finally figured out what went wrong. Cleaning up then sending the fix. |
Opened #139328. |
This now affects stable/beta.
|
…7970, r=fmease Fix 2024 edition doctest panic output Fixes rust-lang#137970. The problem was that the output was actually displayed by rustc itself because we're exiting with `Result<(), String>`, and the display is really not great. So instead, we get the output, we print it and then we return an `ExitCode`. r? `@aDotInTheVoid`
…7970, r=fmease Fix 2024 edition doctest panic output Fixes rust-lang#137970. The problem was that the output was actually displayed by rustc itself because we're exiting with `Result<(), String>`, and the display is really not great. So instead, we get the output, we print it and then we return an `ExitCode`. r? ``@aDotInTheVoid``
…7970, r=fmease Fix 2024 edition doctest panic output Fixes rust-lang#137970. The problem was that the output was actually displayed by rustc itself because we're exiting with `Result<(), String>`, and the display is really not great. So instead, we get the output, we print it and then we return an `ExitCode`. r? ```@aDotInTheVoid```
Rollup merge of rust-lang#139328 - GuillaumeGomez:fix-panic-output-137970, r=fmease Fix 2024 edition doctest panic output Fixes rust-lang#137970. The problem was that the output was actually displayed by rustc itself because we're exiting with `Result<(), String>`, and the display is really not great. So instead, we get the output, we print it and then we return an `ExitCode`. r? ````@aDotInTheVoid````
(cherry picked from commit fff2484)
Hi, I don't know if you're aware of this, but there's still an issue with the output. Let's see an example:
Let's run the regular test:
As we can see, the test's stdout was correctly printed as always.
This breaks our custom assert macros, which output a diff on failure and still print the data on success for clarity and context in case of consecutive assertions. |
Indeed, stdout should have been kept. Opening an issue and sending a fix. |
I tried this code:
Running the doctests gives a terrible error message:
It should instead format the assertion error well, like it does on edition=2015
It works as expected on beta/stable
Possibly releated: https://users.rust-lang.org/t/question-about-doctest-speedup-in-rust-2024-edition/126431 / #137898
CC @notriddle @GuillaumeGomez
The text was updated successfully, but these errors were encountered: