@@ -3196,15 +3196,18 @@ void TypeConverter::verifyTrivialLowering(const TypeLowering &lowering,
3196
3196
if (hasNoNonconformingNode) {
3197
3197
llvm::errs () << " Trivial type without a BitwiseCopyable conformance!?:\n "
3198
3198
<< substType << " \n "
3199
- << " of " << origType << " \n " ;
3199
+ << " of " << origType << " \n "
3200
+ << " Disable this validation with -Xllvm "
3201
+ " -type-lowering-disable-verification.\n " ;
3200
3202
assert (false );
3201
3203
}
3202
3204
}
3203
3205
3204
3206
if (!lowering.isTrivial () && conformance) {
3205
- // A non-trivial type can have a conformance in one case :
3207
+ // A non-trivial type can have a conformance in a few cases :
3206
3208
// (1) contains a conforming archetype
3207
3209
// (2) is resilient with minimal expansion
3210
+ // (3) containing or being ~Escapable
3208
3211
bool hasNoConformingArchetypeNode = visitAggregateLeaves (
3209
3212
origType, substType, forExpansion,
3210
3213
/* isLeaf=*/
@@ -3217,6 +3220,12 @@ void TypeConverter::verifyTrivialLowering(const TypeLowering &lowering,
3217
3220
ResilienceExpansion::Minimal) {
3218
3221
return true ;
3219
3222
}
3223
+ // A type that may not be escapable is non-trivial but can conform
3224
+ // (case (3)).
3225
+ if (nominal &&
3226
+ nominal->canBeEscapable () != TypeDecl::CanBeInvertible::Always) {
3227
+ return true ;
3228
+ }
3220
3229
// Walk into every aggregate.
3221
3230
return false ;
3222
3231
},
@@ -3236,6 +3245,13 @@ void TypeConverter::verifyTrivialLowering(const TypeLowering &lowering,
3236
3245
return false ;
3237
3246
}
3238
3247
3248
+ // A type that may not be escapable is non-trivial but can conform
3249
+ // (case (3)).
3250
+ if (nominal &&
3251
+ nominal->canBeEscapable () != TypeDecl::CanBeInvertible::Always) {
3252
+ return false ;
3253
+ }
3254
+
3239
3255
// An archetype may conform but be non-trivial (case (1)).
3240
3256
if (origTy.isTypeParameter ())
3241
3257
return false ;
@@ -3246,7 +3262,9 @@ void TypeConverter::verifyTrivialLowering(const TypeLowering &lowering,
3246
3262
llvm::errs () << " Non-trivial type with _BitwiseCopyable conformance!?:\n "
3247
3263
<< substType << " \n " ;
3248
3264
conformance.print (llvm::errs ());
3249
- llvm::errs () << " \n " ;
3265
+ llvm::errs () << " \n "
3266
+ << " Disable this validation with -Xllvm "
3267
+ " -type-lowering-disable-verification.\n " ;
3250
3268
assert (false );
3251
3269
}
3252
3270
}
0 commit comments