@@ -293,7 +293,7 @@ struct StackLayout {
293293 }
294294}
295295
296- struct InstructionTranslator : InstructionVisitor {
296+ struct InstructionTranslator: ~ Copyable , InstructionVisitor {
297297 typealias Output = Void
298298
299299 typealias LabelRef = Int
@@ -526,15 +526,15 @@ struct InstructionTranslator: InstructionVisitor {
526526 }
527527 }
528528
529- fileprivate struct ISeqBuilder {
529+ fileprivate struct ISeqBuilder: ~ Copyable {
530530 typealias InstructionFactoryWithLabel = (
531- ISeqBuilder ,
531+ borrowing ISeqBuilder ,
532532 // The position of the next slot of the creating instruction
533533 _ source: MetaProgramCounter ,
534534 // The position of the resolved label
535535 _ target: MetaProgramCounter
536536 ) -> ( WasmKit . Instruction )
537- typealias BrTableEntryFactory = ( ISeqBuilder , MetaProgramCounter ) -> Instruction . BrTableOperand . Entry
537+ typealias BrTableEntryFactory = ( borrowing ISeqBuilder , MetaProgramCounter ) -> Instruction . BrTableOperand . Entry
538538 typealias BuildingBrTable = UnsafeMutableBufferPointer < Instruction . BrTableOperand . Entry >
539539
540540 enum OnPinAction {
@@ -639,7 +639,7 @@ struct InstructionTranslator: InstructionVisitor {
639639 }
640640 }
641641
642- func finalize( ) -> [ UInt64 ] {
642+ consuming func finalize( ) -> [ UInt64 ] {
643643 return instructions
644644 }
645645
@@ -707,7 +707,7 @@ struct InstructionTranslator: InstructionVisitor {
707707 line: UInt = #line,
708708 make:
709709 @escaping (
710- ISeqBuilder ,
710+ borrowing ISeqBuilder ,
711711 // The position of the next slot of the creating instruction
712712 _ source: MetaProgramCounter ,
713713 // The position of the resolved label
@@ -1077,7 +1077,7 @@ struct InstructionTranslator: InstructionVisitor {
10771077 try valueStack. truncate ( height: currentFrame. stackHeight)
10781078 }
10791079
1080- private mutating func finalize( ) throws -> InstructionSequence {
1080+ private consuming func finalize( ) throws -> InstructionSequence {
10811081 if controlStack. numberOfFrames > 1 {
10821082 throw ValidationError ( . expectedMoreEndInstructions( count: controlStack. numberOfFrames - 1 ) )
10831083 }
@@ -1102,7 +1102,7 @@ struct InstructionTranslator: InstructionVisitor {
11021102 // MARK: Main entry point
11031103
11041104 /// Translate a Wasm expression into a sequence of instructions.
1105- mutating func translate( code: Code ) throws -> InstructionSequence {
1105+ consuming func translate( code: Code ) throws -> InstructionSequence {
11061106 if isIntercepting {
11071107 // Emit `onEnter` instruction at the beginning of the function
11081108 emit ( . onEnter( functionIndex) )
0 commit comments