-
Notifications
You must be signed in to change notification settings - Fork 182
Open
Description
Summary
Closures automatically implement the fn trait so this needs fixed
Reproducer
I tried this code:
#[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 test() {
let add: fn(i32) -> i32 = |x| {
x
};
}
Does the code make use of any (1.49) nightly feature ?
- Nightly
Godbolt link
https://godbolt.org/z/d4oo8dYoT
Actual behavior
The current behavior is...
<source>:14:5: error: bounds not satisfied for fnptr (i32 ,) -> i32 'FnOnce' is not satisfied [E0277]
14 | let add: fn(i32) -> i32 = |x| {
| ^~~
Expected behavior
I expected to see...
compiles
GCC Version
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Todo