summaryrefslogtreecommitdiff
path: root/compiler/rustc_fs_util
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-12-01 10:40:10 +0000
committerbors <bors@rust-lang.org>2022-12-01 10:40:10 +0000
commit9c0bc3028a575eece6d4e8fbc6624cb95b9c9893 (patch)
treefcd64011f689d41405fe4dccda56728d0e65a029 /compiler/rustc_fs_util
parentd6c4de0fb22fe8f3cc5a27e94b6b6d88fb504a91 (diff)
parent5a34dbf193ac8cfb7dbe53b354614f2622f5682c (diff)
downloadrust-9c0bc3028a575eece6d4e8fbc6624cb95b9c9893.tar.gz
Auto merge of #104975 - JakobDegen:custom_mir_let, r=oli-obk
`#![custom_mir]`: Various improvements This PR makes a bunch of improvements to `#![custom_mir]`. Ideally this would be 4 PRs, one for each commit, but those would take forever to get merged and be a pain to juggle. Should still be reviewed one commit at a time though. ### Commit 1: Support arbitrary `let` Before this change, all locals used in the body need to be declared at the top of the `mir!` invocation, which is rather annoying. We attempt to change that. Unfortunately, we still have the requirement that the output of the `mir!` macro must resolve, typecheck, etc. Because of that, we can't just accept this in the THIR -> MIR parser because something like ```rust { let x = 0; Goto(other) } other = { RET = x; Return() } ``` will fail to resolve. Instead, the implementation does macro shenanigans to find the let declarations and extract them as part of the `mir!` macro. That *works*, but it is fairly complicated and degrades debuginfo by quite a bit. Specifically, the spans for any statements and declarations that are affected by this are completely wrong. My guess is that this is a net improvement though. One way to recover some of the debuginfo would be to not support type annotations in the `let` statements, which would allow us to parse like `let $stmt:stmt`. That seems quite surprising though. ### Commit 2: Parse consts Reuses most of the const parsing from regular Mir building for building custom mir ### Commit 3: Parse statics Statics are slightly weird because the Mir primitive associated with them is a reference/pointer to them, so this is factored out separately. ### Commit 4: Fix some spans A bunch of the spans were non-ideal, so we adjust them to be much more helpful. r? `@oli-obk`
Diffstat (limited to 'compiler/rustc_fs_util')
0 files changed, 0 insertions, 0 deletions