-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[SE-0458] Bring implementation in line with the latest proposal revision #79424
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
Conversation
…scriminator We found another case where we aren't getting a closure discriminator, so disable this again in non-asserts builds while we investigate. Tracked by rdar://143590572.
Since we infer unsafety from a use of a declaration that involves unsafe types in its signature, there isn't a reason to require @unsafe on declaration to restate it. This matches recent revisions of SE-0458.
@swift-ci please smoke test |
|
||
// Escapable and non-escapable annotations imply that the declaration is | ||
// safe. | ||
if (hasNonEscapableAttr(recordDecl) || hasEscapableAttr(recordDecl)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of checking for the attribute explicitly, we should use the ClangTypeEscapability
request.
This will do a couple additional things:
- Inject escapability annotations for the STL
- Calculate the correct escapability for template instantiations (e.g.,
std::vector<non-escapable>
is escapable) considering the conditional escapability annotations - For aggregate types it attempts to infer the escapability based on the fields.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened PR: #79434
After PR #79424 was merged the compiler proper is doing inference on what C++ types should be considered unsafe. Remove the duplicated (and slightly divergent) logic from the importer as we no longer need it and we should have a consistent view of what is considered unsafe. The only divergence left is the old logic that renames some methods to have "Unsafe" in their names. In the future, we want to get rid of this behavior (potentially under a new interop version).
Several improvements to bring the implementation of the strict memory safety mode (SE-0458) into line with the latest proposal revision:
@unsafe
annotation on declarations with unsafe types in their signatures@safe
nor@unsafe
, with Fix-Its to guide the user