Files
rust/tests/ui/consts
Matthias Krüger 8f11852e78 Rollup merge of #138679 - Shunpoco:issue-125323, r=oli-obk
Issue-125323: ICE non-ADT in struct pattern when long time constant evaluation is in for loop

This PR fixes #125323

## Context
According to the issue, the ICE happens since #121206.
In the PR, some error methods were reorganized. For example, has_errors() was renamed to has_errors_exclude_lint_errors(). However, some codes which used the original has_errors() were not switched to has_errors_exclude_lint_errors(). I finally found that report_error() in writeback.rs causes this ICE. Currently the method uses tainted_by_errors() to get guar (ErrorGuaranteed), but originally it used dcx().has_errors() but it wasn't changed to has_errors_exclude_lint_errors() when changes in #121206 were merged. I don't think I fully understand how an error is propagated, but I suppose that the error from long time constant evaluation is unexpectedly propagated other parts (in this ICE, for loop), then cause the non-ADT in struct pattern ICE.

## Change
- Fix report_error() in writeback.rs: use dcx().has_errors_exclude_lint_errors() instead of tainted_by_errors() to prevent error propagation from constant evaluation.
- Add test for the ICE
- Modify some tests to align the change: Due to this fix, E0282 error happens (or not happen anymore) in some tests.

## NOTE
The 4th commit aims to revert the fix in #123516 because I confirmed that the ICE solved by the PR doesn't happen if I modify report_error(). I think the root cause of that ICE is the same as #125323 . But I can discard this commit since we can fix #125323 without it.
2025-10-18 23:54:43 +02:00
..
2025-09-14 17:55:33 -04:00
2025-10-03 13:30:47 -04:00
2024-01-13 12:46:58 -05:00
2024-09-15 09:51:32 +02:00
2024-08-18 19:46:53 +02:00
2023-01-11 09:32:08 +00:00
2024-11-22 02:32:26 +00:00
2025-02-27 20:02:25 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2024-11-22 02:32:26 +00:00
2024-11-22 02:32:26 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2025-07-21 12:49:45 +03:00
2023-01-11 09:32:08 +00:00
2023-11-12 04:33:19 +00:00
2025-09-12 12:39:31 +03:00
2024-02-25 12:03:48 +01:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2024-04-21 15:43:43 -03:00
2024-04-21 15:43:43 -03:00
2023-04-16 11:38:52 +00:00
2023-07-27 15:51:02 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2025-07-13 13:50:01 +00:00
2023-07-27 15:51:02 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2024-12-25 10:36:32 +01:00
2025-07-21 09:11:21 +00:00
2025-07-21 09:11:21 +00:00
2023-01-11 09:32:08 +00:00
2024-10-07 16:29:52 +00:00
2025-08-05 19:34:46 +05:00
2024-09-15 09:51:32 +02:00
2025-02-23 23:11:00 +07:00
2025-09-12 14:45:12 -04:00
2023-01-11 09:32:08 +00:00
2023-01-15 19:46:20 +00:00
2025-06-13 09:20:48 +02:00
2025-06-13 09:20:48 +02:00
2024-11-16 22:50:22 +01:00
2023-01-11 09:32:08 +00:00
2023-01-11 09:32:08 +00:00
2025-01-06 17:54:59 +01:00
2025-01-06 17:54:59 +01:00
2024-09-14 18:07:06 +02:00