Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions tests/ui/explicit-tail-calls/rpit.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#![feature(explicit_tail_calls)]
#![expect(incomplete_features)]

// Regression test for https://github.com/rust-lang/rust/issues/139305.
//
// Combining return position impl trait (RPIT) with guaranteed tail calls does not
// currently work, but at least it does not ICE.

fn foo(x: u32, y: u32) -> u32 {
x + y
}

fn bar(x: u32, y: u32) -> impl ToString {
become foo(x, y);
//~^ ERROR mismatched signatures
}

fn main() {
assert_eq!(bar(1, 2).to_string(), "3");
}
12 changes: 12 additions & 0 deletions tests/ui/explicit-tail-calls/rpit.stderr
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
error: mismatched signatures
--> $DIR/rpit.rs:14:5
|
LL | become foo(x, y);
| ^^^^^^^^^^^^^^^^
|
= note: `become` requires caller and callee to have matching signatures
= note: caller signature: `fn(u32, u32) -> impl ToString`
= note: callee signature: `fn(u32, u32) -> u32`

error: aborting due to 1 previous error

Loading