Closed
Description
Description
When trying to borrow parameter pack arguments to a function the compiler emits an error Unhandled SIL Instruction: %17 = pack_element_get %14 of %0 : $*Pack{repeat each Content} as $*@pack_element("3E6B6F3A-9D37-11EF-A5CC-8E64AD80DB88") each Content // user: %19
and then:
1. Apple Swift version 6.0 (swiftlang-6.0.0.9.11 clang-1600.0.26.2)
2. Compiling with the current language version
3. While evaluating request ExecuteSILPipelineRequest(Run pipelines { Mandatory Diagnostic Passes + Enabling Optimization Passes } on SIL for XXX)
4. While running pass #173 SILFunctionTransform "MoveOnlyTypeEliminator" on SILFunction "@$s14SwiftAnimator39ProxyfierO7proxyfy_8callbackyxxQp_yAA11ObjectProxyVyxGxQpXEtRvzs12IdentifiableRzlFZ".
for 'proxyfy(_:callback:)' (at /Users/XXX/Sources/XXX.swift:12:5)
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 0x000000010670a9dc llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1 swift-frontend 0x0000000106708c30 llvm::sys::RunSignalHandlers() + 112
2 swift-frontend 0x000000010670afa8 SignalHandler(int) + 292
3 libsystem_platform.dylib 0x000000019b2d4184 _sigtramp + 56
4 swift-frontend 0x0000000101eea75c swift::SILInstructionVisitor<(anonymous namespace)::SILMoveOnlyWrappedTypeEliminatorVisitor, bool>::visitAllocPackInst(swift::AllocPackInst*) + 40
5 swift-frontend 0x0000000101ee9f64 (anonymous namespace)::SILMoveOnlyWrappedTypeEliminatorPass::run() + 5552
6 swift-frontend 0x0000000101ef6bcc swift::SILPassManager::runFunctionPasses(unsigned int, unsigned int) + 3448
7 swift-frontend 0x0000000101ef31b0 swift::SILPassManager::executePassPipelinePlan(swift::SILPassPipelinePlan const&) + 11968
8 swift-frontend 0x0000000101f2c6fc swift::SimpleRequest<swift::ExecuteSILPipelineRequest, std::__1::tuple<> (swift::SILPipelineExecutionDescriptor), (swift::RequestFlags)1>::evaluateRequest(swift::ExecuteSILPipelineRequest const&, swift::Evaluator&) + 56
9 swift-frontend 0x0000000101f10060 swift::ExecuteSILPipelineRequest::OutputType swift::Evaluator::getResultUncached<swift::ExecuteSILPipelineRequest, swift::ExecuteSILPipelineRequest::OutputType swift::evaluateOrFatal<swift::ExecuteSILPipelineRequest>(swift::Evaluator&, swift::ExecuteSILPipelineRequest)::'lambda'()>(swift::ExecuteSILPipelineRequest const&, swift::ExecuteSILPipelineRequest::OutputType swift::evaluateOrFatal<swift::ExecuteSILPipelineRequest>(swift::Evaluator&, swift::ExecuteSILPipelineRequest)::'lambda'()) + 412
10 swift-frontend 0x0000000101f127dc swift::runSILDiagnosticPasses(swift::SILModule&) + 612
11 swift-frontend 0x0000000101489298 swift::CompilerInstance::performSILProcessing(swift::SILModule*) + 84
12 swift-frontend 0x00000001010b403c performCompileStepsPostSILGen(swift::CompilerInstance&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>>, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, int&, swift::FrontendObserver*) + 1376
13 swift-frontend 0x00000001010b3248 swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 984
14 swift-frontend 0x00000001010b64fc performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 1680
15 swift-frontend 0x00000001010b522c swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3572
16 swift-frontend 0x000000010103c2f0 swift::mainEntry(int, char const**) + 3680
17 dyld 0x000000019af1c274 start + 2840
Reproduction
struct ObjectProxy<Element: Identifiable> {
let elementId: Element.ID
}
struct Thing: Identifiable {
let id: Int
}
enum Proxyfier {
static func proxyfy<each Content>(_ content: repeat borrowing each Content, callback: (repeat ObjectProxy<each Content>) -> Void) -> Void {
let proxied = (repeat Self.proxyfyObject(element: each content))
callback(repeat each proxied)
}
private static func proxyfyObject<T>(element: borrowing T) -> ObjectProxy<T> {
ObjectProxy(elementId: element.id)
}
func test() {
Self.proxyfy(Thing(id: 1), Thing(id: 2), Thing(id: 3)) { a, _, _ in
let s = a.elementId
}
}
}
Expected behavior
I'm assuming each parameter should be borrowed
Environment
Apple Swift version 6.0.2 (swift-6.0.2-RELEASE)
Target: arm64-apple-macosx15.0
Additional information
No response