{"action":"created","issue":{"url":"https://api.github.com/repos/apple/swift/issues/20070","repository_url":"https://api.github.com/repos/apple/swift","labels_url":"https://api.github.com/repos/apple/swift/issues/20070/labels{/name}","comments_url":"https://api.github.com/repos/apple/swift/issues/20070/comments","events_url":"https://api.github.com/repos/apple/swift/issues/20070/events","html_url":"https://github.com/apple/swift/pull/20070","id":374433003,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI2MTM3MDI2","number":20070,"title":"[DNM][WIP] Reject unsound pointer conversions","user":{"login":"hamishknight","id":14794099,"node_id":"MDQ6VXNlcjE0Nzk0MDk5","avatar_url":"https://avatars0.githubusercontent.com/u/14794099?v=4","gravatar_id":"","url":"https://api.github.com/users/hamishknight","html_url":"https://github.com/hamishknight","followers_url":"https://api.github.com/users/hamishknight/followers","following_url":"https://api.github.com/users/hamishknight/following{/other_user}","gists_url":"https://api.github.com/users/hamishknight/gists{/gist_id}","starred_url":"https://api.github.com/users/hamishknight/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hamishknight/subscriptions","organizations_url":"https://api.github.com/users/hamishknight/orgs","repos_url":"https://api.github.com/users/hamishknight/repos","events_url":"https://api.github.com/users/hamishknight/events{/privacy}","received_events_url":"https://api.github.com/users/hamishknight/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":10,"created_at":"2018-10-26T15:23:57Z","updated_at":"2018-11-09T19:02:39Z","closed_at":null,"author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/apple/swift/pulls/20070","html_url":"https://github.com/apple/swift/pull/20070","diff_url":"https://github.com/apple/swift/pull/20070.diff","patch_url":"https://github.com/apple/swift/pull/20070.patch"},"body":"This is still a WIP, but the end goal is reject unsound inout-to-pointer, array-to-pointer and string-to-pointer conversions through the introduction of an underscored `@_nonEphemeral` attribute that marks pointer parameters where you cannot pass a temporary pointer argument produced from one of the aforementioned conversions (resolving [SR-2790](https://bugs.swift.org/browse/SR-2790)).\r\n\r\nMy rough plan of action is as follows:\r\n\r\n1. **In this PR:** I'd like to run this against the compat suite to get a rough idea of what the breakage is like (from my own experience at least, I've seen these temporary pointer conversions being accidentally misused a decent amount).\r\n\r\n2. If we're okay with making this change (unsure if this will require Swift Evolution discussion), I'll split this up – one PR for the warning and, assuming the source break isn't too widespread, one PR for the error (the details of exactly what swift version to make the switch can be discussed then). If possible, I'd like to get the warning patch in for Swift 5 (I'm hoping that splitting it up will make this easier).\r\n\r\n3. Start a discussion on whether there's any merit to de-underscoring this attribute for usage outside of the standard library and/or exposing it to Clang for usage in (Obj-)C APIs when imported into Swift.\r\n\r\nAny feedback on this change is greatly appreciated!"},"comment":{"url":"https://api.github.com/repos/apple/swift/issues/comments/437461557","html_url":"https://github.com/apple/swift/pull/20070#issuecomment-437461557","issue_url":"https://api.github.com/repos/apple/swift/issues/20070","id":437461557,"node_id":"MDEyOklzc3VlQ29tbWVudDQzNzQ2MTU1Nw==","user":{"login":"hamishknight","id":14794099,"node_id":"MDQ6VXNlcjE0Nzk0MDk5","avatar_url":"https://avatars0.githubusercontent.com/u/14794099?v=4","gravatar_id":"","url":"https://api.github.com/users/hamishknight","html_url":"https://github.com/hamishknight","followers_url":"https://api.github.com/users/hamishknight/followers","following_url":"https://api.github.com/users/hamishknight/following{/other_user}","gists_url":"https://api.github.com/users/hamishknight/gists{/gist_id}","starred_url":"https://api.github.com/users/hamishknight/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hamishknight/subscriptions","organizations_url":"https://api.github.com/users/hamishknight/orgs","repos_url":"https://api.github.com/users/hamishknight/repos","events_url":"https://api.github.com/users/hamishknight/events{/privacy}","received_events_url":"https://api.github.com/users/hamishknight/received_events","type":"User","site_admin":false},"created_at":"2018-11-09T19:02:39Z","updated_at":"2018-11-09T19:02:39Z","author_association":"CONTRIBUTOR","body":"Realised I missed a useful case where we can infer `@_nonEphemeral`, namely enum case constructors for pointer payloads. I've just pushed the logic for that – would it be worth running the source compat suite on it?"}}
{"actor":{"display_login":"hamishknight"}}