Skip to content

Implement Mutation- and BorrowOfLayoutConstrainedField in thir-unsafeck - #86665

Merged
bors merged 1 commit into
rust-lang:masterfrom
FabianWolff:layout-field-thir-unsafeck
Jul 13, 2021
Merged

Implement Mutation- and BorrowOfLayoutConstrainedField in thir-unsafeck#86665
bors merged 1 commit into
rust-lang:masterfrom
FabianWolff:layout-field-thir-unsafeck

Conversation

@FabianWolff

Copy link
Copy Markdown
Contributor

Since nobody has so far claimed Mutation- and BorrowOfLayoutConstrainedField in rust-lang/project-thir-unsafeck#7, I have taken the liberty of implementing them in thir-unsafeck.

r? @LeSeulArtichaut

@rust-highfiverust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Jun 27, 2021
@LeSeulArtichaut

Copy link
Copy Markdown
Contributor

Thanks for your help on this! I'll assign this to you in the tracking issue, if you want to implement something else in the future feel free to just drop a comment on the tracking issue, just to make sure that there aren't two people working on the same thing. With that said, the last few unsafe ops to implement are the trickiest, so having multiple eyes on them is a good thing.

I don't have time to do a proper review today, but I think I can already tell that this PR doesn't cover references that arise from patterns (e.g. ref mut patterns)? It doesn't need to be implemented here, but that's something you can implement if you want additional work.

Also cc @nikomatsakis, if you want to take a look at this as well

@FabianWolff

Copy link
Copy Markdown
ContributorAuthor

Thanks for your quick response! I have added some code (and a test case) now that deals with by-reference bindings in match arms.

@goffrie

Copy link
Copy Markdown
Contributor

The title of this PR confused me, but you probably didn't mean thir-borrowck :p

@FabianWolffFabianWolff changed the title Implement Mutation- and BorrowOfLayoutConstrainedField in thir-borrowckImplement Mutation- and BorrowOfLayoutConstrainedField in thir-unsafeckJun 28, 2021
@FabianWolff

Copy link
Copy Markdown
ContributorAuthor

The title of this PR confused me, but you probably didn't mean thir-borrowck :p

Fixed, thanks for catching this! Thinking about all the different borrow kinds etc. apparently got me confused...

@LeSeulArtichautLeSeulArtichaut left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Okay, sorry for the wait, here's a first review. This is certainly trickier than it looks, and I worry that we'll miss edge cases, but it's OK if we miss things in this PR because THIR unsafeck is gated under an explicitely-marked-as-unsound-do-not-enable option.

Comment threadcompiler/rustc_mir_build/src/check_unsafety.rs Outdated
Comment threadcompiler/rustc_mir_build/src/check_unsafety.rs Outdated
Comment threadcompiler/rustc_mir_build/src/check_unsafety.rs Outdated
Comment threadcompiler/rustc_mir_build/src/check_unsafety.rs Outdated
@LeSeulArtichaut

Copy link
Copy Markdown
Contributor

cc @nikomatsakis you might be interested in reviewing if you have enough bandwidth

@FabianWolff
FabianWolffforce-pushed the layout-field-thir-unsafeck branch from c80ed9d to fbed40fCompareJuly 4, 2021 16:41
Comment threadcompiler/rustc_mir_build/src/check_unsafety.rs Outdated
@FabianWolff
FabianWolffforce-pushed the layout-field-thir-unsafeck branch from fbed40f to a4066a3CompareJuly 8, 2021 11:57
Comment threadcompiler/rustc_mir_build/src/check_unsafety.rs Outdated

@LeSeulArtichautLeSeulArtichaut left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Okay, besides my last comment I haven't found a case where the implementation is wrong. I'll still pass this to someone with better knowledge of the language than me. In the meantime here are a few nits.

Comment threadcompiler/rustc_mir_build/src/check_unsafety.rs Outdated
Comment threadcompiler/rustc_mir_build/src/check_unsafety.rs Outdated
Comment threadcompiler/rustc_mir_build/src/check_unsafety.rs Outdated
Comment threadcompiler/rustc_mir_build/src/check_unsafety.rs Outdated
Comment threadcompiler/rustc_mir_build/src/check_unsafety.rs Outdated
@FabianWolff
FabianWolffforce-pushed the layout-field-thir-unsafeck branch from a4066a3 to c269774CompareJuly 9, 2021 15:54
@FabianWolff

Copy link
Copy Markdown
ContributorAuthor

All done, thanks again for your comments!

@LeSeulArtichaut

Copy link
Copy Markdown
Contributor

r? @oli-obk

@bors

bors commented Jul 9, 2021

Copy link
Copy Markdown
Collaborator

☔ The latest upstream changes (presumably #85263) made this pull request unmergeable. Please resolve the merge conflicts.

@FabianWolff
FabianWolffforce-pushed the layout-field-thir-unsafeck branch from c269774 to 0994dd7CompareJuly 10, 2021 12:09
Comment threadcompiler/rustc_mir_build/src/check_unsafety.rs Outdated
@FabianWolff
FabianWolffforce-pushed the layout-field-thir-unsafeck branch from 0994dd7 to e244b17CompareJuly 10, 2021 13:16
Comment threadcompiler/rustc_mir_build/src/check_unsafety.rs Outdated
Comment threadcompiler/rustc_mir_build/src/check_unsafety.rs Outdated
Comment threadcompiler/rustc_mir_build/src/check_unsafety.rs Outdated
Comment threadcompiler/rustc_mir_build/src/check_unsafety.rs Outdated
@FabianWolff
FabianWolffforce-pushed the layout-field-thir-unsafeck branch from e244b17 to b088861CompareJuly 10, 2021 14:33
@oli-obk

Copy link
Copy Markdown
Contributor

@bors r+

@bors

bors commented Jul 12, 2021

Copy link
Copy Markdown
Collaborator

📌 Commit b088861 has been approved by oli-obk

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

bors commented Jul 13, 2021

Copy link
Copy Markdown
Collaborator

⌛ Testing commit b088861 with merge 1f0db5e...

@bors

bors commented Jul 13, 2021

Copy link
Copy Markdown
Collaborator

☀️ Test successful - checks-actions
Approved by: oli-obk
Pushing 1f0db5e to master...

@borsbors added the merged-by-bors This PR was explicitly merged by bors. label Jul 13, 2021
@bors
bors merged commit 1f0db5e into rust-lang:masterJul 13, 2021
@rustbotrustbot added this to the 1.55.0 milestone Jul 13, 2021
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merged-by-borsThis PR was explicitly merged by bors.S-waiting-on-borsStatus: 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.

7 participants

@FabianWolff@LeSeulArtichaut@goffrie@bors@oli-obk@rust-highfive@rustbot