Skip to content

Merge main 2022-05-20 #4579

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 36 commits into from
May 21, 2022
Merged

Merge main 2022-05-20 #4579

merged 36 commits into from
May 21, 2022

Conversation

kateinoigakukun
Copy link
Member

No description provided.

ahoppen and others added 30 commits April 8, 2022 10:44
…ncelling

This fixes a race-conditioned deadlock which could occur while cancelling SourceKit AST build request

We have one thread that claimed `CancellationRequestCallbackMtx` in `SwiftASTConsumer::requestCancellation` and wants to claim `ConsumersAndResultMtx` in `ASTBuildOperation::requestConsumerCancellation`

Another thread claimed `ConsumersAndResultMtx` in `ASTBuildOperation::schedule` and now wants to claim `CancellationRequestCallbackMtx` in `SwiftASTConsumer::removeCancellationRequestCallback`.

In both cases we could actually release one lock before claiming the other.

Fixes rdar://90870793
Calling `typeCheckDecl` on `VarDecl` is what triggers re-declaration
checking and that was skipped by the solution application logic.
If all solutions point to the same overload choice that needs
re-labeling it's safe to diagnose it as if there was no ambiguity
because the call site is static.
Change the way swiftmodules built against a different SDK than their
clients are rejected. This makes them silently ignored when the module
can be rebuilt from their swiftinterface, instead of reporting a hard
error.

rdar://93257769
…lers

Only production compilers should apply the per-SDK restriction on
loading swiftmodules. Use the "is the compiler tagged" information over
a release build to align with the other main swiftmodule loading
restriction accepting only swiftmodules built by the same tag.

Also use an env var SWIFT_DEBUG_FORCE_SWIFTMODULE_PER_SDK to enable
testing this feature in any compilers.
…lidation fixes in 5.7

Swift 5.7 added stronger index validation for `String`, so some illegal cases that previously triggered inconsistently diagnosed out of bounds accesses now result in reliable runtime errors. Similarly, attempts at applying an index originally vended by a UTF-8 string on a UTF-16 string now result in a reliable runtime error.

As is usually the case, new traps to the stdlib exposes code that contains previously undiagnosed / unreliably diagnosed coding issues.

Allow invalid code in binaries built with earlier versions of the stdlib to continue running with the 5.7 library by disabling some of the new traps based on the version of Swift the binary was built with.

In the case of an index encoding mismatch, allow transcoding of string storage regardless of the direction of the mismatch. (Previously we only allowed transcoding a UTF-8 string to UTF-16.)

rdar://93379333
…holders during ambiguity

Since conjunction is not going to continue current solver path
after discovering an ambiguity, let's just mark all of the
unbound outer variables as placeholders to produce a complete solution.
If missing member is found in e.g. case statement or a pattern,
let's attach diagnostic directly to it.
While producing a combined solution, let's reflect the number of
fixes and holes discovered in the conjunction, that way it would
be possible to filter solutions and keep track of the fact that
there were issues in the conjunction.
This was an incorrect locator since constraints do belong to a sequence
expression and not to a contextual pattern.
…karounds

[stdlib] Work around binary compatibility issues with String index validation fixes in 5.7
To inject a modulemap into the libstdc++ directory, Swift needs to know the path of the libstdc++ installation. Previously it was assumed to be `/usr/include/c++/{version}`, however, this might not be the case. For example, on CentOS the stdlib is located at `/opt/rh/devtoolset-{version}/root/usr/include/c++/{version}`.

This change teaches Swift to extract the libstdc++ include paths from the Clang driver, and fixes C++ stdlib lookup on CentOS.

rdar://93341210
…-improvements

[ConstraintSystem] A couple of improvements to multi-statement closure handling
…n statements

Type finder is still allowed to walk into closures to find any
referenced variables, but it should bring external result type
into scope only if a particular `return` belongs to the same
closure as the element.
…nostic

[Diagnostics] Diagnose re-labeling failures in ambiguity conditions
…losures

[CSClosure] Diagnose invalid re-declarations in multi-statement closures
…t-reject

[Serialization] Soft-reject swiftmodules built against a different SDK on tagged compilers
…emove the OS versions for other platforms from availability attributes.

Upcoming changes to the diagnostics make it difficult to verify correct behavior when only matching a fraction of a diagnostic, so the test needs to run on a single platform in order to have stable diagnostics to match. The `availability_refinement_contexts_target_min_inlining.swift` test case runs on all ABI stable platforms and verifies that an appropriate version floor is used for each, so running this test suite on multiple platforms is somewhat redundant.
…ve clarity for authors of API libraries. When decls are diagnosed as potentially unavailable on an OS earlier than the deployment target, the message will now indicate that the issue would be faced by clients of the module.

Resolves rdar://93466875
[Serialization] Bump SWIFTMODULE_VERSION_MINOR to avoid conflict with SDK's swiftmodule.
[CSClosure] Fix per-element variable finder to correctly handle retur…
…-unavailable-to-clients-of-module

Sema: Improve availability diagnostics when `-target-min-inlining-version min` is specified
…lation

[SourceKit] Resolve a nondeterministic deadlock in SourceKit while cancelling
[cxx-interop] Extract libstdc++ installation path from Clang
aschwaighofer and others added 6 commits May 19, 2022 05:37
…tributed_actor_init_local

[wrangler] Unconditionally disable test/Distributed/Runtime/distributed_actor_init_local for now
Conformance Infos for nominal type declarations reference the conforming type by storing an offset to the address in the binary where the type's type descriptor is located. Conformance infos for conformances applied to an extension of a type use a different mechanism: they use an indirect reference to a dynamic symbol, which may be an external symbol **or** a resolved address to a local type descriptor. It is the latter case that the conformance-gather implementation was missing that is added in this PR.

Resolves rdar://93578419
…xtraction

[Static Mirror] Gather local type extension conformance infos correctly
…dlib

[stdlib] Define version 5.8 of the stdlib
@kateinoigakukun kateinoigakukun merged commit 8773be3 into swiftwasm May 21, 2022
@kateinoigakukun kateinoigakukun deleted the katei/merge-main-2022-05-20 branch July 6, 2022 03:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.