Avatar
@swift-5.7.3 @swift-5.6.3 @rethrows internal protocol _ErrorMechanism { associatedtype Output func get() throws -> Output } extension _ErrorMechanism { internal func _rethrowGet() rethrows -> Output { return try get() } } extension Result: _ErrorMechanism { } @rethrows protocol P { func foo() throws } struct S1: P { func foo() {} } struct E: Error {} func foo<T: P>(_: T.Type) rethrows { _ = try Result<Int, Error>.failure(E())._rethrowGet() } print("start program") foo(S1.self) print("end program") (edited)