Skip to content

Check for errors before encoding metadata - #166405

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
itsfuad:fix/166278-mentioned-items-ice
Nov 24, 2026
Merged

rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
itsfuad:fix/166278-mentioned-items-ice

Conversation

@itsfuad

@itsfuad itsfuad commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #166278

pr #165524 moved the has_errors_or_delayed_bugs check from before metadata encoding to after it. Then, for a lib crate, metadata encoding runs exported_generic_symbols, which runs mono item collection on bodies that failed const eval, like [(); loop {}], and it ICEs because mentioned_items was never set.

I moved the check back into finish_and_emit_metadata, after the test hook and before encoding, so the order is the same as before #165524. Now we only get the normal error, no panic.

Added a UI test.

cc @blyxyas @bjorn3

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Nov 23, 2026
@itsfuad
itsfuad marked this pull request as ready for review November 23, 2026 18:30
@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Nov 23, 2026
@rustbot rustbot removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Nov 23, 2026
@rustbot

rustbot commented Nov 23, 2026

Copy link
Copy Markdown
Collaborator

r? @camelid

rustbot has assigned @camelid.
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 79 candidates
  • Random selection from 22 candidates

@camelid camelid left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

r=me with comment fixed

View changes since this review

Comment thread compiler/rustc_interface/src/passes.rs Outdated
Comment on lines +912 to +914
// Don't do code generation if there were any errors. Likewise if
// there were any delayed bugs, because codegen will likely cause
// more ICEs, obscuring the original problem.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This comment needs to be updated as well since now it's about skipping metadata and codegen.

This comment was marked as outdated.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

fixed

@camelid camelid left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@camelid

camelid commented Nov 23, 2026

Copy link
Copy Markdown
Member

@bors r+ rollup

@rust-bors

rust-bors Bot commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 17b0de4 has been approved by camelid

It is now in the queue for this repository.

@rust-bors rust-bors Bot added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Nov 23, 2026
rust-bors Bot pushed a commit that referenced this pull request Nov 24, 2026
Rollup of 11 pull requests

Successful merges:

 - #165769 (Fix invalid instantiation of fake intrinsic bodies)
 - #166374 (Undo accidental duplication checking for attributes on macro calls)
 - #166386 (Replace manual `AttributeParser` construction by `parse_limited_all`)
 - #162565 (Add `c_buffer_length` lint helper)
 - #166096 (llvm-wrapper: Pass more arguments to PreCodeGenCallback)
 - #166395 (std: fix positioned read/write on VxWorks)
 - #166404 (Change `ChildExt::kill_process_group` to be `&self`)
 - #166405 (Check for errors before encoding metadata)
 - #166412 (std: Fix locking test on GNU/Hurd)
 - #166413 (std: Fix symlink chmod test on GNU/Hurd)
 - #166421 (core: Stabilize `float_bits_const`)
@rust-bors
rust-bors Bot merged commit 361eea7 into rust-lang:main Nov 24, 2026
14 checks passed
@rustbot rustbot added this to the 1.102.0 milestone Nov 24, 2026
rust-bors Bot pushed a commit that referenced this pull request Nov 24, 2026
Rollup merge of #166405 - itsfuad:fix/166278-mentioned-items-ice, r=camelid

Check for errors before encoding metadata

Fixes #166278

pr #165524 moved the `has_errors_or_delayed_bugs` check from before metadata encoding to after it. Then, for a lib crate, metadata encoding runs `exported_generic_symbols`, which runs mono item collection on bodies that failed const eval, like `[(); loop {}]`, and it ICEs because `mentioned_items` was never set.

I moved the check back into `finish_and_emit_metadata`, after the test hook and before encoding, so the order is the same as before #165524. Now we only get the normal error, no panic.

Added a UI test.

cc @blyxyas @bjorn3
flip1995 pushed a commit to flip1995/rust-clippy that referenced this pull request Nov 26, 2026
Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#165769 (Fix invalid instantiation of fake intrinsic bodies)
 - rust-lang/rust#166374 (Undo accidental duplication checking for attributes on macro calls)
 - rust-lang/rust#166386 (Replace manual `AttributeParser` construction by `parse_limited_all`)
 - rust-lang/rust#162565 (Add `c_buffer_length` lint helper)
 - rust-lang/rust#166096 (llvm-wrapper: Pass more arguments to PreCodeGenCallback)
 - rust-lang/rust#166395 (std: fix positioned read/write on VxWorks)
 - rust-lang/rust#166404 (Change `ChildExt::kill_process_group` to be `&self`)
 - rust-lang/rust#166405 (Check for errors before encoding metadata)
 - rust-lang/rust#166412 (std: Fix locking test on GNU/Hurd)
 - rust-lang/rust#166413 (std: Fix symlink chmod test on GNU/Hurd)
 - rust-lang/rust#166421 (core: Stabilize `float_bits_const`)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

[ICE]: mentioned_items for DefId have not yet been set

3 participants