about summary refs log tree commit diff
path: root/tests/ui
diff options
context:
space:
mode:
authorash <ashkernel02@gmail.com>2025-08-06 18:13:56 -0600
committerash <ashkernel02@gmail.com>2025-08-06 18:13:56 -0600
commit916fb6a464390cd99ea87ee39f2406cc4b511787 (patch)
treeaa63e7276dbe90584c26cf2a3e3120669b079acb /tests/ui
parent7cd950546b4ce68843b4cbdb1ab3a43776202d3a (diff)
downloadrust-916fb6a464390cd99ea87ee39f2406cc4b511787.tar.gz
rust-916fb6a464390cd99ea87ee39f2406cc4b511787.zip
explicit tail call tests with indirect operands in LLVM, small test for indexing into a function table as described by RFC 3407
Diffstat (limited to 'tests/ui')
-rw-r--r--tests/ui/explicit-tail-calls/drop-order.rs2
-rw-r--r--tests/ui/explicit-tail-calls/indexer.rs22
2 files changed, 22 insertions, 2 deletions
diff --git a/tests/ui/explicit-tail-calls/drop-order.rs b/tests/ui/explicit-tail-calls/drop-order.rs
index 242336be484..58e1afbdf0c 100644
--- a/tests/ui/explicit-tail-calls/drop-order.rs
+++ b/tests/ui/explicit-tail-calls/drop-order.rs
@@ -1,5 +1,3 @@
-// FIXME(explicit_tail_calls): enable this test once rustc_codegen_ssa supports tail calls
-//@ ignore-test: tail calls are not implemented in rustc_codegen_ssa yet, so this causes 🧊
 //@ run-pass
 #![expect(incomplete_features)]
 #![feature(explicit_tail_calls)]
diff --git a/tests/ui/explicit-tail-calls/indexer.rs b/tests/ui/explicit-tail-calls/indexer.rs
new file mode 100644
index 00000000000..5644506b2f5
--- /dev/null
+++ b/tests/ui/explicit-tail-calls/indexer.rs
@@ -0,0 +1,22 @@
+//@ run-pass
+// Indexing taken from
+// https://github.com/phi-go/rfcs/blob/guaranteed-tco/text%2F0000-explicit-tail-calls.md#tail-call-elimination
+// no other test has utilized the "function table"
+// described in the RFC aside from this one at this point.
+#![expect(incomplete_features)]
+#![feature(explicit_tail_calls)]
+
+fn f0(_: usize) {}
+fn f1(_: usize) {}
+fn f2(_: usize) {}
+
+fn indexer(idx: usize) {
+    let v: [fn(usize); 3] = [f0, f1, f2];
+    become v[idx](idx)
+}
+
+fn main() {
+    for idx in 0..3 {
+        indexer(idx);
+    }
+}