Skip to content

Commit 37e7d1c

Browse files
committed
Merge remote-tracking branch 'origin/master' into master-next
2 parents 4bb1565 + 6378079 commit 37e7d1c

File tree

7,280 files changed

+13717
-12678
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

7,280 files changed

+13717
-12678
lines changed

CHANGELOG.md

Lines changed: 35 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,33 @@ CHANGELOG
2020
Swift 3.1
2121
---------
2222

23+
* The `withoutActuallyEscaping` function from [SE-0103][] has been implemented.
24+
To pass off a non-escaping closure to an API that formally takes an
25+
`@escaping` closure, but which is used in a way that will not in fact
26+
escape it in practice, use `withoutActuallyEscaping` to get an escapable
27+
copy of the closure and delimit its expected lifetime. For example:
28+
29+
```swift
30+
func doSimultaneously(_ f: () -> (), and g: () -> (), on q: DispatchQueue) {
31+
// DispatchQueue.async normally has to be able to escape its closure
32+
// since it may be called at any point after the operation is queued.
33+
// By using a barrier, we ensure it does not in practice escape.
34+
withoutActuallyEscaping(f) { escapableF in
35+
withoutActuallyEscaping(g) { escapableG in
36+
q.async(escapableF)
37+
q.async(escapableG)
38+
q.sync(flags: .barrier) {}
39+
}
40+
}
41+
// `escapableF` and `escapableG` must be dequeued by the point
42+
// `withoutActuallyEscaping` returns.
43+
}
44+
```
45+
46+
The old workaround of using `unsafeBitCast` to cast to an `@escaping` type
47+
is not guaranteed to work in future versions of Swift, and will
48+
now raise a warning.
49+
2350
* [SR-1446](https://bugs.swift.org/browse/SR-1446)
2451

2552
Nested types may now appear inside generic types, and nested types may have their own generic parameters:
@@ -300,8 +327,8 @@ using the `.dynamicType` member to retrieve the type of an expression should mig
300327
```swift
301328
let a: Foo & Bar
302329
let b = value as? A & B & C
303-
func foo<T : Foo & Bar>(x: T) { }
304-
func bar(x: Foo & Bar) { }
330+
func foo<T : Foo & Bar>(x: T) { ... }
331+
func bar(x: Foo & Bar) { ... }
305332
typealias G = GenericStruct<Foo & Bar>
306333
```
307334

@@ -1079,7 +1106,7 @@ Swift 2.0
10791106
* Public extensions of generic types are now permitted.
10801107

10811108
```swift
1082-
public extension Array { }
1109+
public extension Array { ... }
10831110
```
10841111

10851112
**(16974298)**
@@ -1239,8 +1266,8 @@ Swift 2.0
12391266
For example:
12401267

12411268
```swift
1242-
func produceGizmoUsingTechnology() throws -> Gizmo { }
1243-
func produceGizmoUsingMagic() throws -> Gizmo { }
1269+
func produceGizmoUsingTechnology() throws -> Gizmo { ... }
1270+
func produceGizmoUsingMagic() throws -> Gizmo { ... }
12441271

12451272
if let result = try? produceGizmoUsingTechnology() { return result }
12461273
if let result = try? produceGizmoUsingMagic() { return result }
@@ -1413,7 +1440,7 @@ Swift 2.0
14131440
function or initializer. For example:
14141441

14151442
```swift
1416-
func doSomethingToValues(values: Int... , options: MyOptions = [], fn: (Int) -&gt; Void) { }
1443+
func doSomethingToValues(values: Int... , options: MyOptions = [], fn: (Int) -&gt; Void) { ... }
14171444
```
14181445

14191446
**(20127197)**
@@ -1445,7 +1472,7 @@ Swift 2.0
14451472
**(17227475)**
14461473

14471474
* When delegating or chaining to a failable initializer (for example, with
1448-
`self.init()` or `super.init()`), one can now force-unwrap the result with
1475+
`self.init(...)` or `super.init(...)`), one can now force-unwrap the result with
14491476
`!`. For example:
14501477

14511478
```swift
@@ -2152,7 +2179,7 @@ Swift 1.2
21522179
}
21532180

21542181
class MySomethingDelegate : SomethingDelegate {
2155-
@objc func didSomething() { }
2182+
@objc func didSomething() { ... }
21562183
}
21572184
```
21582185

benchmark/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,11 @@ To add a new multiple file test:
156156
1. Add a new directory and files under the `multi-source` directory as
157157
specified below:
158158

159-
├── multi-source
160-
   ├── YourTestName
161-
      ├── TestFile1.swift
162-
      ├── TestFile2.swift
163-
      ├── TestFile3.swift
159+
+-- multi-source
160+
|   +-- YourTestName
161+
|   |   +-- TestFile1.swift
162+
|   |   +-- TestFile2.swift
163+
|   |   +-- TestFile3.swift
164164

165165
At least one run function (specified in the template below) must
166166
exist in the files.

benchmark/scripts/Benchmark_DTrace.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# This source file is part of the Swift.org open source project
66
#
7-
# Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
7+
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
88
# Licensed under Apache License v2.0 with Runtime Library Exception
99
#
1010
# See https://swift.org/LICENSE.txt for license information

benchmark/scripts/Benchmark_Driver

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#
66
# This source file is part of the Swift.org open source project
77
#
8-
# Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
8+
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
99
# Licensed under Apache License v2.0 with Runtime Library Exception
1010
#
1111
# See https://swift.org/LICENSE.txt for license information

benchmark/scripts/Benchmark_GuardMalloc.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# This source file is part of the Swift.org open source project
66
#
7-
# Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
7+
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
88
# Licensed under Apache License v2.0 with Runtime Library Exception
99
#
1010
# See https://swift.org/LICENSE.txt for license information

benchmark/scripts/Benchmark_RuntimeLeaksRunner.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# This source file is part of the Swift.org open source project
66
#
7-
# Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
7+
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
88
# Licensed under Apache License v2.0 with Runtime Library Exception
99
#
1010
# See https://swift.org/LICENSE.txt for license information

benchmark/scripts/compare_perf_tests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#
66
# This source file is part of the Swift.org open source project
77
#
8-
# Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
8+
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
99
# Licensed under Apache License v2.0 with Runtime Library Exception
1010
#
1111
# See https://swift.org/LICENSE.txt for license information

benchmark/scripts/generate_harness/generate_harness.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# This source file is part of the Swift.org open source project
66
#
7-
# Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
7+
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
88
# Licensed under Apache License v2.0 with Runtime Library Exception
99
#
1010
# See https://swift.org/LICENSE.txt for license information

benchmark/scripts/generate_harness/main.swift_template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
//
33
// This source file is part of the Swift.org open source project
44
//
5-
// Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
5+
// Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
66
// Licensed under Apache License v2.0 with Runtime Library Exception
77
//
88
// See https://swift.org/LICENSE.txt for license information

benchmark/scripts/perf_test_driver/perf_test_driver.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#
55
# This source file is part of the Swift.org open source project
66
#
7-
# Copyright (c) 2014 - 2016 Apple Inc. and the Swift project authors
7+
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
88
# Licensed under Apache License v2.0 with Runtime Library Exception
99
#
1010
# See https://swift.org/LICENSE.txt for license information

0 commit comments

Comments
 (0)