Skip to content

Make post-monomorphization error detection work with fatal errors#153194

Open
Zoxc wants to merge 2 commits intorust-lang:mainfrom
Zoxc:post-mono-fatal
Open

Make post-monomorphization error detection work with fatal errors#153194
Zoxc wants to merge 2 commits intorust-lang:mainfrom
Zoxc:post-mono-fatal

Conversation

@Zoxc
Copy link
Contributor

@Zoxc Zoxc commented Feb 27, 2026

This makes post-monomorphization error detection work with fatal errors by using defer so it can catch fatal errors too.

Found this while working on making cycle errors fatal.

cc @lqd @oli-obk

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Feb 27, 2026
@rustbot
Copy link
Collaborator

rustbot commented Feb 27, 2026

r? @JonathanBrouwer

rustbot has assigned @JonathanBrouwer.
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

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 69 candidates
  • Random selection from 16 candidates

@JonathanBrouwer
Copy link
Contributor

JonathanBrouwer commented Mar 2, 2026

@rustbot reroll
Not familiar with this code and a bit too busy to change that

@rustbot rustbot assigned jieyouxu and unassigned JonathanBrouwer Mar 2, 2026
@jieyouxu
Copy link
Member

jieyouxu commented Mar 2, 2026

@rustbot reroll

@rustbot rustbot assigned chenyukang and unassigned jieyouxu Mar 2, 2026
@chenyukang
Copy link
Member

@rustbot reroll

@rustbot rustbot assigned davidtwco and unassigned chenyukang Mar 3, 2026
Copy link
Contributor

@nnethercote nnethercote left a comment

Choose a reason for hiding this comment

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

The main problem is that most of the additional error messages aren't useful. They just repeat the previous error. E.g. this error:

error: reached the recursion limit while instantiating `generic::<Option<Option<Option<Option<...>>>>>`
  --> $DIR/infinite-function-recursion-error-8727.rs:9:5

is augmented with this note:

note: the above error was encountered while instantiating `fn generic::<Option<Option<Option<Option<...>>>>>`
  --> $DIR/infinite-function-recursion-error-8727.rs:9:5

There are a couple of exceptions, but it's not clear to me that the potential benefit in those exception cases are outweighed by the duplication in the common cases.

View changes since this review

//
// FIXME: don't rely on global state, instead bubble up errors. Note: this is very hard to do.
// FIXME: This detection can have false positives with the parallel compiler.
// FIXME: The notes may not be right after the original error with the parallel compiler.
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you documenting existing behaviours, or are these new behaviours?

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. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants