Skip to content

Conversation

nate-chandler
Copy link
Contributor

Because the stdlib has manual lifetimes, the lifetime of base2 here must be guarded not to be shrunk through any operations that read pointers.

rdar://133969821

Because the stdlib has manual lifetimes, the lifetime of `base2` here
must be guarded not to be shrunk through any operations that read
pointers.

rdar://133969821
@nate-chandler
Copy link
Contributor Author

@swift-ci please test

@nate-chandler
Copy link
Contributor Author

@swift-ci please apple silicon benchmark

@nate-chandler
Copy link
Contributor Author

@swift-ci please test source compatibility

@nate-chandler nate-chandler requested a review from atrick August 27, 2024 14:11
switch value {
case .struct(let offset):
var base2 = base
defer { _fixLifetime(base2) }
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm worried this issue might be lurking elsewhere too. Could we instead put the _fixLifetime in the implementation of withUnsafeBytes to ensure all uses have the pointee's lifetime extended to cover the closure?

@nate-chandler
Copy link
Contributor Author

Closing in favor of #76114 .

@nate-chandler nate-chandler deleted the rdar133969821 branch August 28, 2024 23:37
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