File tree Expand file tree Collapse file tree 3 files changed +64
-2
lines changed Expand file tree Collapse file tree 3 files changed +64
-2
lines changed Original file line number Diff line number Diff line change
1
+ //@ known-bug: #144293
2
+ // Same as recursion-etc but eggs LLVM emission into giving indirect arguments.
3
+ #![ expect( incomplete_features) ]
4
+ #![ feature( explicit_tail_calls) ]
5
+
6
+ use std:: hint:: black_box;
7
+
8
+ struct U64Wrapper {
9
+ pub x : u64 ,
10
+ pub arbitrary : String ,
11
+ }
12
+
13
+ fn count ( curr : U64Wrapper , top : U64Wrapper ) -> U64Wrapper {
14
+ if black_box ( curr. x ) >= top. x {
15
+ curr
16
+ } else {
17
+ become count(
18
+ U64Wrapper {
19
+ x : curr. x + 1 ,
20
+ arbitrary : curr. arbitrary ,
21
+ } ,
22
+ top,
23
+ )
24
+ }
25
+ }
26
+
27
+ fn main ( ) {
28
+ println ! (
29
+ "{}" ,
30
+ count(
31
+ U64Wrapper {
32
+ x: 0 ,
33
+ arbitrary: "hello!" . into( )
34
+ } ,
35
+ black_box( U64Wrapper {
36
+ x: 1000000 ,
37
+ arbitrary: "goodbye!" . into( )
38
+ } )
39
+ )
40
+ . x
41
+ ) ;
42
+ }
Original file line number Diff line number Diff line change 1
- // FIXME(explicit_tail_calls): enable this test once rustc_codegen_ssa supports tail calls
2
- //@ ignore-test: tail calls are not implemented in rustc_codegen_ssa yet, so this causes 🧊
3
1
//@ run-pass
4
2
#![ expect( incomplete_features) ]
5
3
#![ feature( explicit_tail_calls) ]
Original file line number Diff line number Diff line change
1
+ //@ run-pass
2
+ // Indexing taken from
3
+ // https://github.com/phi-go/rfcs/blob/guaranteed-tco/text%2F0000-explicit-tail-calls.md#tail-call-elimination
4
+ // no other test has utilized the "function table"
5
+ // described in the RFC aside from this one at this point.
6
+ #![ expect( incomplete_features) ]
7
+ #![ feature( explicit_tail_calls) ]
8
+
9
+ fn f0 ( _: usize ) { }
10
+ fn f1 ( _: usize ) { }
11
+ fn f2 ( _: usize ) { }
12
+
13
+ fn indexer ( idx : usize ) {
14
+ let v: [ fn ( usize ) ; 3 ] = [ f0, f1, f2] ;
15
+ become v[ idx] ( idx)
16
+ }
17
+
18
+ fn main ( ) {
19
+ for idx in 0 ..3 {
20
+ indexer ( idx) ;
21
+ }
22
+ }
You can’t perform that action at this time.
0 commit comments