@@ -63,26 +63,26 @@ extension CxxSpan {
63
63
/// Creates a C++ span from a Swift UnsafeBufferPointer
64
64
@inlinable
65
65
public init ( _ unsafeBufferPointer: UnsafeBufferPointer < Element > ) {
66
- precondition ( unsafeBufferPointer. baseAddress != nil ,
66
+ unsafe precondition( unsafeBufferPointer. baseAddress != nil ,
67
67
" UnsafeBufferPointer should not point to nil " )
68
- self . init ( unsafeBufferPointer. baseAddress!, Size ( unsafeBufferPointer. count) )
68
+ unsafe self. init ( unsafeBufferPointer. baseAddress!, Size ( unsafeBufferPointer. count) )
69
69
}
70
70
71
71
@inlinable
72
72
public init ( _ unsafeMutableBufferPointer: UnsafeMutableBufferPointer < Element > ) {
73
- precondition ( unsafeMutableBufferPointer. baseAddress != nil ,
73
+ unsafe precondition( unsafeMutableBufferPointer. baseAddress != nil ,
74
74
" UnsafeMutableBufferPointer should not point to nil " )
75
- self . init ( unsafeMutableBufferPointer. baseAddress!, Size ( unsafeMutableBufferPointer. count) )
75
+ unsafe self. init ( unsafeMutableBufferPointer. baseAddress!, Size ( unsafeMutableBufferPointer. count) )
76
76
}
77
77
78
78
@available ( SwiftStdlib 6 . 1 , * )
79
79
@inlinable
80
80
@unsafe
81
81
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) )
86
86
}
87
87
}
88
88
@@ -94,10 +94,10 @@ extension Span {
94
94
public init < T: CxxSpan < Element > > (
95
95
_unsafeCxxSpan span: borrowing T ,
96
96
) {
97
- let buffer = UnsafeBufferPointer ( start: span. __dataUnsafe ( ) , count: Int ( span. size ( ) ) )
97
+ let buffer = unsafe UnsafeBufferPointer( start: span. __dataUnsafe ( ) , count: Int ( span. size ( ) ) )
98
98
let newSpan = Span ( _unsafeElements: buffer)
99
99
// '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)
101
101
}
102
102
}
103
103
@@ -113,8 +113,8 @@ extension CxxMutableSpan {
113
113
/// Creates a C++ span from a Swift UnsafeMutableBufferPointer
114
114
@inlinable
115
115
public init ( _ unsafeMutableBufferPointer: UnsafeMutableBufferPointer < Element > ) {
116
- precondition ( unsafeMutableBufferPointer. baseAddress != nil ,
116
+ unsafe precondition( unsafeMutableBufferPointer. baseAddress != nil ,
117
117
" UnsafeMutableBufferPointer should not point to nil " )
118
- self . init ( unsafeMutableBufferPointer. baseAddress!, Size ( unsafeMutableBufferPointer. count) )
118
+ unsafe self. init ( unsafeMutableBufferPointer. baseAddress!, Size ( unsafeMutableBufferPointer. count) )
119
119
}
120
120
}
0 commit comments