@@ -63,26 +63,26 @@ extension CxxSpan {
6363 /// Creates a C++ span from a Swift UnsafeBufferPointer
6464 @inlinable
6565 public init ( _ unsafeBufferPointer: UnsafeBufferPointer < Element > ) {
66- precondition ( unsafeBufferPointer. baseAddress != nil ,
66+ unsafe precondition( unsafeBufferPointer. baseAddress != nil ,
6767 " UnsafeBufferPointer should not point to nil " )
68- self . init ( unsafeBufferPointer. baseAddress!, Size ( unsafeBufferPointer. count) )
68+ unsafe self. init ( unsafeBufferPointer. baseAddress!, Size ( unsafeBufferPointer. count) )
6969 }
7070
7171 @inlinable
7272 public init ( _ unsafeMutableBufferPointer: UnsafeMutableBufferPointer < Element > ) {
73- precondition ( unsafeMutableBufferPointer. baseAddress != nil ,
73+ unsafe precondition( unsafeMutableBufferPointer. baseAddress != nil ,
7474 " UnsafeMutableBufferPointer should not point to nil " )
75- self . init ( unsafeMutableBufferPointer. baseAddress!, Size ( unsafeMutableBufferPointer. count) )
75+ unsafe self. init ( unsafeMutableBufferPointer. baseAddress!, Size ( unsafeMutableBufferPointer. count) )
7676 }
7777
7878 @available ( SwiftStdlib 6 . 1 , * )
7979 @inlinable
8080 @unsafe
8181 public init ( _ span: Span < Element > ) {
82- let ( p, c) = unsafeBitCast ( span, to: ( UnsafeRawPointer? , Int) . self)
83- precondition ( p != nil , " Span should not point to nil " )
84- let binding = p!. bindMemory ( to: Element . self, capacity: c)
85- self . init ( binding, Size ( c) )
82+ let ( p, c) = unsafe unsafeBitCast( span, to: ( UnsafeRawPointer? , Int) . self)
83+ unsafe precondition( p != nil , " Span should not point to nil " )
84+ let binding = unsafe p! . bindMemory ( to: Element . self, capacity: c)
85+ unsafe self. init ( binding, Size ( c) )
8686 }
8787}
8888
@@ -94,10 +94,10 @@ extension Span {
9494 public init < T: CxxSpan < Element > > (
9595 _unsafeCxxSpan span: borrowing T ,
9696 ) {
97- let buffer = UnsafeBufferPointer ( start: span. __dataUnsafe ( ) , count: Int ( span. size ( ) ) )
97+ let buffer = unsafe UnsafeBufferPointer( start: span. __dataUnsafe ( ) , count: Int ( span. size ( ) ) )
9898 let newSpan = Span ( _unsafeElements: buffer)
9999 // 'self' is limited to the caller's scope of the variable passed to the 'span' argument.
100- self = _overrideLifetime ( newSpan, borrowing: span)
100+ self = unsafe _override Lifetime ( newSpan, borrowing: span)
101101 }
102102}
103103
@@ -113,8 +113,8 @@ extension CxxMutableSpan {
113113 /// Creates a C++ span from a Swift UnsafeMutableBufferPointer
114114 @inlinable
115115 public init ( _ unsafeMutableBufferPointer: UnsafeMutableBufferPointer < Element > ) {
116- precondition ( unsafeMutableBufferPointer. baseAddress != nil ,
116+ unsafe precondition( unsafeMutableBufferPointer. baseAddress != nil ,
117117 " UnsafeMutableBufferPointer should not point to nil " )
118- self . init ( unsafeMutableBufferPointer. baseAddress!, Size ( unsafeMutableBufferPointer. count) )
118+ unsafe self. init ( unsafeMutableBufferPointer. baseAddress!, Size ( unsafeMutableBufferPointer. count) )
119119 }
120120}
0 commit comments