Files
rust/tests/ui/consts
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-09-15 10:20:47 +02:00
2024-01-13 12:46:58 -05:00
2024-11-03 18:59:31 +00:00
2024-09-15 09:51:32 +02:00
2024-08-18 19:46:53 +02:00
2024-02-07 10:42:01 +08:00
2024-11-22 02:32:26 +00:00
2024-11-22 02:32:26 +00:00
2024-11-22 02:32:26 +00:00
2024-11-22 02:32:26 +00:00
2024-10-12 17:07:13 -04:00
2024-10-12 17:07:13 -04:00
2023-11-12 04:33:19 +00:00
2024-01-13 12:46:58 -05:00
2024-02-25 12:03:48 +01: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
2023-07-27 15:51:02 +00:00
2023-07-27 15:51:02 +00:00
2024-12-25 10:36:32 +01:00
2024-04-24 13:12:33 +01:00
2023-10-08 10:06:17 +00:00
2024-10-07 16:29:52 +00:00
2024-09-15 09:51:32 +02:00
2024-11-01 16:53:36 +08:00
2024-11-16 22:50:22 +01:00
2024-09-14 18:07:06 +02:00
2024-01-13 12:46:58 -05:00