rust/compiler/rustc_hir/src
bors fd127a3a84 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`
2025-01-04 12:50:38 +00:00
..
arena.rs Add hir::Attribute 2024-12-15 19:18:46 +01:00
def_path_hash_map.rs Do not store stable crate id in on-disk hash map. 2023-12-24 17:22:48 +00:00
def.rs Remove more traces of anonymous ADTs 2024-12-10 19:50:47 +00:00
definitions.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
diagnostic_items.rs Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
hir_id.rs Reformat using the new identifier sorting from rustfmt 2024-09-22 19:11:29 -04:00
hir.rs Auto merge of #135031 - RalfJung:intrinsics-without-body, r=oli-obk 2025-01-04 12:50:38 +00:00
intravisit.rs turn hir::ItemKind::Fn into a named-field variant 2025-01-04 11:35:31 +01:00
lang_items.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
lib.rs dont regenerate new links for rexports 2024-09-20 21:49:37 +08:00
pat_util.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00
stable_hash_impls.rs Add hir::Attribute 2024-12-15 19:18:46 +01:00
target.rs turn hir::ItemKind::Fn into a named-field variant 2025-01-04 11:35:31 +01:00
tests.rs allow symbol_intern_string_literal lint in test modules 2024-12-11 20:38:55 +03:00
weak_lang_items.rs Re-export more rustc_span::symbol things from rustc_span. 2024-12-18 13:38:53 +11:00