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

update 'ByRef' borrow types of closures + minor fixes #894

Merged
merged 4 commits into from
Sep 26, 2020
Merged

update 'ByRef' borrow types of closures + minor fixes #894

merged 4 commits into from
Sep 26, 2020

Conversation

JOE1994
Copy link
Contributor

@JOE1994 JOE1994 commented Sep 25, 2020

Hello! 🦀 This PR contains 2 commits.

  1. update description of ByRef borrows of closures
    The current version of src/closure.md explains that ByRef borrows can either be shared, shallow, unique or mut (enum variants of rustc_middle::mir::BorrowKind).
    However, the actual enum type used for representing borrows from closures seems to be a different type with the same name. This PR updates the description for borrow types of closures. I found this out while tracking the type definitions.
    (InferBorrowKind -> UpvarCaptureMap -> UpvarCapture -> UpvarBorrow -> BorrowKind)
// rustc_middle::ty::BorrowKind
pub enum BorrowKind {
    ImmBorrow,
    UniqueImmBorrow,
    MutBorrow,
}
  1. minor punctual/grammar fixes

Thank you for reviewing this PR 😃

P.S.
I'm really grateful to the authors who worked on the closure.md writeup! 😺
It was very helpful for understanding how borrows from closures are resolved.

Copy link
Member

@jyn514 jyn514 left a comment

Choose a reason for hiding this comment

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

Thanks for working on this!

src/closure.md Outdated Show resolved Hide resolved
src/closure.md Outdated Show resolved Hide resolved
Copy link
Member

@jyn514 jyn514 left a comment

Choose a reason for hiding this comment

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

Thank you again!

@jyn514 jyn514 merged commit e34496f into rust-lang:master Sep 26, 2020
@JOE1994 JOE1994 deleted the nitpicky branch September 26, 2020 03:03
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.

2 participants