@@ -270,7 +270,7 @@ enum BorrowingInstruction : CustomStringConvertible, Hashable {
270270}
271271
272272/// A value that introduces a borrow scope:
273- /// begin_borrow, load_borrow, reborrow, guaranteed function argument.
273+ /// begin_borrow, load_borrow, reborrow, guaranteed function argument, begin_apply, unchecked_ownership_conversion .
274274///
275275/// If the value introduces a local scope, then that scope is
276276/// terminated by scope ending operands. Function arguments do not
@@ -280,19 +280,22 @@ enum BorrowingInstruction : CustomStringConvertible, Hashable {
280280/// one of the yielded values. In any case, the scope ending operands
281281/// are on the end_apply or abort_apply instructions that use the
282282/// token.
283- ///
284- /// Note: equivalent to C++ BorrowedValue, but also handles begin_apply.
285283enum BeginBorrowValue {
286284 case beginBorrow( BeginBorrowInst )
287285 case loadBorrow( LoadBorrowInst )
288286 case beginApply( Value )
287+ case uncheckOwnershipConversion( UncheckedOwnershipConversionInst )
289288 case functionArgument( FunctionArgument )
290289 case reborrow( Phi )
291290
292291 init ? ( _ value: Value ) {
293292 switch value {
294- case let bbi as BeginBorrowInst : self = . beginBorrow( bbi)
295- case let lbi as LoadBorrowInst : self = . loadBorrow( lbi)
293+ case let bbi as BeginBorrowInst :
294+ self = . beginBorrow( bbi)
295+ case let lbi as LoadBorrowInst :
296+ self = . loadBorrow( lbi)
297+ case let uoci as UncheckedOwnershipConversionInst where uoci. ownership == . guaranteed:
298+ self = . uncheckOwnershipConversion( uoci)
296299 case let arg as FunctionArgument where arg. ownership == . guaranteed:
297300 self = . functionArgument( arg)
298301 case let arg as Argument where arg. isReborrow:
@@ -311,6 +314,7 @@ enum BeginBorrowValue {
311314 case . beginBorrow( let bbi) : return bbi
312315 case . loadBorrow( let lbi) : return lbi
313316 case . beginApply( let v) : return v
317+ case . uncheckOwnershipConversion( let uoci) : return uoci
314318 case . functionArgument( let arg) : return arg
315319 case . reborrow( let phi) : return phi. value
316320 }
@@ -347,7 +351,7 @@ enum BeginBorrowValue {
347351
348352 var hasLocalScope : Bool {
349353 switch self {
350- case . beginBorrow, . loadBorrow, . beginApply, . reborrow:
354+ case . beginBorrow, . loadBorrow, . beginApply, . reborrow, . uncheckOwnershipConversion :
351355 return true
352356 case . functionArgument:
353357 return false
@@ -364,7 +368,7 @@ enum BeginBorrowValue {
364368 return beginBorrow. operand
365369 case let . loadBorrow( loadBorrow) :
366370 return loadBorrow. operand
367- case . beginApply, . functionArgument, . reborrow:
371+ case . beginApply, . functionArgument, . reborrow, . uncheckOwnershipConversion :
368372 return nil
369373 }
370374 }
@@ -452,7 +456,7 @@ final class EnclosingValueIterator : IteratorProtocol {
452456 case let . beginBorrow( bbi) :
453457 // Gather the outer enclosing borrow scope.
454458 worklist. pushIfNotVisited ( bbi. borrowedValue)
455- case . loadBorrow, . beginApply, . functionArgument:
459+ case . loadBorrow, . beginApply, . functionArgument, . uncheckOwnershipConversion :
456460 // There is no enclosing value on this path.
457461 break
458462 case . reborrow( let phi) :
0 commit comments