Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gccrs: add testcase to prove issue has already been fixed #2825

Merged
merged 1 commit into from
Feb 3, 2024
Merged
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
28 changes: 28 additions & 0 deletions gcc/testsuite/rust/compile/issue-1483.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#[lang = "sized"]
pub trait Sized {}

#[lang = "fn_once"]
pub trait FnOnce<Args> {
#[lang = "fn_once_output"]
type Output;

extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
}

pub fn takes_fn_generic<F: FnOnce(i32) -> i32>(a: i32, f: F) -> i32 {
f(a)
}

pub fn takes_fn_generic_where<F>(a: i32, f: F) -> i32
where
F: FnOnce(i32) -> i32,
{
f(a)
}

pub fn test() {
let foo = |x: i32| -> i32 { x + 1 };

takes_fn_generic(1, foo);
takes_fn_generic_where(2, foo);
}
Loading