about summary refs log tree commit diff
path: root/compiler/rustc_llvm/llvm-wrapper
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2025-01-04 12:50:38 +0000
committerbors <bors@rust-lang.org>2025-01-04 12:50:38 +0000
commitfd127a3a84e3874979aa6f52acfb184e3ecce210 (patch)
treeaffac6759c02287640b9cf4a87e93a0dfc625651 /compiler/rustc_llvm/llvm-wrapper
parentf17cf744f5f757ef9dc5f45508332c75d74ffad0 (diff)
parent3cd3649c6cd370ac20e47f40bd5f210c9fe63f92 (diff)
downloadrust-fd127a3a84e3874979aa6f52acfb184e3ecce210.tar.gz
rust-fd127a3a84e3874979aa6f52acfb184e3ecce210.zip
Auto merge of #135031 - RalfJung:intrinsics-without-body, r=oli-obk
rustc_intrinsic: support functions without body

We synthesize a HIR body `loop {}` but such bodyless intrinsics.

Most of the diff is due to turning `ItemKind::Fn` into a brace (named-field) enum variant, because it carries a `bool`-typed field now. This is to remember whether the function has a body. MIR building panics to avoid ever translating the fake `loop {}` body, and the intrinsic logic uses the lack of a body to implicitly mark that intrinsic as must-be-overridden.

I first tried actually having no body rather than generating the fake body, but there's a *lot* of code that assumes that all function items have HIR and MIR, so this didn't work very well. Then I noticed that even `rustc_intrinsic_must_be_overridden` intrinsics have MIR generated (they are filled with an `Unreachable` terminator) so I guess I am not the first to discover this. ;)

r? `@oli-obk`
Diffstat (limited to 'compiler/rustc_llvm/llvm-wrapper')
0 files changed, 0 insertions, 0 deletions