Avatar
Avatar
Iceman
@swift-5.7.3 @rethrows protocol RethrowsIterator { func next() throws -> Int? } struct NonfailableIter: RethrowsIterator { func next() -> Int? { return 1 } } struct FailableIter: RethrowsIterator { func next() throws -> Int? { return 1 } } func callNextRethrows<T: RethrowsIterator>(_ iter: inout T) rethrows -> Int? { try iter.next() } var it = NonfailableIter() _ = callNextRethrows(&it) var it2 = FailableIter() _ = try callNextRethrows(&it2) (edited)
no output (edited)