NCGenerics: rebuild stdlib from its interface

When a NoncopyableGenericsMismatch happens between the compiler and
stdlib, allow the compiler to rebuild the stdlib from its interface
instead of exiting with an error.
This commit is contained in:
Kavon Farvardin
2024-02-15 15:11:32 -08:00
parent 7e4761a751
commit 08b71e0136
34 changed files with 56 additions and 59 deletions

View File

@@ -3985,7 +3985,7 @@ ConstraintSystem::matchExistentialTypes(Type type1, Type type2,
return getTypeMatchAmbiguous();
}
if (!SWIFT_ENABLE_EXPERIMENTAL_NONCOPYABLE_GENERICS) {
if (!getASTContext().LangOpts.hasFeature(Feature::NoncopyableGenerics)) {
// move-only types (and their metatypes) cannot match with existential types.
if (type1->getMetatypeInstanceType()->isNoncopyable()) {
// tailor error message
@@ -8494,7 +8494,7 @@ ConstraintSystem::SolutionKind ConstraintSystem::simplifyConformsToConstraint(
// FIXME: This is already handled by tuple conformance lookup path and
// should be removed once non-copyable generics are enabled by default.
if (!SWIFT_ENABLE_EXPERIMENTAL_NONCOPYABLE_GENERICS) {
if (!getASTContext().LangOpts.hasFeature(Feature::NoncopyableGenerics)) {
// Copyable is checked structurally, so for better performance, split apart
// this constraint into individual Copyable constraints on each tuple
// element.