Skip to content

Encode direct const mir - #166435

Merged
rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
bit-aloo:2026-11-24-encode-direct-const-mir
Nov 27, 2026
Merged

rust-bors[bot] merged 2 commits into
rust-lang:mainfrom
bit-aloo:2026-11-24-encode-direct-const-mir

Conversation

@bit-aloo

Copy link
Copy Markdown
Member

closes: #166409

For mir_for_ctfe we have two paths. One is for a const in the crate we are compiling. there we build the mir body ourselves, and if it's a direct const we synthesize it on the fly and continue. The other is for a const from another crate, there we don't build anything, we just look the body up in that crate's rmeta. For direct consts we were never storing that final mir body in the rmeta. So when a downstream crate used one as a value, the lookup found nothing and we 🧊 'd. So, now we are adding direct consts to mir_keys, so the encoder writes it in rmeta and it works

r? @khyperia

@rustbot

rustbot commented Nov 24, 2026

Copy link
Copy Markdown
Collaborator

Some changes occurred to MIR optimizations

cc @rust-lang/wg-mir-opt

@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 Nov 24, 2026
@khyperia

Copy link
Copy Markdown
Member

@bors r+ rollup

@rust-bors

rust-bors Bot commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

📌 Commit 707ca02 has been approved by khyperia

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 26, 2026
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Nov 26, 2026
…const-mir, r=khyperia

Encode direct const mir

closes: rust-lang#166409

For mir_for_ctfe we have two paths. One is for a const in the crate we are compiling. there we build the mir body ourselves, and if it's a direct const we synthesize it on the fly and continue. The other is for a const from another crate, there we don't build anything, we just look the body up in that crate's rmeta. For direct consts we were never storing that final mir body in the rmeta. So when a downstream crate used one as a value, the lookup found nothing and we 🧊 'd. So, now we are adding direct consts to mir_keys, so the encoder writes it in rmeta and it works

r? @khyperia
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Nov 26, 2026
…const-mir, r=khyperia

Encode direct const mir

closes: rust-lang#166409

For mir_for_ctfe we have two paths. One is for a const in the crate we are compiling. there we build the mir body ourselves, and if it's a direct const we synthesize it on the fly and continue. The other is for a const from another crate, there we don't build anything, we just look the body up in that crate's rmeta. For direct consts we were never storing that final mir body in the rmeta. So when a downstream crate used one as a value, the lookup found nothing and we 🧊 'd. So, now we are adding direct consts to mir_keys, so the encoder writes it in rmeta and it works

r? @khyperia
rust-bors Bot pushed a commit that referenced this pull request Nov 26, 2026
…uwer

Rollup of 14 pull requests

Successful merges:

 - #166235 (Keep opening '(' when suggesting to remove '&' from pattern)
 - #166516 (Fix ICE in iterator method suggestion when the receiver is a block)
 - #166586 (abby test dsl: one binder to rule them all)
 - #164289 (Add regression test for self-referential GAT with missing lifetime argument)
 - #165859 (Add codegen test for MaybeUninit array built in the return slot)
 - #166092 (add fake borrow tests for divergent match guards)
 - #166292 (Don't suggest closure braces for errors inside the body)
 - #166435 (Encode direct const mir)
 - #166447 (Document allocator behaviour of BTreeMap::append and BTreeSet::append)
 - #166558 (triagebot: Send "in progress" message when nomination is in progress pt. 2)
 - #166574 (bump libffi)
 - #166584 (Arg pos const mismatch ice)
 - #166599 (add alias-bound test)
 - #166606 (llvm-wrapper: Pass LibraryOptionsContext to computeDeadSymbolsWithConstProp etc.)

Failed merges:

 - #166583 (abby dsl tests: the passing test should check-pass)
JonathanBrouwer added a commit to JonathanBrouwer/rust that referenced this pull request Nov 26, 2026
…const-mir, r=khyperia

Encode direct const mir

closes: rust-lang#166409

For mir_for_ctfe we have two paths. One is for a const in the crate we are compiling. there we build the mir body ourselves, and if it's a direct const we synthesize it on the fly and continue. The other is for a const from another crate, there we don't build anything, we just look the body up in that crate's rmeta. For direct consts we were never storing that final mir body in the rmeta. So when a downstream crate used one as a value, the lookup found nothing and we 🧊 'd. So, now we are adding direct consts to mir_keys, so the encoder writes it in rmeta and it works

r? @khyperia
rust-bors Bot pushed a commit that referenced this pull request Nov 26, 2026
…uwer

Rollup of 17 pull requests

Successful merges:

 - #165572 (Run the `FatLtoCleanup` pass to lower `llvm.type.checked.load`)
 - #166235 (Keep opening '(' when suggesting to remove '&' from pattern)
 - #166516 (Fix ICE in iterator method suggestion when the receiver is a block)
 - #166586 (abby test dsl: one binder to rule them all)
 - #166604 (fix: embed-source-dwarf test with remapped debuginfo)
 - #166620 (Change wording of overwrite span in `unused_assignments` lint)
 - #164289 (Add regression test for self-referential GAT with missing lifetime argument)
 - #165859 (Add codegen test for MaybeUninit array built in the return slot)
 - #166092 (add fake borrow tests for divergent match guards)
 - #166292 (Don't suggest closure braces for errors inside the body)
 - #166435 (Encode direct const mir)
 - #166447 (Document allocator behaviour of BTreeMap::append and BTreeSet::append)
 - #166558 (triagebot: Send "in progress" message when nomination is in progress pt. 2)
 - #166584 (Arg pos const mismatch ice)
 - #166599 (add alias-bound test)
 - #166606 (llvm-wrapper: Pass LibraryOptionsContext to computeDeadSymbolsWithConstProp etc.)
 - #166623 (Correct feature name for `is_cased()` method)

Failed merges:

 - #166583 (abby dsl tests: the passing test should check-pass)
rust-bors Bot pushed a commit that referenced this pull request Nov 27, 2026
Rollup of 20 pull requests

Successful merges:

 - #164161 (`-Znext-solver` Support a bit more types for rustdoc auto traits)
 - #165572 (Run the `FatLtoCleanup` pass to lower `llvm.type.checked.load`)
 - #166235 (Keep opening '(' when suggesting to remove '&' from pattern)
 - #166335 (A few fixes in x86 std_detect)
 - #166516 (Fix ICE in iterator method suggestion when the receiver is a block)
 - #166586 (abby test dsl: one binder to rule them all)
 - #166604 (fix: embed-source-dwarf test with remapped debuginfo)
 - #166620 (Change wording of overwrite span in `unused_assignments` lint)
 - #166626 (Remove some outdated comments about None terminator)
 - #164289 (Add regression test for self-referential GAT with missing lifetime argument)
 - #165859 (Add codegen test for MaybeUninit array built in the return slot)
 - #166092 (add fake borrow tests for divergent match guards)
 - #166292 (Don't suggest closure braces for errors inside the body)
 - #166435 (Encode direct const mir)
 - #166447 (Document allocator behaviour of BTreeMap::append and BTreeSet::append)
 - #166558 (triagebot: Send "in progress" message when nomination is in progress pt. 2)
 - #166584 (Arg pos const mismatch ice)
 - #166599 (add alias-bound test)
 - #166606 (llvm-wrapper: Pass LibraryOptionsContext to computeDeadSymbolsWithConstProp etc.)
 - #166623 (Correct feature name for `is_cased()` method)

Failed merges:

 - #166583 (abby dsl tests: the passing test should check-pass)
@rust-bors
rust-bors Bot merged commit 16b672b into rust-lang:main Nov 27, 2026
14 checks passed
@rustbot rustbot added this to the 1.102.0 milestone Nov 27, 2026
rust-bors Bot pushed a commit that referenced this pull request Nov 27, 2026
Rollup merge of #166435 - bit-aloo:2026-11-24-encode-direct-const-mir, r=khyperia

Encode direct const mir

closes: #166409

For mir_for_ctfe we have two paths. One is for a const in the crate we are compiling. there we build the mir body ourselves, and if it's a direct const we synthesize it on the fly and continue. The other is for a const from another crate, there we don't build anything, we just look the body up in that crate's rmeta. For direct consts we were never storing that final mir body in the rmeta. So when a downstream crate used one as a value, the lookup found nothing and we 🧊 'd. So, now we are adding direct consts to mir_keys, so the encoder writes it in rmeta and it works

r? @khyperia
@bit-aloo
bit-aloo deleted the 2026-11-24-encode-direct-const-mir branch November 27, 2026 06:27
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]: DefId(20:3 ~ up[3832]::N) does not have a "mir_for_ctfe"

3 participants