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

Add blog post to introduce disjoint capture in closures #884

Closed
wants to merge 5 commits into from

Conversation

roxelo
Copy link
Member

@roxelo roxelo commented Aug 3, 2021

This PR adds a blog post to introduce disjoint capture in closures and encourage user testing.

cc @rust-lang/wg-rfc-2229

r? @nikomatsakis

@roxelo roxelo requested a review from a team as a code owner August 3, 2021 22:38

The precise path that gets captured is typically the full path that is used in the closure, but there are cases where we will only capture a prefix of the path. See this pending PR to the [Rust Reference](https://github.com/rust-lang/reference/blob/d24c4642c8efd26915209558e065a5e670363fc0/src/types/closure.md) for the full details.

The feature also includes (minor) breaking changes to the Rust semantics which are also documented in this pending PR to the [Rust Reference](https://github.com/rust-lang/reference/blob/d24c4642c8efd26915209558e065a5e670363fc0/src/types/closure.md).
Copy link
Member

Choose a reason for hiding this comment

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

Maybe link to the PR rust-lang/reference#1059 instead of a commit, since this commit was force pushed over AFAICT.

Co-authored-by: Caleb Cartwright <[email protected]>
Co-authored-by: Eric Huss <[email protected]>

## How to submit bugs?

To submit a bug simply [open an issue](https://github.com/rust-lang/rust/issues/new/choose) and tag the RFC 2229 working group using `@rust-lang/wg-rfc-2229`. We hope to create the best experince posible so no issue is too small, even a confusing error messages is worth reporting.
Copy link
Member

Choose a reason for hiding this comment

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

Most folks won't be able to tag the working group (you need to be part of the org to ping teams). I think the easiest is to just ask folks to leave a label via rustbot, perhaps?

Copy link
Member

Choose a reason for hiding this comment

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

How about we ask users to create issue directly on the 2229 repo? https://github.com/rust-lang/project-rfc-2229. MIght be a bit easier than trying to use rustbot

@nikomatsakis what are your thoughts?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm! I think I'd prefer to have people file bugs on rust-lang/rust. I'm not sure what's the best way for people to tag disjoint closures though.

@steveklabnik
Copy link
Member

Should this post be on the main blog, or on Inside Rust? Generally speaking, the way we've treated things historically is that the main blog is aimed at every user of Rust, and Inside Rust is for folks interested in Rust development, similar to other venues, like the users forum vs internals forum.

Given that this is asking people to test a currently nightly feature, this feels more like an Inside Rust thing to me personally. I don't feel intensely strongly that this is so, and there is some degree of flexibility; for example, the recent post on GATs is something that is really super major, and while this change is certainly a really great one, I'm not sure it rises to the same level of "we must tell everyone who uses Rust about this specific development."

steveklabnik
steveklabnik previously approved these changes Oct 1, 2021
Copy link
Member

@steveklabnik steveklabnik left a comment

Choose a reason for hiding this comment

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

This post is great overall, I have one tiny nit.

author: The RFC 2229 working group <https://www.rust-lang.org/governance/teams/compiler#wg-rfc-2229>
---

One of the major features of the [upcoming Rust 2021 Edition](https://blog.rust-lang.org/2021/05/11/edition-2021.html)) is a change to how Rust closures work. This change makes closure captures more precise, eliminating common borrow check errors. As a result, it involves some (minor) changes to Rust semantics, which is why it is tied to the Rust 2021 edition.
Copy link
Member

Choose a reason for hiding this comment

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

Ideally this should be a relative link


## How to use the feature?

Interested in testing this out? You can now try disjoint capture in Rust closures on rust nightly using `#![feature(capture_disjoint_fields)]`.
Copy link
Contributor

Choose a reason for hiding this comment

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

These instructions may be out-of-date now, or at least confusing. #![feature(capture_disjoint_fields)] shows a giant warning that the feature is incomplete and may not be safe to use. However, it is now stable in 2021 which seems like a conflicting message to me.

Also, there is only a few weeks left until this hits stable. Might be worth noting that this will be stable on October 21st.

@nikomatsakis
Copy link
Contributor

nikomatsakis commented Oct 4, 2021

@steveklabnik

Should this post be on the main blog, or on Inside Rust? Generally speaking, the way we've treated things historically is that the main blog is aimed at every user of Rust, and Inside Rust is for folks interested in Rust development, similar to other venues, like the users forum vs internals forum.

We discussed this some in Zulip. It seems to me that this is an exciting feature that is coming up in Rust 2021, so the post seems like a good way to get people excited about the upcoming release. It may want to be reframed somewhat to make that clearer, though. i.e., you don't have to use an unstable, nightly feature to get access, you just have to use Rust 2021 on the beta branch =)

That said, it is debatable whether it's better to post this before or after the Edition release is finalized. Maybe it would be nice to come somewhat after the release.

In other words: I think the proper audience for this post is all Rust users, not Rust developers.

@rylev
Copy link
Member

rylev commented Jun 22, 2022

@roxelo @nikomatsakis given that the edition has come and gone, is this still worth releasing. Should we perhaps close this instead?

@arora-aman
Copy link
Member

arora-aman commented Jun 22, 2022 via email

@rylev
Copy link
Member

rylev commented Jun 22, 2022

Closing this as out of date

@rylev rylev closed this Jun 22, 2022
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.