Skip to content

6.0: [Features] Move NoncopyableGenerics up. #73847

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

Conversation

nate-chandler
Copy link
Contributor

@nate-chandler nate-chandler commented May 23, 2024

Explanation: Fix a condfail on MemoryLayout in the stdlib.

The MemoryLayout declaration involves both NoncopyableGenerics (its generic paramter need not conform to Copyable) and ConformanceSuppression (inference of conformance to BitwiseCopyable is repressed).

Some compilers have NoncopyableGenerics but not ConformanceSuppression. The declarations in Features.def need to match the order in which features appeared in compilers. This is necesary because ASTPrinting assumes that if a compiler has a declared-later feature, it has all declared-earlier features.

Previously, NoncopyableGenerics was declared after ConformanceSuppression. That resulted in ASTPrinting assuming that all compilers which had NoncopyableGenerics also had ConformanceSuppression. That isn't the case, however--as mentioned, some compilers have NoncopyableGenerics but not ConformanceSuppression.

Here, this is fixed by declaring the NoncopyableGenerics feature earlier than ConformanceSuppression in Features.def. The result is that ASTPrinting correctly assumes that if a compiler has ConformanceSuppression it also has NoncopyableGenerics, but not the reverse.
caused by NoncopyableGenerics being newer than ConformanceSuppression.
Scope: Very narrow. Affects declarations of types involving both NoncopyableGenerics and ConformanceSuppression in swiftinterfaces.
Issue: rdar://128611158
Original PR: #73843
Risk: Very low.
Testing: Added a test which demonstrates the interface being printed as desired.
Reviewer: Allan Shortlidge ( @tshortli )

@nate-chandler nate-chandler requested a review from a team as a code owner May 23, 2024 15:57
@nate-chandler nate-chandler requested review from kavon and tshortli May 23, 2024 15:58
Some compilers have the NoncopyableGenerics feature enabled via
interesting mechanisms but do not have ConformanceSuppression.  To
support such compilers, the NoncopyableGenerics feature must appear
before ConformanceSuppression in the list of features.  Otherwise, when
parsing the portion of the swiftinterface corresponding to an entity
which involves both features, the first check will be for
NoncopyableGenerics (which that old compiler has) and the code inside
will involve ConformanceSuppression (which that old compiler does not
have).

rdar://128611158
@nate-chandler nate-chandler force-pushed the cherrypick/release/6.0/rdar128611158 branch from e2fdfea to 0d950fd Compare May 23, 2024 17:13
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

@nate-chandler nate-chandler enabled auto-merge May 23, 2024 17:15
Copy link
Contributor

@nkcsgexi nkcsgexi 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!

@nate-chandler nate-chandler merged commit 89ca077 into swiftlang:release/6.0 May 23, 2024
5 checks passed
@nate-chandler nate-chandler deleted the cherrypick/release/6.0/rdar128611158 branch May 23, 2024 22:47
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