File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed
tests/ui/explicit-tail-calls Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change 1+ #![ feature( explicit_tail_calls) ]
2+ #![ expect( incomplete_features) ]
3+
4+ // Regression test for https://github.com/rust-lang/rust/issues/139305.
5+ //
6+ // Combining return position impl trait (RPIT) with guaranteed tail calls does not
7+ // currently work, but at least it does not ICE.
8+
9+ fn foo ( x : u32 , y : u32 ) -> u32 {
10+ x + y
11+ }
12+
13+ fn bar ( x : u32 , y : u32 ) -> impl ToString {
14+ become foo( x, y) ;
15+ //~^ ERROR mismatched signatures
16+ }
17+
18+ fn main ( ) {
19+ assert_eq ! ( bar( 1 , 2 ) . to_string( ) , "3" ) ;
20+ }
Original file line number Diff line number Diff line change 1+ error: mismatched signatures
2+ --> $DIR/rpit.rs:14:5
3+ |
4+ LL | become foo(x, y);
5+ | ^^^^^^^^^^^^^^^^
6+ |
7+ = note: `become` requires caller and callee to have matching signatures
8+ = note: caller signature: `fn(u32, u32) -> impl ToString`
9+ = note: callee signature: `fn(u32, u32) -> u32`
10+
11+ error: aborting due to 1 previous error
12+
You can’t perform that action at this time.
0 commit comments