Skip to content

Add some availability attributes for UnsafePointer conversion. #4062

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 1 commit into from
Aug 6, 2016
Merged

Add some availability attributes for UnsafePointer conversion. #4062

merged 1 commit into from
Aug 6, 2016

Conversation

atrick
Copy link
Contributor

@atrick atrick commented Aug 6, 2016

This introduces some important diagnostic messages and fix-its.

Incorporates suggestions by DaveA.

Some of the diagnostics that we would like to provide are impossible
on a generic class because they introduce ambiguity.

Renaming UnsafePointer to UnsafeRawPointer makes extensions and
global operators ambiguous.

We would also like to provide this fix-it on conversion from
UnsafePointer or UnsafeRawPointer to UnsafePointer
with this message:
Conversion restricted. Use 'assumingMemoryBound(to:)' or 'bindMemory(to:capacity:)'}}

However, that introduces ambiguous overloads that defeat other hueristics.

This introduces some important diagnostics to help migration.

Some of the diagnostics that we would like to provide are impossible
on a generic class because they introduce ambiguity.

Renaming UnsafePointer<Void> to UnsafeRawPointer makes extensions and
global operators ambiguous.

We would also like to provide this fix-it on conversion from
UnsafePointer<Void> or UnsafeRawPointer to UnsafePointer<T>
with this message:
  Conversion restricted. Use 'assumingMemoryBound(to:)' or 'bindMemory(to:capacity:)'}}

However, that introduces ambiguous overloads that defeat other hueristics.
@atrick
Copy link
Contributor Author

atrick commented Aug 6, 2016

@swift-ci Smoke test and merge.

@swift-ci swift-ci merged commit b02102c into swiftlang:master Aug 6, 2016
@atrick atrick deleted the rawptr-fixit branch September 21, 2016 20:44
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