Variadic generics crash when parameter pack is used in a closure's arguments

I'm running into a crash relating to variadic generics that I haven't found a workaround for, and I'm hoping someone with more knowledge of compiler internals can suggest something.

I've reduced the problematic code to:

public protocol EnumSchemaCodable<Value>: Sendable {

  associatedtype Value

  func encode(_ value: Value, to encoder: some Encoder<Self>)

}

public protocol Encoder<Schema> {

  associatedtype Schema: EnumSchemaCodable

  func encode<each AssociatedValue>(
    _ encode: (
      repeat each AssociatedValue
    ) -> Void
  ) where (repeat each AssociatedValue) == Schema.Value

}

private struct Foo: EnumSchemaCodable {

  typealias Value = (String, Int)

  func encode(_ value: Value, to encoder: some Encoder<Self>) {
    // If this is commented out, the crash doesn't happen
    encoder.encode(
      { (first, second) in
      }
    )
  }

}

Which results in the following crash on Swift 6.0:

Building for debugging...
error: compile command failed due to signal 11 (use -v to see invocation)
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump:
0.      Program arguments: /Volumes/Shared/Developer/Xcode/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-frontend -frontend -c -primary-file /Volumes/Shared/Developer/Projects/SadTuple/Sources/SadTuple/SadTuple.swift -emit-dependencies-path /Volumes/Shared/Developer/Projects/SadTuple/.build/arm64-apple-macosx/debug/SadTuple.build/SadTuple.d -emit-reference-dependencies-path /Volumes/Shared/Developer/Projects/SadTuple/.build/arm64-apple-macosx/debug/SadTuple.build/SadTuple.swiftdeps -target arm64-apple-macosx14.0 -Xllvm -aarch64-use-tbi -enable-objc-interop -stack-check -sdk /Volumes/Shared/Developer/Xcode/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.2.sdk -I /Volumes/Shared/Developer/Projects/SadTuple/.build/arm64-apple-macosx/debug/Modules -I /Volumes/Shared/Developer/Xcode/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib -F /Volumes/Shared/Developer/Xcode/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -color-diagnostics -enable-testing -g -debug-info-format=dwarf -dwarf-version=4 -module-cache-path /Volumes/Shared/Developer/Projects/SadTuple/.build/arm64-apple-macosx/debug/ModuleCache -swift-version 6 -Onone -D SWIFT_PACKAGE -D DEBUG -new-driver-path /Volumes/Shared/Developer/Xcode/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-driver -empty-abi-descriptor -resource-dir /Volumes/Shared/Developer/Xcode/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift -enable-anonymous-context-mangled-names -file-compilation-dir /Volumes/Shared/Developer/Projects/SadTuple -Xcc -isysroot -Xcc /Volumes/Shared/Developer/Xcode/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.2.sdk -Xcc -F -Xcc /Volumes/Shared/Developer/Xcode/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -Xcc -fPIC -Xcc -g -module-name SadTuple -package-name sadtuple -disable-clang-spi -target-sdk-version 15.2 -target-sdk-name macosx15.2 -external-plugin-path /Volumes/Shared/Developer/Xcode/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib/swift/host/plugins#/Volumes/Shared/Developer/Xcode/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -external-plugin-path /Volumes/Shared/Developer/Xcode/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/local/lib/swift/host/plugins#/Volumes/Shared/Developer/Xcode/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -plugin-path /Volumes/Shared/Developer/Xcode/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/host/plugins -plugin-path /Volumes/Shared/Developer/Xcode/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/local/lib/swift/host/plugins -parse-as-library -o /Volumes/Shared/Developer/Projects/SadTuple/.build/arm64-apple-macosx/debug/SadTuple.build/SadTuple.swift.o -index-store-path /Volumes/Shared/Developer/Projects/SadTuple/.build/arm64-apple-macosx/debug/index/store -index-system-modules
1.      Apple Swift version 6.0.3 (swiftlang-6.0.3.1.10 clang-1600.0.30.1)
2.      Compiling with the current language version
3.      While evaluating request ASTLoweringRequest(Lowering AST to SIL for file "/Volumes/Shared/Developer/Projects/SadTuple/Sources/SadTuple/SadTuple.swift")
4.      While silgen emitFunction SIL function "@$s8SadTuple3Foo33_B7CE4000642428A090CBF82EDA9BAD5FLLV6encode_2toySS_Sit_xtAA7EncoderRzAD6SchemaRtzlF".
 for 'encode(_:to:)' (at /Volumes/Shared/Developer/Projects/SadTuple/Sources/SadTuple/SadTuple.swift:25:3)
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0  swift-frontend           0x0000000109c16a9c llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1  swift-frontend           0x0000000109c14cf0 llvm::sys::RunSignalHandlers() + 112
2  swift-frontend           0x0000000109c17068 SignalHandler(int) + 292
3  libsystem_platform.dylib 0x0000000193e7ede4 _sigtramp + 56
4  swift-frontend           0x0000000104de6da4 (anonymous namespace)::SubstFunctionTypePatternVisitor::handlePackExpansion(swift::Lowering::AbstractionPattern, swift::CanType) + 264
5  swift-frontend           0x0000000104de6da4 (anonymous namespace)::SubstFunctionTypePatternVisitor::handlePackExpansion(swift::Lowering::AbstractionPattern, swift::CanType) + 264
6  swift-frontend           0x0000000104de6bc8 void llvm::function_ref<void (swift::Lowering::FunctionParamGenerator&)>::callback_fn<(anonymous namespace)::SubstFunctionTypePatternVisitor::handleUnabstractedFunctionType(swift::CanTypeWrapper<swift::AnyFunctionType>, swift::Lowering::AbstractionPattern, swift::CanType, swift::Lowering::AbstractionPattern)::'lambda'(swift::Lowering::FunctionParamGenerator&)>(long, swift::Lowering::FunctionParamGenerator&) + 348
7  swift-frontend           0x0000000104de3d74 swift::Lowering::AbstractionPattern::forEachFunctionParam(swift::ArrayRefView<swift::AnyFunctionType::Param, swift::AnyFunctionType::CanParam, swift::AnyFunctionType::CanParam::getFromParam(swift::AnyFunctionType::Param const&), true>, bool, llvm::function_ref<void (swift::Lowering::FunctionParamGenerator&)>) const + 208
8  swift-frontend           0x0000000104de604c (anonymous namespace)::SubstFunctionTypePatternVisitor::handleUnabstractedFunctionType(swift::CanTypeWrapper<swift::AnyFunctionType>, swift::Lowering::AbstractionPattern, swift::CanType, swift::Lowering::AbstractionPattern) + 136
9  swift-frontend           0x0000000104de5bfc swift::Lowering::AbstractionPattern::getSubstFunctionTypePattern(swift::CanTypeWrapper<swift::AnyFunctionType>, swift::Lowering::TypeConverter&, swift::Lowering::AbstractionPattern, swift::CanType, bool&) const + 236
10 swift-frontend           0x0000000104e2fe60 getSILFunctionType(swift::Lowering::TypeConverter&, swift::TypeExpansionContext, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::AnyFunctionType>, swift::SILExtInfoBuilder, (anonymous namespace)::Conventions const&, swift::ForeignInfo const&, std::__1::optional<swift::SILDeclRef>, std::__1::optional<swift::SILDeclRef>, std::__1::optional<swift::SubstitutionMap>, swift::ProtocolConformanceRef) + 1368
11 swift-frontend           0x0000000104e268f0 getNativeSILFunctionType(swift::Lowering::TypeConverter&, swift::TypeExpansionContext, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::AnyFunctionType>, swift::SILExtInfoBuilder, std::__1::optional<swift::SILDeclRef>, std::__1::optional<swift::SILDeclRef>, std::__1::optional<swift::SubstitutionMap>, swift::ProtocolConformanceRef) + 596
12 swift-frontend           0x0000000104e2a2fc getUncachedSILFunctionTypeForConstant(swift::Lowering::TypeConverter&, swift::TypeExpansionContext, swift::SILDeclRef, swift::Lowering::TypeConverter::LoweredFormalTypes) + 1352
13 swift-frontend           0x0000000104e2ae84 swift::Lowering::TypeConverter::getConstantInfo(swift::TypeExpansionContext, swift::SILDeclRef) + 192
14 swift-frontend           0x0000000104e20644 swift::SILFunctionBuilder::getOrCreateFunction(swift::SILLocation, swift::SILDeclRef, swift::ForDefinition_t, llvm::function_ref<swift::SILFunction* (swift::SILLocation, swift::SILDeclRef)>, swift::ProfileCounter) + 132
15 swift-frontend           0x0000000104fd7c94 swift::Lowering::SILGenModule::getFunction(swift::SILDeclRef, swift::ForDefinition_t) + 440
16 swift-frontend           0x0000000104fe36a0 void llvm::function_ref<void ()>::callback_fn<swift::Lowering::SILGenModule::emitClosure(swift::AbstractClosureExpr*, swift::Lowering::FunctionTypeInfo const&)::$_0>(long) + 92
17 swift-frontend           0x0000000104fdc810 swift::Lowering::SILGenModule::emitClosure(swift::AbstractClosureExpr*, swift::Lowering::FunctionTypeInfo const&) + 280
18 swift-frontend           0x000000010508376c (anonymous namespace)::RValueEmitter::visitAbstractClosureExpr(swift::AbstractClosureExpr*, swift::Lowering::SGFContext) + 1984
19 swift-frontend           0x000000010505f58c swift::Lowering::SILGenFunction::emitRValueAsSingleValue(swift::Expr*, swift::Lowering::SGFContext) + 40
20 swift-frontend           0x000000010503f234 swift::Lowering::SILGenFunction::emitConvertedRValue(swift::SILLocation, swift::Lowering::Conversion const&, swift::Lowering::SGFContext, llvm::function_ref<swift::Lowering::ManagedValue (swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::SGFContext)>) + 316
21 swift-frontend           0x0000000104fbee74 swift::Lowering::ArgumentSource::getConverted(swift::Lowering::SILGenFunction&, swift::Lowering::Conversion const&, swift::Lowering::SGFContext) && + 136
22 swift-frontend           0x0000000104ffe25c (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern, std::__1::optional<swift::AnyFunctionType::Param>) + 5528
23 swift-frontend           0x0000000104fec0f0 (anonymous namespace)::ArgEmitter::emitSingleArg(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern, std::__1::optional<swift::AnyFunctionType::Param>) + 216
24 swift-frontend           0x0000000104ffc9ac (anonymous namespace)::ArgEmitter::emitPreparedArgs(swift::Lowering::PreparedArguments&&, swift::Lowering::AbstractionPattern) + 256
25 swift-frontend           0x0000000105008878 (anonymous namespace)::CallSite::emit(swift::Lowering::SILGenFunction&, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::SILFunctionType>, (anonymous namespace)::ParamLowering&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::SmallVectorImpl<(anonymous namespace)::DelayedArgument>&, swift::ForeignInfo const&) && + 664
26 swift-frontend           0x0000000105008298 (anonymous namespace)::CallEmission::emitArgumentsForNormalApply(swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::SILFunctionType>, swift::ForeignInfo const&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, std::__1::optional<swift::SILLocation>&) + 1000
27 swift-frontend           0x0000000104ff0e7c (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 2028
28 swift-frontend           0x0000000104fef408 swift::Lowering::SILGenFunction::emitApplyExpr(swift::ApplyExpr*, swift::Lowering::SGFContext) + 3116
29 swift-frontend           0x000000010505fc74 swift::Lowering::SILGenFunction::emitIgnoredExpr(swift::Expr*) + 888
30 swift-frontend           0x0000000105117274 swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 5512
31 swift-frontend           0x000000010508efc8 swift::Lowering::SILGenFunction::emitFunction(swift::FuncDecl*) + 492
32 swift-frontend           0x0000000104fdab1c swift::Lowering::SILGenModule::emitFunctionDefinition(swift::SILDeclRef, swift::SILFunction*) + 8420
33 swift-frontend           0x0000000104fdb3bc swift::Lowering::SILGenModule::emitOrDelayFunction(swift::SILDeclRef) + 216
34 swift-frontend           0x0000000104fd89ec swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 364
35 swift-frontend           0x000000010512ec8c (anonymous namespace)::SILGenType::visitFuncDecl(swift::FuncDecl*) + 32
36 swift-frontend           0x000000010512b234 (anonymous namespace)::SILGenType::emitType() + 424
37 swift-frontend           0x0000000104fd8624 swift::ASTVisitor<swift::Lowering::SILGenModule, void, void, void, void, void, void>::visit(swift::Decl*) + 104
38 swift-frontend           0x0000000104fdf038 swift::ASTLoweringRequest::evaluate(swift::Evaluator&, swift::ASTLoweringDescriptor) const + 1804
39 swift-frontend           0x000000010511592c swift::SimpleRequest<swift::ASTLoweringRequest, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>> (swift::ASTLoweringDescriptor), (swift::RequestFlags)9>::evaluateRequest(swift::ASTLoweringRequest const&, swift::Evaluator&) + 196
40 swift-frontend           0x0000000104fe3f14 swift::ASTLoweringRequest::OutputType swift::Evaluator::getResultUncached<swift::ASTLoweringRequest, swift::ASTLoweringRequest::OutputType swift::evaluateOrFatal<swift::ASTLoweringRequest>(swift::Evaluator&, swift::ASTLoweringRequest)::'lambda'()>(swift::ASTLoweringRequest const&, swift::ASTLoweringRequest::OutputType swift::evaluateOrFatal<swift::ASTLoweringRequest>(swift::Evaluator&, swift::ASTLoweringRequest)::'lambda'()) + 528
41 swift-frontend           0x00000001045bdb90 swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 920
42 swift-frontend           0x00000001045c0e88 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 1684
43 swift-frontend           0x00000001045bfbb4 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3572
44 swift-frontend           0x0000000104546a5c swift::mainEntry(int, char const**) + 3680
45 dyld                     0x0000000193ac8274 start + 2840

I filed a bug but was hoping someone here could recommend a workaround.

Thanks!