Skip to content

2229: Don't capture preicese paths on top of a union #87469

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

Merged
merged 1 commit into from
Jul 26, 2021

Conversation

arora-aman
Copy link
Member

  • Accessing fields of a union require unsafe block
  • As part of 2229 we don't allow precision where we need an unsafe block
    to capture.

Fixes: #87378

r? @nikomatsakis

- Accessing fields of a union require unsafe block
- As part of 2229 we don't allow precision where we need an unsafe block
to capture.

Fixes: rust-lang#87378

r? @nikomatsakis
@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jul 26, 2021
@nikomatsakis
Copy link
Contributor

@bors r+

@bors
Copy link
Collaborator

bors commented Jul 26, 2021

📌 Commit 75edcd9 has been approved by nikomatsakis

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jul 26, 2021
@bors
Copy link
Collaborator

bors commented Jul 26, 2021

⌛ Testing commit 75edcd9 with merge 08095fc...

@@ -1760,12 +1760,11 @@ impl<'a, 'tcx> euv::Delegate<'tcx> for InferBorrowKind<'a, 'tcx> {
self.borrow(assignee_place, diag_expr_id, ty::BorrowKind::MutBorrow);
}
}

/// Truncate projections so that following rules are obeyed by the captured `place`:
/// Truncate `place` so that an `unsafe` block isn't required to capture it.
Copy link
Member

Choose a reason for hiding this comment

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

Note the removed newline above this doc comment. (Don't worry about it, no need to block this one from landing. A drive-by fix in one of your next PRs is fine).

/// Truncate projections so that following rules are obeyed by the captured `place`:
/// - No Index projections are captured, since arrays are captured completely.
/// - No unsafe block is required to capture `place`
/// Truncate projections so that following rules are obeyed by the captured `place`:
Copy link
Member

Choose a reason for hiding this comment

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

And here the first line of the doc comment is duplicated as the last line.

@bors
Copy link
Collaborator

bors commented Jul 26, 2021

☀️ Test successful - checks-actions
Approved by: nikomatsakis
Pushing 08095fc to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Jul 26, 2021
@bors bors merged commit 08095fc into rust-lang:master Jul 26, 2021
@rustbot rustbot added this to the 1.56.0 milestone Jul 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2021 edition: Unsafe block not detected when accessing a union field inside a closure
6 participants