Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fix cmake build.
Checklist
If you've made changes to
gyb
files.script/generate_boilerplate_files_with_gyb
and included updated generated files in a commit of this pull request (not necessary)Motivation:
swift-crypto, a swiftpm dependency, is not compiling when bootstrapping swiftpm with cmake. It is however building fine when built with an existing swiftpm.
In #349 we added a new computed property to handle the fact that ManagedBuffer.capacity is unavailable on OpenBSD. In doing this, however we encountered some strange errors about this property being
internal and cannot be referenced from an '@inlinable' function
despite the fact we marked it@usableFromInline
. Moving the computed property to the nested class extension seemed to help, but in recent versions of swift this caused a different strange compiler error about the computed property having thewrong linkage
.Modifications:
While I don't really understand what is happening here enough to say whether this is a compiler bug or not, this only seems to be triggering from
_copyBytes
and_withVeryUnsafeMutableBytes
still. We want these to be inlinable, so the next natural workaround seems to be to plumb the capacity references in by argument instead of referencingself
. This makes the callsites a bit wordy, but it seems to work.Result:
swiftpm successfully bootstraps with cmake.