Open CohenArthur opened 2 years ago
#[lang = "fn_once"]
pub trait FnOnce<Args> {
/// The returned type after the call operator is used.
#[lang = "fn_once_output"]
#[stable(feature = "fn_once_output", since = "1.12.0")]
type Output;
/// Performs the call operation.
extern "rust-call" fn call_once(self, args: Args) -> Self::Output;
}
#[lang = "fn_mut"]
pub trait FnMut<Args>: FnOnce<Args> {
/// Performs the call operation.
extern "rust-call" fn call_mut(&mut self, args: Args) -> Self::Output;
}
#[lang = "fn"]
pub trait Fn<Args>: FnMut<Args> {
/// Performs the call operation.
extern "rust-call" fn call(&self, args: Args) -> Self::Output;
}
struct BinOp<F: Fn(i32) -> i32> {
lhs: i32,
rhs: i32,
f: F,
}
Appears to be working on godbolt.org
, I'm not sure if I'm missing something
Maybe the code is working now, the issue was opened back when closures and Fn
traits were not properly supported in the compiler