Skip to content

Commit 5d36454

Browse files
committed
---
yaml --- r: 39892 b: refs/heads/dist-snap c: f4a6b84 h: refs/heads/master v: v3
1 parent 7247ed5 commit 5d36454

File tree

4 files changed

+15
-35
lines changed

4 files changed

+15
-35
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: 25096a212a9ccaa0d181630af5971532c3472182
10+
refs/heads/dist-snap: f4a6b84a65bf9c3b548e4e5d3f2aa2d9a8495085
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503
1313
refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0

branches/dist-snap/doc/tutorial-borrowed-ptr.md

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -112,18 +112,19 @@ In the previous example, the value `on_the_stack` was defined like so:
112112
let on_the_stack: Point = Point {x: 3.0, y: 4.0};
113113
~~~
114114

115-
This results in a by-value variable. As a consequence, we had to
116-
explicitly take the address of `on_the_stack` to get a borrowed
117-
pointer. Sometimes however it is more convenient to move the &
118-
operator into the definition of `on_the_stack`:
115+
This declaration means that code can only pass `Point` by value to other
116+
functions. As a consequence, we had to explicitly take the address of
117+
`on_the_stack` to get a borrowed pointer. Sometimes however it is more
118+
convenient to move the & operator into the definition of `on_the_stack`:
119119

120120
~~~
121121
# struct Point {x: float, y: float}
122122
let on_the_stack2: &Point = &Point {x: 3.0, y: 4.0};
123123
~~~
124124

125125
Applying `&` to an rvalue (non-assignable location) is just a convenient
126-
shorthand for creating a temporary and taking its address:
126+
shorthand for creating a temporary and taking its address. A more verbose
127+
way to write the same code is:
127128

128129
~~~
129130
# struct Point {x: float, y: float}
@@ -134,7 +135,7 @@ let on_the_stack2 : &Point = &tmp;
134135
# Taking the address of fields
135136

136137
As in C, the `&` operator is not limited to taking the address of
137-
local variables. It can also be used to take the address of fields or
138+
local variables. It can also take the address of fields or
138139
individual array elements. For example, consider this type definition
139140
for `rectangle`:
140141

@@ -144,7 +145,7 @@ struct Size {w: float, h: float} // as before
144145
struct Rectangle {origin: Point, size: Size}
145146
~~~
146147

147-
Now again I can define rectangles in a few different ways:
148+
Now, as before, we can define rectangles in a few different ways:
148149

149150
~~~
150151
# struct Point {x: float, y: float}
@@ -158,8 +159,8 @@ let rect_unique = ~Rectangle {origin: Point {x: 5f, y: 6f},
158159
size: Size {w: 3f, h: 4f}};
159160
~~~
160161

161-
In each case I can use the `&` operator to extact out individual
162-
subcomponents. For example, I could write:
162+
In each case, we can extract out individual subcomponents with the `&`
163+
operator. For example, I could write:
163164

164165
~~~
165166
# struct Point {x: float, y: float} // as before
@@ -173,7 +174,7 @@ compute_distance(&rect_stack.origin, &rect_managed.origin);
173174
~~~
174175

175176
which would borrow the field `origin` from the rectangle on the stack
176-
from the managed box and then compute the distance between them.
177+
as well as from the managed box, and then compute the distance between them.
177178

178179
# Borrowing managed boxes and rooting
179180

branches/dist-snap/src/rustc/middle/trans/foreign.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,9 @@ fn classify_ty(ty: TypeRef) -> ~[x86_64_reg_class] {
112112
Float => 4,
113113
Double => 8,
114114
Struct => {
115-
let size = do vec::foldl(0, struct_tys(ty)) |s, t| {
116-
align(s, *t) + ty_size(*t)
117-
};
118-
align(size, ty)
115+
do vec::foldl(0, struct_tys(ty)) |s, t| {
116+
s + ty_size(*t)
117+
}
119118
}
120119
Array => {
121120
let len = llvm::LLVMGetArrayLength(ty) as uint;

branches/dist-snap/src/test/run-pass/issue-3656.rs

Lines changed: 0 additions & 20 deletions
This file was deleted.

0 commit comments

Comments
 (0)