Skip to content

[5.9][borrowing][consuming] Make borrowing and consuming no implicit copy parameters #66388

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 15 commits into from
Jun 7, 2023

Conversation

gottesmm
Copy link
Contributor

@gottesmm gottesmm commented Jun 6, 2023

All commits but 617fd26
• Description: [borrowing/consuming] Make borrowing and consuming parameters no implicit copy types.
• Risk: Low risk. Only affects code which uses borrowing/consuming parameters (which is only new code).
• Original PR: #66381
• Reviewed By: @jckarter
• Testing: I added lots of tests for both diagnostics/code generation/and an interpreter test for code measure.
• Resolves: rdar://108383660

Commit 617fd26
• Description: [move-only] Fix class setters of address only move only types.
• Risk: Low risk. Only affects code using noncopyable types.
• Original PR: #66255
• Reviewed By: @jckarter
• Testing: I added a diagnostic test that showed we didn't error and also a SILGen test
• Resolves: rdar://109287977

Commit 98cbeec
• Description: [borrowing/consuming] Be sure to visit boxes with trivial moveonly types.
• Risk: Low risk. Only affects code using noncopyable types.
• Original PR: #66402
• Reviewed By: @atrick
• Testing: I added sil-verify-all to the test that exposed this and validated that we no longer crashed.
• Resolves: rdar://110364874

@gottesmm gottesmm requested a review from a team as a code owner June 6, 2023 22:20
@gottesmm
Copy link
Contributor Author

gottesmm commented Jun 6, 2023

@swift-ci test

@gottesmm
Copy link
Contributor Author

gottesmm commented Jun 7, 2023

I think I messed up the merge conflicts when I cherry-picked.

gottesmm added 12 commits June 6, 2023 22:51
… `borrowing`"

This reverts commit 8899d3b.

(cherry picked from commit 95cdf2a)
…modifiers"

This reverts commit 87f190b.

(cherry picked from commit 07677c2)
…() instead of getASTType() to prevent us from looking through no implicit copy types while serializing.

This change makes sense since, in general, when serializing we do not want to
look through no implicit copy types since we are trying to 1-1 preserve the
SIL.

(cherry picked from commit f88fa66)
…h the AST serialization machinery.

This looks like a thinko from the early part of the implementation. Without
this, the machinery doesn't recognize the layout and just asserts.

(cherry picked from commit 508866a)
…uming/Borrowing.

I also added a static_assert to make sure that we always catch this in the
future.

(cherry picked from commit 76374f8)
…e_addr.

The reason why I am using a different instruction for addresses and objects here
is that the object checker doesnt have to deal with things like initialization.

(cherry picked from commit 43f42e2)

Conflicts:
	lib/SIL/Verifier/SILVerifier.cpp
	lib/Serialization/ModuleFormat.h
	test/SIL/Parser/basic2.sil
…lywrapper_addr.

Just the $*T -> $*@moveOnly T variant for addresses. Unlike the object version
this acts like a cast rather than something that provides semantics from the
frontend to the optimizer.

(cherry picked from commit 611e676)
…r_to_copyable_addr.

(cherry picked from commit 68fd68b)
I am going to use this to unwrap ${ @moveOnly T } so that I can pass it to
partial_apply that expect a ${ T }

(cherry picked from commit 70ab38d)

Conflicts:
	lib/SIL/IR/SILType.cpp
	lib/Serialization/ModuleFormat.h
	test/SIL/Parser/basic2.sil
We were not properly propagating along cleanups in SILGenProlog. I went through
SILGenProlog and fixed this.

rdar://109287977
(cherry picked from commit 42b4b9a)
@gottesmm
Copy link
Contributor Author

gottesmm commented Jun 7, 2023

Found the problem. I was missing a commit from main and I also messed up one of the merge conflicts.

…a noimplicitcopy type.

rdar://108383660
(cherry picked from commit 59c8cff)
@gottesmm gottesmm force-pushed the release-5.9-rdar108383660 branch from 57f4b0e to 72cd7c5 Compare June 7, 2023 03:00
@gottesmm
Copy link
Contributor Author

gottesmm commented Jun 7, 2023

@swift-ci test

gottesmm added 2 commits June 6, 2023 20:44
…pes.

This was not caught on main since I wasn't the tests with -sil-verify-all
enabled... but it seems that it was caught by the verifier on 5.9. I have since
enabled sil-verify-all by default on both of those tests
(noimplicitcopy_consuming_parameter.swift and
noimplicitcopy_borrowing_parameter.swift).
@gottesmm
Copy link
Contributor Author

gottesmm commented Jun 7, 2023

@swift-ci test

@gottesmm
Copy link
Contributor Author

gottesmm commented Jun 7, 2023

@swift-ci test macOS platform

@gottesmm
Copy link
Contributor Author

gottesmm commented Jun 7, 2023

the macOS test failure was due to the infamous cxxinterop Darwin bug.

@gottesmm
Copy link
Contributor Author

gottesmm commented Jun 7, 2023

@swift-ci clean test macOS platform

@gottesmm
Copy link
Contributor Author

gottesmm commented Jun 7, 2023

Just hit the Darwin error again...

@gottesmm
Copy link
Contributor Author

gottesmm commented Jun 7, 2023

@swift-ci clean test macOS platform

@gottesmm
Copy link
Contributor Author

gottesmm commented Jun 7, 2023

I don't know why the clean test isn't working...

@gottesmm
Copy link
Contributor Author

gottesmm commented Jun 7, 2023

@swift-ci test macOS platform

@gottesmm
Copy link
Contributor Author

gottesmm commented Jun 7, 2023

@swift-ci smoke test macOS platform

@gottesmm
Copy link
Contributor Author

gottesmm commented Jun 7, 2023

I think the little trick I just did got my macOS full test on a different machine. Hopefully it works now and does a clean build.

@gottesmm gottesmm merged commit c935d29 into swiftlang:release/5.9 Jun 7, 2023
@gottesmm gottesmm deleted the release-5.9-rdar108383660 branch June 7, 2023 10:56
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.

5 participants