Skip to content

Commit b3c804e

Browse files
committed
---
yaml --- r: 39923 b: refs/heads/dist-snap c: 860573e h: refs/heads/master i: 39921: 103d6f3 39919: 3520de8 v: v3
1 parent e76d80c commit b3c804e

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: a810c03263670238bccd64cabb12a23a46e3a278
99
refs/heads/incoming: e90142e536c150df0d9b4b2f11352152177509b5
10-
refs/heads/dist-snap: 012bb7de5ba65bfd7b3483595e65a4cda1d1f682
10+
refs/heads/dist-snap: 860573e3e00b5a807021b8c7a94a9672de4fa687
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/doc/rust.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -936,11 +936,13 @@ fn f(i: int) -> int {
936936
}
937937
~~~~
938938

939-
The typechecker would complain that `f` doesn't return a value in the
940-
`else` branch. Adding the `!` annotation on `my_err` would
941-
express that `f` requires no explicit `return`, as if it returns
942-
control to the caller, it returns a value (true because it never returns
943-
control).
939+
This will not compile without the `!` annotation on `my_err`,
940+
since the `else` branch of the conditional in `f` does not return an `int`,
941+
as required by the signature of `f`.
942+
Adding the `!` annotation to `my_err` informs the typechecker that,
943+
should control ever enter `my_err`, no further type judgments about `f` need to hold,
944+
since control will never resume in any context that relies on those judgments.
945+
Thus the return type on `f` only needs to reflect the `if` branch of the conditional.
944946

945947
#### Pure functions
946948

0 commit comments

Comments
 (0)