Skip to content

[interop] Tracking issue to track support for immutable noncopyable borrows for C++ types in Swift #61454

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

Closed
Tracked by #65808
hyp opened this issue Oct 5, 2022 · 4 comments · Fixed by #66687
Closed
Tracked by #65808
Assignees
Labels
c++ interop Feature: Interoperability with C++ improvement performance

Comments

@hyp
Copy link
Contributor

hyp commented Oct 5, 2022

We want to immutably borrow C++ types so that they can't be copied implicitly. A prime example of it is std::vector, which we want to pass into const std::vector & , or a call a const method on.

This issue is a tracking issue that tracks overall support for this feature in Swift. I will post updates here.

@hyp hyp added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. c++ interop Feature: Interoperability with C++ labels Oct 5, 2022
@hyp hyp self-assigned this Oct 5, 2022
@hyp hyp added enhancement performance and removed bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. labels Oct 5, 2022
@hyp
Copy link
Contributor Author

hyp commented May 15, 2023

Let's not prioritize this for Swift 5.9

@hyp
Copy link
Contributor Author

hyp commented Jun 7, 2023

Actually this appears to be still on track for 5.9.

@hyp
Copy link
Contributor Author

hyp commented Jun 15, 2023

This appears to work! I'm just going to add a test case for our expected patterns.

hyp added a commit to hyp/swift that referenced this issue Jun 15, 2023
…pyable C++ types

This lets us verify that our suggested pattern for calling unsafe functions is working as intended in Swift

This also lets us verify that we can still pass borrowed C++ types to C++ functions that take in a const ref parameter

Tests now fixed swiftlang#61454
hyp added a commit to hyp/swift that referenced this issue Jun 15, 2023
…pyable C++ types

This lets us verify that our suggested pattern for calling unsafe functions is working as intended in Swift

This also lets us verify that we can still pass borrowed C++ types to C++ functions that take in a const ref parameter

Tests now fixed swiftlang#61454
hyp added a commit to hyp/swift that referenced this issue Jun 16, 2023
…pyable C++ types

This lets us verify that our suggested pattern for calling unsafe functions is working as intended in Swift

This also lets us verify that we can still pass borrowed C++ types to C++ functions that take in a const ref parameter

Tests now fixed swiftlang#61454

(cherry picked from commit da8c52c)
hyp added a commit to hyp/swift that referenced this issue Jul 12, 2023
…pyable C++ types

This lets us verify that our suggested pattern for calling unsafe functions is working as intended in Swift

This also lets us verify that we can still pass borrowed C++ types to C++ functions that take in a const ref parameter

Tests now fixed swiftlang#61454
hyp added a commit to hyp/swift that referenced this issue Jul 13, 2023
…pyable C++ types

This lets us verify that our suggested pattern for calling unsafe functions is working as intended in Swift

This also lets us verify that we can still pass borrowed C++ types to C++ functions that take in a const ref parameter

Tests now fixed swiftlang#61454
hyp added a commit to hyp/swift that referenced this issue Jul 13, 2023
…pyable C++ types

This lets us verify that our suggested pattern for calling unsafe functions is working as intended in Swift

This also lets us verify that we can still pass borrowed C++ types to C++ functions that take in a const ref parameter

Tests now fixed swiftlang#61454
hyp added a commit to hyp/swift that referenced this issue Jul 14, 2023
…pyable C++ types

This lets us verify that our suggested pattern for calling unsafe functions is working as intended in Swift

This also lets us verify that we can still pass borrowed C++ types to C++ functions that take in a const ref parameter

Tests now fixed swiftlang#61454
@hyp
Copy link
Contributor Author

hyp commented Jul 14, 2023

This works in 5.9 as well :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ interop Feature: Interoperability with C++ improvement performance
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants