-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Finalize unboxed closure feature gates for 1.0 #18875
Comments
Nominating for 1.0 or something. :) |
P-backcompat-lang, 1.0. |
Note that some of this works today though it ought not, e.g. manually implementing |
To expand on @nikomatsakis' comment, the following code fails to compile due to the lack of a feature that should be gated: struct MemberFn<'a, T, R, A0> where T : 'a {
fun: fn (&T, A0) -> R,
obj: &'a T
}
impl<'a, T, R, A0> MemberFn<'a, T, R, A0> where T : 'a {
fn new(o: &'a T, f: fn (&T, A0) -> R) -> MemberFn<'a, T, R, A0> {
MemberFn {
fun: f,
obj: o
}
}
}
impl<'a, T, R, A0, Args> Fn<Args, R> for MemberFn<'a, T, R, A0> where Args : Tuple1<A0> {
fn call(&self, args: Args) -> R {
(self.fun)(self.obj, args.val0())
}
}
fn main() {
println!("Hello, world!")
} The current solution is to put |
detect UFCS drop and allow UFCS methods to have explicit type parameters. Work towards rust-lang#18875. Since code could previously call the methods & implement the traits manually, this is a [breaking-change] Closes rust-lang#19586. Closes rust-lang#19375.
detect UFCS drop and allow UFCS methods to have explicit type parameters. Work towards rust-lang#18875. Since code could previously call the methods & implement the traits manually, this is a [breaking-change] Closes rust-lang#19586. Closes rust-lang#19375.
This was done, or done enough. |
Oops, I totally overlooked that |
We do not expect to completely "unfeature-gate" unboxed closures for 1.0. We wish to reserve the flexibility to change a few aspects:
A
andR
arguments from input types to (possibly) associated types. (cc Make return type of theFn
traits an associated type #20871)To this end we will adjust the features to:
Fn*
traits using angle bracket notationFn*
traitsfoo.call()
Foo(A,B) -> C
) from being used with anything other than theFn*
traitsIn short, we permit unboxed closures to be used as if they are a language builtin, but disallow (for now) a lot of the more generic uses. We should be able to drop this feature gate shortly after 1.0.
cc @pcwalton
The text was updated successfully, but these errors were encountered: