Skip to content

Commit 4d2d8e9

Browse files
committed
---
yaml --- r: 96622 b: refs/heads/dist-snap c: 76d9a96 h: refs/heads/master v: v3
1 parent 4d80a55 commit 4d2d8e9

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
@@ -6,7 +6,7 @@ refs/heads/try: c274a6888410ce3e357e014568b43310ed787d36
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: 147ecfdd8221e4a4d4e090486829a06da1e0ca3c
9-
refs/heads/dist-snap: 1252947fa976c30ef99961e197e25e86c69621c4
9+
refs/heads/dist-snap: 76d9a9671bf456407c1b8fd029a4a1149684fb5b
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1212
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/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/dist-snap/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/dist-snap/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)