Skip to content

Conversation

@Human9000-bit
Copy link
Contributor

@Human9000-bit Human9000-bit commented Jan 18, 2026

Fixes #151126

  • add failing test
  • fix: additional check whether const array could be printed as raw bytes

As I figured out, the problem was in pretty_print_const_valtree, where it tried to print unevaluated consts as if they were evaluated, which resulted in ICE.

@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 Jan 18, 2026
@rustbot
Copy link
Collaborator

rustbot commented Jan 18, 2026

r? @fee1-dead

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

@BoxyUwU
Copy link
Member

BoxyUwU commented Jan 18, 2026

r? BoxyUwU

@rustbot rustbot assigned BoxyUwU and unassigned fee1-dead Jan 18, 2026
@BoxyUwU
Copy link
Member

BoxyUwU commented Jan 19, 2026

@rustbot author

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 19, 2026
@rustbot
Copy link
Collaborator

rustbot commented Jan 19, 2026

Reminder, once the PR becomes ready for a review, use @rustbot ready.

@Human9000-bit
Copy link
Contributor Author

@rustbot ready

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jan 21, 2026
@Human9000-bit
Copy link
Contributor Author

Human9000-bit commented Jan 21, 2026

Alright, try_to_raw_bytes seems working now, at least none of examples ICEs.

@BoxyUwU
Copy link
Member

BoxyUwU commented Jan 21, 2026

I think you didn't push your local changes ^^

@Human9000-bit
Copy link
Contributor Author

Human9000-bit commented Jan 21, 2026

That's right, because I am confused abt test's error message:

stderr [ui] tests/ui/const-generics/mgca/wrong_type_const_arr_diag.rs ... F

failures:

---- [ui] tests/ui/const-generics/mgca/wrong_type_const_arr_diag.rs stdout ----
Saved the actual stderr to /home/human9000/contributions/rust/build/x86_64-unknown-linux-gnu/test/ui/const-generics/mgca/wrong_type_const_arr_diag/wrong_type_const_arr_diag.stderr
normalized stderr:
error[E0308]: mismatched types
--> $DIR/wrong_type_const_arr_diag.rs:7:32
|
LL | let _: TakesArr<{ [N] }> = TakesArr::<{ [1] }>;
| ----------------- ^^^^^^^^^^^^^^^^^^^ expected [N], found *b"\x01"
| |
| expected due to this
|
= note: expected struct TakesArr<[N]>
found struct TakesArr<*b"\x01">

error: aborting due to 1 previous error

For more information about this error, try rustc --explain E0308.

note: expected struct TakesArr<[N]>

found struct TakesArr<*b"\x01">

Is that expected error message?

@rust-log-analyzer

This comment has been minimized.

@rust-log-analyzer

This comment has been minimized.

@Human9000-bit Human9000-bit force-pushed the const-array-mir-dump-fix branch from 054805e to f0205aa Compare January 21, 2026 17:13
@Human9000-bit
Copy link
Contributor Author

that's fine, just had to re-bless tests

@Human9000-bit
Copy link
Contributor Author

@BoxyUwU , I guess we are ready to merge

@BoxyUwU
Copy link
Member

BoxyUwU commented Jan 22, 2026

can you squash your commits

@Human9000-bit Human9000-bit force-pushed the const-array-mir-dump-fix branch from f0205aa to ff97a6a Compare January 22, 2026 10:07
@Human9000-bit
Copy link
Contributor Author

✔️

@BoxyUwU
Copy link
Member

BoxyUwU commented Jan 22, 2026

@bors r+ rollup

@rust-bors
Copy link
Contributor

rust-bors bot commented Jan 22, 2026

📌 Commit ff97a6a has been approved by BoxyUwU

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 Jan 22, 2026
@BoxyUwU BoxyUwU changed the title MGCA: Fix incorrect MIR const array printing MGCA: Fix incorrect pretty printing of valtree arrays Jan 22, 2026
rust-bors bot pushed a commit that referenced this pull request Jan 22, 2026
…uwer

Rollup of 11 pull requests

Successful merges:

 - #151001 (rustdoc: render doc(hidden) as a code attribute)
 - #151042 (fix fallback impl for select_unpredictable intrinsic)
 - #151220 (option: Use Option::map in Option::cloned)
 - #151260 (Handle unevaluated ConstKind in in_operand)
 - #151296 (MGCA: Fix incorrect pretty printing of valtree arrays)
 - #151423 (Move assert_matches to planned stable path)
 - #151441 (Fix ICE: Don't try to evaluate type_consts when eagerly collecting items)
 - #151465 (codegen: clarify some variable names around function calls)
 - #151468 (fix `f16` doctest FIXMEs)
 - #151469 (llvm: Tolerate dead_on_return attribute changes)
 - #151476 (Avoid `-> ()` in derived functions.)

r? @ghost
rust-bors bot pushed a commit that referenced this pull request Jan 22, 2026
…uwer

Rollup of 11 pull requests

Successful merges:

 - #151001 (rustdoc: render doc(hidden) as a code attribute)
 - #151042 (fix fallback impl for select_unpredictable intrinsic)
 - #151220 (option: Use Option::map in Option::cloned)
 - #151260 (Handle unevaluated ConstKind in in_operand)
 - #151296 (MGCA: Fix incorrect pretty printing of valtree arrays)
 - #151423 (Move assert_matches to planned stable path)
 - #151441 (Fix ICE: Don't try to evaluate type_consts when eagerly collecting items)
 - #151465 (codegen: clarify some variable names around function calls)
 - #151468 (fix `f16` doctest FIXMEs)
 - #151469 (llvm: Tolerate dead_on_return attribute changes)
 - #151476 (Avoid `-> ()` in derived functions.)

r? @ghost
rust-bors bot pushed a commit that referenced this pull request Jan 22, 2026
…uwer

Rollup of 11 pull requests

Successful merges:

 - #151001 (rustdoc: render doc(hidden) as a code attribute)
 - #151042 (fix fallback impl for select_unpredictable intrinsic)
 - #151220 (option: Use Option::map in Option::cloned)
 - #151260 (Handle unevaluated ConstKind in in_operand)
 - #151296 (MGCA: Fix incorrect pretty printing of valtree arrays)
 - #151423 (Move assert_matches to planned stable path)
 - #151441 (Fix ICE: Don't try to evaluate type_consts when eagerly collecting items)
 - #151465 (codegen: clarify some variable names around function calls)
 - #151468 (fix `f16` doctest FIXMEs)
 - #151469 (llvm: Tolerate dead_on_return attribute changes)
 - #151476 (Avoid `-> ()` in derived functions.)

r? @ghost
@rust-bors rust-bors bot merged commit 96a40e9 into rust-lang:main Jan 22, 2026
11 checks passed
@rustbot rustbot added this to the 1.95.0 milestone Jan 22, 2026
rust-timer added a commit that referenced this pull request Jan 22, 2026
Rollup merge of #151296 - Human9000-bit:const-array-mir-dump-fix, r=BoxyUwU

MGCA: Fix incorrect pretty printing of valtree arrays

Fixes #151126

- **add failing test**
- **fix: additional check whether const array could be printed as raw bytes**

As I figured out, the problem was in `pretty_print_const_valtree`, where it tried to print unevaluated consts as if they were evaluated, which resulted in ICE.
github-actions bot pushed a commit to rust-lang/miri that referenced this pull request Jan 23, 2026
…uwer

Rollup of 11 pull requests

Successful merges:

 - rust-lang/rust#151001 (rustdoc: render doc(hidden) as a code attribute)
 - rust-lang/rust#151042 (fix fallback impl for select_unpredictable intrinsic)
 - rust-lang/rust#151220 (option: Use Option::map in Option::cloned)
 - rust-lang/rust#151260 (Handle unevaluated ConstKind in in_operand)
 - rust-lang/rust#151296 (MGCA: Fix incorrect pretty printing of valtree arrays)
 - rust-lang/rust#151423 (Move assert_matches to planned stable path)
 - rust-lang/rust#151441 (Fix ICE: Don't try to evaluate type_consts when eagerly collecting items)
 - rust-lang/rust#151465 (codegen: clarify some variable names around function calls)
 - rust-lang/rust#151468 (fix `f16` doctest FIXMEs)
 - rust-lang/rust#151469 (llvm: Tolerate dead_on_return attribute changes)
 - rust-lang/rust#151476 (Avoid `-> ()` in derived functions.)

r? @ghost
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 with --emit=mir : expected ConstKind::Value, got X/#0

5 participants