gccrs
gccrs copied to clipboard
Error out when explicitly specifiying the desugared type of `Fn` traits
fn invalid_ref(a: i32, b: i32 ,f: &dyn Fn<(i32, i32), Output = i32>) -> i32 {
f(a + b)
}
fn invalid(a: i32, b: i32 ,f: impl Fn<(i32, i32), Output = i32>) -> i32 {
f(a + b)
}
Both cases should error out since that format is unstable and should not be used. Ideally, they should hint about the proper format (Fn(i32, i32) -> i32)
Associated features enabling this:
- https://doc.rust-lang.org/beta/unstable-book/language-features/unboxed-closures.html
- https://doc.rust-lang.org/beta/unstable-book/library-features/fn-traits.html
It shouldn't error out when the feature gate for it is enabled as libcore and liballoc need it.
Ah, very good point. I'll add the feature to the original comment