Files
rust/tests/ui/parser
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
..
2024-12-08 15:32:04 +08:00
2024-10-28 14:20:28 +11:00
2024-11-24 19:42:33 +01:00
2024-12-21 03:02:07 +00:00
2024-10-30 16:47:47 -07:00
2024-12-10 11:34:13 +08:00
2024-11-29 06:10:15 +11:00
2024-11-16 20:03:31 +00:00
2024-10-11 11:30:08 -04:00
2024-11-29 06:10:15 +11:00
2024-04-21 15:43:43 -03:00
2024-04-21 15:43:43 -03:00
2024-04-21 15:43:43 -03:00
2024-04-21 15:43:43 -03:00
2024-11-24 19:42:33 +01:00
2024-11-24 19:42:33 +01:00
2024-09-21 20:07:52 +03:00