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

Remove proc from the language #19338

Merged
merged 13 commits into from
Dec 14, 2014

Conversation

nikomatsakis
Copy link
Contributor

They are replaced with unboxed closures.

cc @pcwalton @aturon

This is a [breaking-change]. Mostly, uses of proc() simply need to be converted to move|| (unboxed closures), but in some cases the adaptations required are more complex (particularly for library authors). A detailed write-up can be found here: http://smallcultfollowing.com/babysteps/blog/2014/11/26/purging-proc/

The commits are ordered to emphasize the more important changes, but are not truly standalone.

@rust-highfive
Copy link
Collaborator

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!

@thestinger
Copy link
Contributor

This is awesome! I was afraid proc() was going to end up staying around as a compatibility shim.

@alexcrichton
Copy link
Member

@nikomatsakis could you make sure that at least one of the commits if flagged as a breaking-change along with some clear documentation of how to migrate? It would also be nice to expand a bit on migration path for the consuming side you alluded to in the description.

@alexcrichton
Copy link
Member

I added some comments to a previous set of commits, and my high level comments were:

  • I think there were a few tests that were removed but could be added back in.
  • It'd be nice to have some documentation for std::thunk::Thunk

Other than that, and the comments in the previous commits, r=me, thanks so much @nikomatsakis!

The `spawn` function has the type signature: `fn
spawn<F:FnOnce()+Send>(f: F)`. This indicates that it takes as
argument a closure (of type `F`) that it will run exactly once. This
closure is limited to capturing `Send`-able data form its environment
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

s/form/from

@nikomatsakis nikomatsakis changed the title Remove proc types from the language Remove proc from the language Nov 26, 2014
@nikomatsakis
Copy link
Contributor Author

Blog post explaining the high-level details: http://smallcultfollowing.com/babysteps/blog/2014/11/26/purging-proc/

@nikomatsakis
Copy link
Contributor Author

@alexcrichton the breaking change annotation is in the PR header, and I included a link to my blog post. I believe that shows up in the merge commit, right?

@michaelwoerister
Copy link
Member

cc me

@nikomatsakis nikomatsakis force-pushed the unboxed-closure-purge-the-proc branch 2 times, most recently from 7f34f06 to 79ba682 Compare November 27, 2014 11:44
bors added a commit that referenced this pull request Nov 28, 2014
…, r=alexcrichton

This PR lets `rustc` generate debuginfo for variables captured by unboxed closures. 

Fixes #19356

@nikomatsakis This PR will probably conflict with #19338. If this gets merged before, you should be able to just leave the test case as it is (maybe remove the `#![feature(unboxed_closures)]` directive).
@tomaka tomaka mentioned this pull request Nov 30, 2014
47 tasks
@nikomatsakis
Copy link
Contributor Author

Status: semi-blocked on #19438

@nikomatsakis nikomatsakis force-pushed the unboxed-closure-purge-the-proc branch 6 times, most recently from c876e97 to e2e8768 Compare December 8, 2014 15:11
…ethod. Besides being yucky, it will cause problems if we try to make all traits implement themselves, which would make a lot of things in life easier. Also, it was inextricably linked to `Box`, which was not the intention. We can work around its absence, so better to reimplement it later in a more thorough fashion.
bors added a commit that referenced this pull request Dec 14, 2014
…oc, r=acrichto

They are replaced with unboxed closures.

cc @pcwalton @aturon 

This is a [breaking-change]. Mostly, uses of `proc()` simply need to be converted to `move||` (unboxed closures), but in some cases the adaptations required are more complex (particularly for library authors). A detailed write-up can be found here: http://smallcultfollowing.com/babysteps/blog/2014/11/26/purging-proc/

The commits are ordered to emphasize the more important changes, but are not truly standalone.
@bors bors closed this Dec 14, 2014
@bors bors merged commit f6d60f3 into rust-lang:master Dec 14, 2014
@chenyukang chenyukang mentioned this pull request Jan 21, 2015
@nikomatsakis nikomatsakis deleted the unboxed-closure-purge-the-proc branch March 30, 2016 16:17
@zesterer
Copy link
Contributor

'proc' is a very useful keyword to have, particularly when one is writing an operating system. I suggest that it should no longer be a reserved word given that it no longer has semantic meaning.

@nikomatsakis
Copy link
Contributor Author

@zesterer I agree. Care to open a PR? I think all you have to do is to remove this line:

(49, Proc, "proc")

If you do, add r? @nikomatsakis into the PR description.

@zesterer
Copy link
Contributor

I've never opened a Rust PR before. Have you any advice on how best to word things?

@tshepang
Copy link
Member

I would...

remove 'proc' from keyword list

'proc' is a very useful keyword to have, particularly when one is writing an operating system. It is removed from reserve keyword, given that it no longer has semantic meaning.

@nikomatsakis
Copy link
Contributor Author

@zesterer do you mean to word the PR description? If so, what @tshepang wrote sounds fine. We're not too formal on these sorts of things. =)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants