Skip to content

Commit 08f28ff

Browse files
committed
---
yaml --- r: 92232 b: refs/heads/auto c: 76d9a96 h: refs/heads/master v: v3
1 parent 05e749a commit 08f28ff

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1313
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1414
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1515
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
16-
refs/heads/auto: 1252947fa976c30ef99961e197e25e86c69621c4
16+
refs/heads/auto: 76d9a9671bf456407c1b8fd029a4a1149684fb5b
1717
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1818
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c
1919
refs/tags/0.1: b19db808c2793fe2976759b85a355c3ad8c8b336

branches/auto/src/librustc/middle/borrowck/doc.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,24 @@ of this rule: there are comments in the borrowck source referencing
215215
these names, so that you can cross reference to find the actual code
216216
that corresponds to the formal rule.
217217
218+
### Invariants
219+
220+
I want to collect, at a high-level, the invariants the borrow checker
221+
maintains. I will give them names and refer to them throughout the
222+
text. Together these invariants are crucial for the overall soundness
223+
of the system.
224+
225+
**Mutability requires uniqueness.** To mutate a path
226+
227+
**Unique mutability.** There is only one *usable* mutable path to any
228+
given memory at any given time. This implies that when claiming memory
229+
with an expression like `p = &mut x`, the compiler must guarantee that
230+
the borrowed value `x` can no longer be mutated so long as `p` is
231+
live. (This is done via restrictions, read on.)
232+
233+
**.**
234+
235+
218236
### The `gather_loans` pass
219237
220238
We start with the `gather_loans` pass, which walks the AST looking for

branches/auto/src/test/run-pass/borrowck-borrow-of-mut-base-ptr-safe.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ fn foo<'a>(mut t0: &'a mut int,
2121
let r: &int = &*t0; // ...after all, could do same thing directly.
2222
}
2323

24-
fn main() {
24+
pub fn main() {
2525
}

branches/auto/src/test/run-pass/borrowck-freeze-frozen-mut.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub fn main() {
3030
assert_eq!(*index1, 2);
3131
assert_eq!(*index2, 3);
3232
}
33-
assert_eq!(data[0], 1);
33+
assert_eq!(data[0], 5);
3434
assert_eq!(data[1], 2);
3535
assert_eq!(data[2], 3);
3636
}

0 commit comments

Comments
 (0)