Skip to content

Conversation

ManojJiSharma
Copy link

@ManojJiSharma ManojJiSharma commented Sep 29, 2025

Add regression test for issue #147146 (ICE)

This PR adds a minimal UI test reproducing the ICE triggered by using typeof in an impl:
impl typeof(|| {}) {}

The compiler currently panics with an internal compiler error (ICE) when compiling this code.

This test ensures that future fixes to the compiler can be validated against this specific scenario.

Note: This PR does not fix the ICE itself; it only provides a regression test.

References: rust-lang#147146

@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 Sep 29, 2025
@rustbot
Copy link
Collaborator

rustbot commented Sep 29, 2025

r? @davidtwco

rustbot has assigned @davidtwco.
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
Copy link
Collaborator

rustbot commented Sep 29, 2025

⚠️ Warning ⚠️

  • There are issue links (such as #123) in the commit messages of the following commits.
    Please move them to the PR description, to avoid spamming the issues with references to the commit, and so this bot can automatically canonicalize them to avoid issues with subtree.

@rust-log-analyzer
Copy link
Collaborator

The job tidy failed! Check out the build log: (web) (plain enhanced) (plain)

Click to see the possible cause of the failure (guessed by this bot)
[TIMING:end] tool::Tidy { compiler: Compiler { stage: 0, host: x86_64-unknown-linux-gnu, forced_compiler: false }, target: x86_64-unknown-linux-gnu } -- 0.000
fmt check
fmt: checked 6433 files
tidy check
tidy [ui_tests (tests)]: ui tests should be added under meaningful subdirectories: `/checkout/tests/ui/typeof-reserved-ice.rs`
tidy [ui_tests (tests)]: FAIL
tidy [rustdoc_json (src)]: `rustdoc-json-types` modified, checking format version
tidy: Skipping binary file check, read-only filesystem
removing old virtual environment
creating virtual environment at '/checkout/obj/build/venv' using 'python3.10' and 'venv'
creating virtual environment at '/checkout/obj/build/venv' using 'python3.10' and 'virtualenv'
---
info: ES-Check: there were no ES version matching errors!  🎉
typechecking javascript files
tidy: The following check failed: ui_tests (tests)
Bootstrap failed while executing `test src/tools/tidy tidyselftest --extra-checks=py,cpp,js,spellcheck`
Command `/checkout/obj/build/x86_64-unknown-linux-gnu/stage1-tools-bin/rust-tidy /checkout /checkout/obj/build/x86_64-unknown-linux-gnu/stage0/bin/cargo /checkout/obj/build 4 /node/bin/npm --extra-checks=py,cpp,js,spellcheck` failed with exit code 1
Created at: src/bootstrap/src/core/build_steps/tool.rs:1549:23
Executed at: src/bootstrap/src/core/build_steps/test.rs:1280:29

Command has failed. Rerun with -v to see more details.
Build completed unsuccessfully in 0:03:18
  local time: Mon Sep 29 17:48:09 UTC 2025
  network time: Mon, 29 Sep 2025 17:48:09 GMT
##[error]Process completed with exit code 1.
Post job cleanup.

@Kivooeo
Copy link
Member

Kivooeo commented Sep 29, 2025

Hi, thanks for your pull request

To get the CI checks to pass, could you please move your test file into a subdirectory under tests/ui/? Our test suite requires that all ui tests be organized in subdirectories rather than placed directly at the root level

Let me know if you have any questions!

Comment on lines +1 to +2
// check-pass
// compile-flags: --error-format=short
Copy link
Member

Choose a reason for hiding this comment

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

Problem: this is outdated syntax

// `typeof` is reserved but not implemented.
// This should produce a normal error, not ICE.

impl typeof(|| {}) {}
Copy link
Member

Choose a reason for hiding this comment

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

Question: what's the point of this regression test...? This test cannot possibly pass if the ICE isn't fixed

@jieyouxu
Copy link
Member

I'm going to close this PR because this regression test should just be included in the PR that actually fixes the ICE. Thanks for the interest.

@jieyouxu jieyouxu closed this Sep 30, 2025
@rustbot rustbot removed the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

6 participants