@@ -3196,15 +3196,18 @@ void TypeConverter::verifyTrivialLowering(const TypeLowering &lowering,
31963196 if (hasNoNonconformingNode) {
31973197 llvm::errs () << " Trivial type without a BitwiseCopyable conformance!?:\n "
31983198 << substType << " \n "
3199- << " of " << origType << " \n " ;
3199+ << " of " << origType << " \n "
3200+ << " Disable this validation with -Xllvm "
3201+ " -type-lowering-disable-verification.\n " ;
32003202 assert (false );
32013203 }
32023204 }
32033205
32043206 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 :
32063208 // (1) contains a conforming archetype
32073209 // (2) is resilient with minimal expansion
3210+ // (3) containing or being ~Escapable
32083211 bool hasNoConformingArchetypeNode = visitAggregateLeaves (
32093212 origType, substType, forExpansion,
32103213 /* isLeaf=*/
@@ -3217,6 +3220,12 @@ void TypeConverter::verifyTrivialLowering(const TypeLowering &lowering,
32173220 ResilienceExpansion::Minimal) {
32183221 return true ;
32193222 }
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+ }
32203229 // Walk into every aggregate.
32213230 return false ;
32223231 },
@@ -3236,6 +3245,13 @@ void TypeConverter::verifyTrivialLowering(const TypeLowering &lowering,
32363245 return false ;
32373246 }
32383247
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+
32393255 // An archetype may conform but be non-trivial (case (1)).
32403256 if (origTy.isTypeParameter ())
32413257 return false ;
@@ -3246,7 +3262,9 @@ void TypeConverter::verifyTrivialLowering(const TypeLowering &lowering,
32463262 llvm::errs () << " Non-trivial type with _BitwiseCopyable conformance!?:\n "
32473263 << substType << " \n " ;
32483264 conformance.print (llvm::errs ());
3249- llvm::errs () << " \n " ;
3265+ llvm::errs () << " \n "
3266+ << " Disable this validation with -Xllvm "
3267+ " -type-lowering-disable-verification.\n " ;
32503268 assert (false );
32513269 }
32523270 }
0 commit comments