Skip to content

Commit b44a960

Browse files
committed
---
yaml --- r: 236099 b: refs/heads/stable c: 13b2605 h: refs/heads/master i: 236097: 368360a 236095: 23a57a0 v: v3
1 parent 10e0026 commit b44a960

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ refs/heads/tmp: afae2ff723393b3ab4ccffef6ac7c6d1809e2da0
2929
refs/tags/1.0.0-alpha.2: 4c705f6bc559886632d3871b04f58aab093bfa2f
3030
refs/tags/homu-tmp: f859507de8c410b648d934d8f5ec1c52daac971d
3131
refs/tags/1.0.0-beta: 8cbb92b53468ee2b0c2d3eeb8567005953d40828
32-
refs/heads/stable: c97673c7b0fffe131822f2a5be520cf408c68319
32+
refs/heads/stable: 13b2605ed985a37481dc497357dc6dcdf37ba6ff
3333
refs/tags/1.0.0: 55bd4f8ff2b323f317ae89e254ce87162d52a375
3434
refs/tags/1.1.0: bc3c16f09287e5545c1d3f76b7abd54f2eca868b
3535
refs/tags/1.2.0: f557861f822c34f07270347b94b5280de20a597e

branches/stable/src/doc/tarpl/checked-uninit.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,29 @@ fn main() {
6868
}
6969
```
7070

71+
Of course, while the analysis doesn't consider actual values, it does
72+
have a relatively sophisticated understanding of dependencies and control
73+
flow. For instance, this works:
74+
75+
```rust
76+
let x: i32;
77+
78+
loop {
79+
// Rust doesn't understand that this branch will be taken unconditionally,
80+
// because it relies on actual values.
81+
if true {
82+
// But it does understand that it will only be taken once because
83+
// we *do* unconditionally break out of it. Therefore `x` doesn't
84+
// need to be marked as mutable.
85+
x = 0;
86+
break;
87+
}
88+
}
89+
// It also knows that it's impossible to get here without reaching the break.
90+
// And therefore that `x` must be initialized here!
91+
println!("{}", x);
92+
```
93+
7194
If a value is moved out of a variable, that variable becomes logically
7295
uninitialized if the type of the value isn't Copy. That is:
7396

branches/stable/src/doc/tarpl/other-reprs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ discriminant.
4747
On non-C-like enums, this will inhibit certain optimizations like the null-
4848
pointer optimization.
4949

50-
These reprs have no affect on a struct.
50+
These reprs have no effect on a struct.
5151

5252

5353

0 commit comments

Comments
 (0)