@@ -270,7 +270,7 @@ enum BorrowingInstruction : CustomStringConvertible, Hashable {
270
270
}
271
271
272
272
/// 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 .
274
274
///
275
275
/// If the value introduces a local scope, then that scope is
276
276
/// terminated by scope ending operands. Function arguments do not
@@ -280,19 +280,22 @@ enum BorrowingInstruction : CustomStringConvertible, Hashable {
280
280
/// one of the yielded values. In any case, the scope ending operands
281
281
/// are on the end_apply or abort_apply instructions that use the
282
282
/// token.
283
- ///
284
- /// Note: equivalent to C++ BorrowedValue, but also handles begin_apply.
285
283
enum BeginBorrowValue {
286
284
case beginBorrow( BeginBorrowInst )
287
285
case loadBorrow( LoadBorrowInst )
288
286
case beginApply( Value )
287
+ case uncheckOwnershipConversion( UncheckedOwnershipConversionInst )
289
288
case functionArgument( FunctionArgument )
290
289
case reborrow( Phi )
291
290
292
291
init ? ( _ value: Value ) {
293
292
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)
296
299
case let arg as FunctionArgument where arg. ownership == . guaranteed:
297
300
self = . functionArgument( arg)
298
301
case let arg as Argument where arg. isReborrow:
@@ -311,6 +314,7 @@ enum BeginBorrowValue {
311
314
case . beginBorrow( let bbi) : return bbi
312
315
case . loadBorrow( let lbi) : return lbi
313
316
case . beginApply( let v) : return v
317
+ case . uncheckOwnershipConversion( let uoci) : return uoci
314
318
case . functionArgument( let arg) : return arg
315
319
case . reborrow( let phi) : return phi. value
316
320
}
@@ -347,7 +351,7 @@ enum BeginBorrowValue {
347
351
348
352
var hasLocalScope : Bool {
349
353
switch self {
350
- case . beginBorrow, . loadBorrow, . beginApply, . reborrow:
354
+ case . beginBorrow, . loadBorrow, . beginApply, . reborrow, . uncheckOwnershipConversion :
351
355
return true
352
356
case . functionArgument:
353
357
return false
@@ -364,7 +368,7 @@ enum BeginBorrowValue {
364
368
return beginBorrow. operand
365
369
case let . loadBorrow( loadBorrow) :
366
370
return loadBorrow. operand
367
- case . beginApply, . functionArgument, . reborrow:
371
+ case . beginApply, . functionArgument, . reborrow, . uncheckOwnershipConversion :
368
372
return nil
369
373
}
370
374
}
@@ -452,7 +456,7 @@ final class EnclosingValueIterator : IteratorProtocol {
452
456
case let . beginBorrow( bbi) :
453
457
// Gather the outer enclosing borrow scope.
454
458
worklist. pushIfNotVisited ( bbi. borrowedValue)
455
- case . loadBorrow, . beginApply, . functionArgument:
459
+ case . loadBorrow, . beginApply, . functionArgument, . uncheckOwnershipConversion :
456
460
// There is no enclosing value on this path.
457
461
break
458
462
case . reborrow( let phi) :
0 commit comments