Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 9cc3bc6

Browse files
committedAug 5, 2024
custom MIR: add support for tail calls
1 parent 5674d1c commit 9cc3bc6

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed
 

‎core/src/intrinsics/mir.rs

+8
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,8 @@
247247
//! otherwise branch.
248248
//! - [`Call`] has an associated function as well, with special syntax:
249249
//! `Call(ret_val = function(arg1, arg2, ...), ReturnTo(next_block), UnwindContinue())`.
250+
//! - [`TailCall`] does not have a return destination or next block, so its syntax is just
251+
//! `TailCall(function(arg1, arg2, ...))`.
250252
251253
#![unstable(
252254
feature = "custom_mir",
@@ -350,6 +352,12 @@ define!("mir_call",
350352
/// - [`UnwindCleanup`]
351353
fn Call(call: (), goto: ReturnToArg, unwind_action: UnwindActionArg)
352354
);
355+
define!("mir_tail_call",
356+
/// Call a function.
357+
///
358+
/// The argument must be of the form `fun(arg1, arg2, ...)`.
359+
fn TailCall<T>(call: T)
360+
);
353361
define!("mir_unwind_resume",
354362
/// A terminator that resumes the unwinding.
355363
fn UnwindResume()

0 commit comments

Comments
 (0)
Failed to load comments.