Skip to content

Commit a3cd5eb

Browse files
committed
Exise 'owned pointer' from the codebase
Still some references left to this old term, I've updated them to say boxes. Related to #25851
1 parent 7b0f2af commit a3cd5eb

File tree

9 files changed

+18
-18
lines changed

9 files changed

+18
-18
lines changed

src/liballoc/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,9 @@
2222
//!
2323
//! ## Boxed values
2424
//!
25-
//! The [`Box`](boxed/index.html) type is the core owned pointer type in Rust.
26-
//! There can only be one owner of a `Box`, and the owner can decide to mutate
27-
//! the contents, which live on the heap.
25+
//! The [`Box`](boxed/index.html) type is a smart pointer type. There can
26+
//! only be one owner of a `Box`, and the owner can decide to mutate the
27+
//! contents, which live on the heap.
2828
//!
2929
//! This type can be sent among threads efficiently as the size of a `Box` value
3030
//! is the same as that of a pointer. Tree-like data structures are often built

src/librustc/middle/check_const.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
//
1414
// - For each *mutable* static item, it checks that its **type**:
1515
// - doesn't have a destructor
16-
// - doesn't own an owned pointer
16+
// - doesn't own a box
1717
//
1818
// - For each *immutable* static item, it checks that its **value**:
19-
// - doesn't own owned, managed pointers
19+
// - doesn't own a box
2020
// - doesn't contain a struct literal or a call to an enum variant / struct constructor where
2121
// - the type of the struct/enum has a dtor
2222
//

src/librustc/middle/mem_categorization.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1410,7 +1410,7 @@ pub enum AliasableReason {
14101410

14111411
impl<'tcx> cmt_<'tcx> {
14121412
pub fn guarantor(&self) -> cmt<'tcx> {
1413-
//! Returns `self` after stripping away any owned pointer derefs or
1413+
//! Returns `self` after stripping away any derefs or
14141414
//! interior content. The return value is basically the `cmt` which
14151415
//! determines how long the value in `self` remains live.
14161416

src/librustc_borrowck/borrowck/README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ overwrite (or freeze) `(*x).f`, and thus invalidate the reference
170170
that was created. In general it holds that when a path is
171171
lent, restrictions are issued for all the owning prefixes of that
172172
path. In this case, the path `*x` owns the path `(*x).f` and,
173-
because `x` is an owned pointer, the path `x` owns the path `*x`.
173+
because `x` has ownership, the path `x` owns the path `*x`.
174174
Therefore, borrowing `(*x).f` yields restrictions on both
175175
`*x` and `x`.
176176

@@ -286,7 +286,7 @@ MUTABILITY(X, imm) // M-Var-Imm
286286

287287
### Checking mutability of owned content
288288

289-
Fields and owned pointers inherit their mutability from
289+
Fields and boxes inherit their mutability from
290290
their base expressions, so both of their rules basically
291291
delegate the check to the base expression `LV`:
292292

@@ -387,7 +387,7 @@ LIFETIME(X, LT, MQ) // L-Local
387387

388388
### Checking lifetime for owned content
389389

390-
The lifetime of a field or owned pointer is the same as the lifetime
390+
The lifetime of a field or box is the same as the lifetime
391391
of its owner:
392392

393393
```text
@@ -466,10 +466,10 @@ origin of inherited mutability.
466466

467467
Because the mutability of owned referents is inherited, restricting an
468468
owned referent is similar to restricting a field, in that it implies
469-
restrictions on the pointer. However, owned pointers have an important
469+
restrictions on the pointer. However, boxes have an important
470470
twist: if the owner `LV` is mutated, that causes the owned referent
471471
`*LV` to be freed! So whenever an owned referent `*LV` is borrowed, we
472-
must prevent the owned pointer `LV` from being mutated, which means
472+
must prevent the box `LV` from being mutated, which means
473473
that we always add `MUTATE` and `CLAIM` to the restriction set imposed
474474
on `LV`:
475475

@@ -648,7 +648,7 @@ fn main() {
648648
```
649649

650650
Clause (2) propagates the restrictions on the referent to the pointer
651-
itself. This is the same as with an owned pointer, though the
651+
itself. This is the same as with an box, though the
652652
reasoning is mildly different. The basic goal in all cases is to
653653
prevent the user from establishing another route to the same data. To
654654
see what I mean, let's examine various cases of what can go wrong and

src/librustc_borrowck/borrowck/gather_loans/restrictions.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ impl<'a, 'tcx> RestrictionsContext<'a, 'tcx> {
110110
mc::Unique => {
111111
// R-Deref-Send-Pointer
112112
//
113-
// When we borrow the interior of an owned pointer, we
113+
// When we borrow the interior of a box, we
114114
// cannot permit the base to be mutated, because that
115115
// would cause the unique pointer to be freed.
116116
//

src/librustc_typeck/check/regionck.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
//! the borrow itself (L2). What do I mean by "guaranteed" by a
7777
//! borrowed pointer? I mean any data that is reached by first
7878
//! dereferencing a borrowed pointer and then either traversing
79-
//! interior offsets or owned pointers. We say that the guarantor
79+
//! interior offsets or boxes. We say that the guarantor
8080
//! of such data it the region of the borrowed pointer that was
8181
//! traversed. This is essentially the same as the ownership
8282
//! relation, except that a borrowed pointer never owns its

src/test/compile-fail/issue-6801.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

11-
// Creating a stack closure which references an owned pointer and then
12-
// transferring ownership of the owned box before invoking the stack
11+
// Creating a stack closure which references an box and then
12+
// transferring ownership of the box before invoking the stack
1313
// closure results in a crash.
1414

1515
#![feature(box_syntax)]

src/test/compile-fail/kindck-copy.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ fn test<'a,T,U:Copy>(_: &'a isize) {
3737
assert_copy::<&'static mut isize>(); //~ ERROR `core::marker::Copy` is not implemented
3838
assert_copy::<&'a mut isize>(); //~ ERROR `core::marker::Copy` is not implemented
3939

40-
// owned pointers are not ok
40+
// boxes are not ok
4141
assert_copy::<Box<isize>>(); //~ ERROR `core::marker::Copy` is not implemented
4242
assert_copy::<String>(); //~ ERROR `core::marker::Copy` is not implemented
4343
assert_copy::<Vec<isize> >(); //~ ERROR `core::marker::Copy` is not implemented

src/test/run-pass/trait-with-bounds-default.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//
1111

1212
pub trait Clone2 {
13-
/// Returns a copy of the value. The contents of owned pointers
13+
/// Returns a copy of the value. The contents of boxes
1414
/// are copied to maintain uniqueness, while the contents of
1515
/// managed pointers are not copied.
1616
fn clone(&self) -> Self;

0 commit comments

Comments
 (0)