File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ extension OutputSpan where Element: ~Copyable {
8383 /// The number of initialized elements in this span.
8484 @_alwaysEmitIntoClient
8585 @_semantics ( " fixed_storage.get_count " )
86- public var count : Int { _count }
86+ public var count : Int { _assumeNonNegative ( _count) }
8787
8888 /// The number of additional elements that can be added to this span.
8989 @_alwaysEmitIntoClient
@@ -224,7 +224,7 @@ extension OutputSpan where Element: ~Copyable {
224224 /// The range of initialized positions for this `OutputSpan`.
225225 @_alwaysEmitIntoClient
226226 public var indices : Range < Index > {
227- unsafe Range( _uncheckedBounds: ( 0 , _count ) )
227+ unsafe Range( _uncheckedBounds: ( 0 , count ) )
228228 }
229229
230230 // SILOptimizer looks for fixed_storage.check_index semantics for bounds check optimizations.
Original file line number Diff line number Diff line change @@ -237,3 +237,12 @@ public func output_span_init_all_bitwisecopyable<T: P & BitwiseCopyable>(_ os: i
237237 }
238238}
239239
240+ // CHECK-SIL-LABEL: sil @$s31mutable_span_bounds_check_tests22outputspan_get_elementySis10OutputSpanVySiG_SitF :
241+ // CHECK-SIL: [[REG1:%.*]] = struct_extract %0, #OutputSpan._count
242+ // CHECK-SIL: [[REG2:%.*]] = struct_extract [[REG1]], #Int._value
243+ // CHECK-SIL: [[REG3:%.*]] = builtin "assumeNonNegative_Int64"([[REG2]]) : $Builtin.Int64
244+ // CHECK-SIL-LABEL:} // end sil function '$s31mutable_span_bounds_check_tests22outputspan_get_elementySis10OutputSpanVySiG_SitF'
245+ public func outputspan_get_element( _ v: borrowing OutputSpan < Int > , _ i: Int ) -> Int {
246+ return v [ i]
247+ }
248+
You can’t perform that action at this time.
0 commit comments