Skip to content

Commit 5df607e

Browse files
authored
Fix syntax highlighting in SE-0432 (#2442)
1 parent fc328b4 commit 5df607e

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

proposals/0432-noncopyable-switch.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ expression:
6767

6868
For example, given the following copyable definition:
6969

70-
```
70+
```swift
7171
enum CopyableEnum {
7272
case foo(Int)
7373
case bar(Int, String)
@@ -76,15 +76,15 @@ enum CopyableEnum {
7676

7777
then the following patterns have ownership behavior as indicated below:
7878

79-
```
79+
```swift
8080
case let x: // copying
8181
case .foo(let x): // copying
8282
case .bar(let x, let y): // copying
8383
```
8484

8585
And for a noncopyable enum definition:
8686

87-
```
87+
```swift
8888
struct NC: ~Copyable {}
8989

9090
enum NoncopyableEnum: ~Copyable {
@@ -95,7 +95,7 @@ enum NoncopyableEnum: ~Copyable {
9595

9696
then the following patterns have ownership behavior as indicated below:
9797

98-
```
98+
```swift
9999
var foo: NoncopyableEnum // stored variable
100100

101101
switch foo {
@@ -136,7 +136,7 @@ consuming the value to form variable bindings. Matching enum cases and tuples
136136
(when noncopyable tuples are supported) for instance is still possible
137137
even if they contain consuming `let` or `var` bindings as subpatterns:
138138

139-
```
139+
```swift
140140
extension Handle {
141141
var isReady: Bool { ... }
142142
}
@@ -153,10 +153,10 @@ case .foo(let y):
153153
```
154154

155155
However, when a pattern has a `where` clause, variable bindings cannot be
156-
consumed in the where clause even if the binding is consumable in the case
156+
consumed in the `where` clause even if the binding is consumable in the `case`
157157
body:
158158

159-
```
159+
```swift
160160
extension Handle {
161161
consuming func tryClose() -> Bool { ... }
162162
}
@@ -175,7 +175,7 @@ case .foo(let y):
175175
Similarly, an expression subpattern whose `~=` operator consumes the subject
176176
cannot be used to test a noncopyable subpattern.
177177

178-
```
178+
```swift
179179
extension Handle {
180180
static func ~=(identifier: Int, handle: consuming Handle) -> Bool { ... }
181181
}
@@ -291,7 +291,7 @@ could be used in the future to explicitly mark the subject of a switch as
291291
being borrowed, even if it is normally copyable or would be a consumable
292292
temporary, as in:
293293

294-
```
294+
```swift
295295
let x: String? = "hello"
296296

297297
switch borrow x {

0 commit comments

Comments
 (0)