Skip to content

Commit 94be145

Browse files
committed
core: rename box to managed. Close #4079.
1 parent 2a5713e commit 94be145

File tree

8 files changed

+27
-25
lines changed

8 files changed

+27
-25
lines changed

src/libcore/core.rc

+7-7
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ used features.
1919

2020
`core` includes modules corresponding to each of the integer types, each of
2121
the floating point types, the `bool` type, tuples, characters, strings,
22-
vectors (`vec`), shared boxes (`box`), and unsafe and borrowed pointers
23-
(`ptr`). Additionally, `core` provides task management and creation (`task`),
24-
communication primitives (`comm` and `pipes`), an efficient vector builder
25-
(`dvec`), platform abstractions (`os` and `path`), basic I/O abstractions
26-
(`io`), common traits (`cmp`, `num`, `to_str`), and complete bindings
27-
to the C standard library (`libc`).
22+
vectors (`vec`), managed boxes (`managed`), owned boxes (`owned`), and unsafe
23+
and borrowed pointers (`ptr`). Additionally, `core` provides task management
24+
and creation (`task`), communication primitives (`comm` and `pipes`), an
25+
efficient vector builder (`dvec`), platform abstractions (`os` and `path`),
26+
basic I/O abstractions (`io`), common traits (`cmp`, `num`, `to_str`), and
27+
complete bindings to the C standard library (`libc`).
2828

2929
`core` is linked to all crates by default and its contents imported.
3030
Implicitly, all crates behave as if they included the following prologue:
@@ -92,7 +92,7 @@ pub mod at_vec;
9292
pub mod str;
9393

9494
pub mod ptr;
95-
pub mod box; // FIXME #4079 Rename to 'managed' to match 'owned'
95+
pub mod managed;
9696
pub mod owned;
9797

9898

src/libcore/dlist.rs

+10-8
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ priv impl<T> DListNode<T> {
4343
pure fn assert_links() {
4444
match self.next {
4545
Some(neighbour) => match neighbour.prev {
46-
Some(me) => if !box::ptr_eq(*self, *me) {
46+
Some(me) => if !managed::ptr_eq(*self, *me) {
4747
fail ~"Asymmetric next-link in dlist node."
4848
},
4949
None => fail ~"One-way next-link in dlist node."
@@ -52,7 +52,7 @@ priv impl<T> DListNode<T> {
5252
}
5353
match self.prev {
5454
Some(neighbour) => match neighbour.next {
55-
Some(me) => if !box::ptr_eq(*me, *self) {
55+
Some(me) => if !managed::ptr_eq(*me, *self) {
5656
fail ~"Asymmetric prev-link in dlist node."
5757
},
5858
None => fail ~"One-way prev-link in dlist node."
@@ -137,9 +137,11 @@ priv impl<T> DList<T> {
137137
}
138138
if !nobe.linked { fail ~"That node isn't linked to any dlist." }
139139
if !((nobe.prev.is_some()
140-
|| box::ptr_eq(*self.hd.expect(~"headless dlist?"), *nobe)) &&
140+
|| managed::ptr_eq(*self.hd.expect(~"headless dlist?"),
141+
*nobe)) &&
141142
(nobe.next.is_some()
142-
|| box::ptr_eq(*self.tl.expect(~"tailless dlist?"), *nobe))) {
143+
|| managed::ptr_eq(*self.tl.expect(~"tailless dlist?"),
144+
*nobe))) {
143145
fail ~"That node isn't on this dlist."
144146
}
145147
}
@@ -322,7 +324,7 @@ impl<T> DList<T> {
322324
* to the other list's head. O(1).
323325
*/
324326
fn append(them: DList<T>) {
325-
if box::ptr_eq(*self, *them) {
327+
if managed::ptr_eq(*self, *them) {
326328
fail ~"Cannot append a dlist to itself!"
327329
}
328330
if them.len() > 0 {
@@ -339,7 +341,7 @@ impl<T> DList<T> {
339341
* list's tail to this list's head. O(1).
340342
*/
341343
fn prepend(them: DList<T>) {
342-
if box::ptr_eq(*self, *them) {
344+
if managed::ptr_eq(*self, *them) {
343345
fail ~"Cannot prepend a dlist to itself!"
344346
}
345347
if them.len() > 0 {
@@ -405,7 +407,7 @@ impl<T> DList<T> {
405407
rabbit = option::get(rabbit).next;
406408
}
407409
if option::is_some(&rabbit) {
408-
assert !box::ptr_eq(*option::get(rabbit), *nobe);
410+
assert !managed::ptr_eq(*option::get(rabbit), *nobe);
409411
}
410412
// advance
411413
link = nobe.next_link();
@@ -426,7 +428,7 @@ impl<T> DList<T> {
426428
rabbit = option::get(rabbit).prev;
427429
}
428430
if option::is_some(&rabbit) {
429-
assert !box::ptr_eq(*option::get(rabbit), *nobe);
431+
assert !managed::ptr_eq(*option::get(rabbit), *nobe);
430432
}
431433
// advance
432434
link = nobe.prev_link();

src/libcore/iter-trait/dlist.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ mod inst {
3131
}
3232
if !nobe.linked ||
3333
(!((nobe.prev.is_some()
34-
|| box::ptr_eq(*self.hd.expect(~"headless dlist?"),
34+
|| managed::ptr_eq(*self.hd.expect(~"headless dlist?"),
3535
*nobe))
3636
&& (nobe.next.is_some()
37-
|| box::ptr_eq(*self.tl.expect(~"tailless dlist?"),
37+
|| managed::ptr_eq(*self.tl.expect(~"tailless dlist?"),
3838
*nobe)))) {
3939
fail ~"Removing a dlist node during iteration is forbidden!"
4040
}
File renamed without changes.

src/libcore/repr.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ use intrinsic::{TyDesc, TyVisitor, visit_tydesc};
2727
use reflect::{MovePtr, MovePtrAdaptor};
2828
use vec::UnboxedVecRepr;
2929
use vec::raw::{VecRepr, SliceRepr};
30-
pub use box::raw::BoxRepr;
31-
use box::raw::BoxHeaderRepr;
30+
pub use managed::raw::BoxRepr;
31+
use managed::raw::BoxHeaderRepr;
3232

3333
/// Helpers
3434
@@ -279,7 +279,7 @@ impl ReprVisitor : TyVisitor {
279279
fn visit_box(mtbl: uint, inner: *TyDesc) -> bool {
280280
self.writer.write_char('@');
281281
self.write_mut_qualifier(mtbl);
282-
do self.get::<&box::raw::BoxRepr> |b| {
282+
do self.get::<&managed::raw::BoxRepr> |b| {
283283
let p = ptr::to_unsafe_ptr(&b.data) as *c_void;
284284
self.visit_ptr_inner(p, inner);
285285
}
@@ -288,7 +288,7 @@ impl ReprVisitor : TyVisitor {
288288
fn visit_uniq(mtbl: uint, inner: *TyDesc) -> bool {
289289
self.writer.write_char('~');
290290
self.write_mut_qualifier(mtbl);
291-
do self.get::<&box::raw::BoxRepr> |b| {
291+
do self.get::<&managed::raw::BoxRepr> |b| {
292292
let p = ptr::to_unsafe_ptr(&b.data) as *c_void;
293293
self.visit_ptr_inner(p, inner);
294294
}
@@ -446,7 +446,7 @@ impl ReprVisitor : TyVisitor {
446446

447447
fn visit_opaque_box() -> bool {
448448
self.writer.write_char('@');
449-
do self.get::<&box::raw::BoxRepr> |b| {
449+
do self.get::<&managed::raw::BoxRepr> |b| {
450450
let p = ptr::to_unsafe_ptr(&b.data) as *c_void;
451451
self.visit_ptr_inner(p, b.header.type_desc);
452452
}

src/libcore/vec.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1763,7 +1763,7 @@ mod raw {
17631763

17641764
/// The internal representation of a (boxed) vector
17651765
pub struct VecRepr {
1766-
box_header: box::raw::BoxHeaderRepr,
1766+
box_header: managed::raw::BoxHeaderRepr,
17671767
unboxed: UnboxedVecRepr
17681768
}
17691769

src/librustc/middle/resolve.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ use syntax::visit::{visit_crate, visit_expr, visit_expr_opt, visit_fn};
6363
use syntax::visit::{visit_foreign_item, visit_item, visit_method_helper};
6464
use syntax::visit::{visit_mod, visit_ty, vt};
6565

66-
use box::ptr_eq;
66+
use managed::ptr_eq;
6767
use dvec::DVec;
6868
use option::{Some, get, is_some, is_none};
6969
use str::{connect, split_str};

src/libsyntax/ext/simplext.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ fn p_t_s_rec(cx: ext_ctxt, m: matchable, s: selector, b: binders) {
476476
match_result {
477477
return match m {
478478
match_expr(e) => {
479-
if box::ptr_eq(e, pat) {
479+
if managed::ptr_eq(e, pat) {
480480
// XXX: Is this right?
481481
Some(leaf(match_exact))
482482
} else {

0 commit comments

Comments
 (0)