Skip to content

Fix needless_doctest_main panic when doctest is invalid #15052

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

Merged
merged 1 commit into from
Jun 14, 2025

Conversation

profetia
Copy link
Contributor

@profetia profetia commented Jun 14, 2025

Closes #8244
Closes #15041

This feels like a bug with the compiler, because the panic happens when Diag is getting unwinded. However, drop() is already called in .cancel() so this should not happen.

In this PR, I find a workaround to just call emit(), since the DiagCtxt here is just a io::sink, nothing will happen and the panic just goes away.

changelog: [needless_doctest_main] fix panic when doctest is invalid

@rustbot
Copy link
Collaborator

rustbot commented Jun 14, 2025

r? @dswij

rustbot has assigned @dswij.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Jun 14, 2025
@dswij dswij added this pull request to the merge queue Jun 14, 2025
Merged via the queue into rust-lang:master with commit 086a7c9 Jun 14, 2025
11 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Error if there is a typo in documentation example function signature ICE on rustdoc test: delay span bug / thread::spawn failed: issue-80992.rs
3 participants