Rename OwnedPtr to UniquePtr
This commit is contained in:
@@ -19,7 +19,7 @@ use core::hash::{mod, Hash};
|
|||||||
use core::kinds::Sized;
|
use core::kinds::Sized;
|
||||||
use core::mem;
|
use core::mem;
|
||||||
use core::option::Option;
|
use core::option::Option;
|
||||||
use core::ptr::OwnedPtr;
|
use core::ptr::UniquePtr;
|
||||||
use core::raw::TraitObject;
|
use core::raw::TraitObject;
|
||||||
use core::result::Result;
|
use core::result::Result;
|
||||||
use core::result::Result::{Ok, Err};
|
use core::result::Result::{Ok, Err};
|
||||||
@@ -45,7 +45,7 @@ pub static HEAP: () = ();
|
|||||||
/// A type that represents a uniquely-owned value.
|
/// A type that represents a uniquely-owned value.
|
||||||
#[lang = "owned_box"]
|
#[lang = "owned_box"]
|
||||||
#[unstable = "custom allocators will add an additional type parameter (with default)"]
|
#[unstable = "custom allocators will add an additional type parameter (with default)"]
|
||||||
pub struct Box<T>(OwnedPtr<T>);
|
pub struct Box<T>(UniquePtr<T>);
|
||||||
|
|
||||||
#[stable]
|
#[stable]
|
||||||
impl<T: Default> Default for Box<T> {
|
impl<T: Default> Default for Box<T> {
|
||||||
|
|||||||
@@ -58,7 +58,7 @@ use core::kinds::marker::{ContravariantLifetime, InvariantType};
|
|||||||
use core::mem;
|
use core::mem;
|
||||||
use core::num::{Int, UnsignedInt};
|
use core::num::{Int, UnsignedInt};
|
||||||
use core::ops;
|
use core::ops;
|
||||||
use core::ptr::{mod, OwnedPtr};
|
use core::ptr::{mod, UniquePtr};
|
||||||
use core::raw::Slice as RawSlice;
|
use core::raw::Slice as RawSlice;
|
||||||
use core::uint;
|
use core::uint;
|
||||||
|
|
||||||
@@ -133,7 +133,7 @@ use slice::CloneSliceExt;
|
|||||||
#[unsafe_no_drop_flag]
|
#[unsafe_no_drop_flag]
|
||||||
#[stable]
|
#[stable]
|
||||||
pub struct Vec<T> {
|
pub struct Vec<T> {
|
||||||
ptr: OwnedPtr<T>,
|
ptr: UniquePtr<T>,
|
||||||
len: uint,
|
len: uint,
|
||||||
cap: uint,
|
cap: uint,
|
||||||
}
|
}
|
||||||
@@ -176,7 +176,7 @@ impl<T> Vec<T> {
|
|||||||
// non-null value which is fine since we never call deallocate on the ptr
|
// non-null value which is fine since we never call deallocate on the ptr
|
||||||
// if cap is 0. The reason for this is because the pointer of a slice
|
// if cap is 0. The reason for this is because the pointer of a slice
|
||||||
// being NULL would break the null pointer optimization for enums.
|
// being NULL would break the null pointer optimization for enums.
|
||||||
Vec { ptr: OwnedPtr(EMPTY as *mut T), len: 0, cap: 0 }
|
Vec { ptr: UniquePtr(EMPTY as *mut T), len: 0, cap: 0 }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Constructs a new, empty `Vec<T>` with the specified capacity.
|
/// Constructs a new, empty `Vec<T>` with the specified capacity.
|
||||||
@@ -209,7 +209,7 @@ impl<T> Vec<T> {
|
|||||||
#[stable]
|
#[stable]
|
||||||
pub fn with_capacity(capacity: uint) -> Vec<T> {
|
pub fn with_capacity(capacity: uint) -> Vec<T> {
|
||||||
if mem::size_of::<T>() == 0 {
|
if mem::size_of::<T>() == 0 {
|
||||||
Vec { ptr: OwnedPtr(EMPTY as *mut T), len: 0, cap: uint::MAX }
|
Vec { ptr: UniquePtr(EMPTY as *mut T), len: 0, cap: uint::MAX }
|
||||||
} else if capacity == 0 {
|
} else if capacity == 0 {
|
||||||
Vec::new()
|
Vec::new()
|
||||||
} else {
|
} else {
|
||||||
@@ -217,7 +217,7 @@ impl<T> Vec<T> {
|
|||||||
.expect("capacity overflow");
|
.expect("capacity overflow");
|
||||||
let ptr = unsafe { allocate(size, mem::min_align_of::<T>()) };
|
let ptr = unsafe { allocate(size, mem::min_align_of::<T>()) };
|
||||||
if ptr.is_null() { ::alloc::oom() }
|
if ptr.is_null() { ::alloc::oom() }
|
||||||
Vec { ptr: OwnedPtr(ptr as *mut T), len: 0, cap: capacity }
|
Vec { ptr: UniquePtr(ptr as *mut T), len: 0, cap: capacity }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -284,7 +284,7 @@ impl<T> Vec<T> {
|
|||||||
#[unstable = "needs finalization"]
|
#[unstable = "needs finalization"]
|
||||||
pub unsafe fn from_raw_parts(ptr: *mut T, length: uint,
|
pub unsafe fn from_raw_parts(ptr: *mut T, length: uint,
|
||||||
capacity: uint) -> Vec<T> {
|
capacity: uint) -> Vec<T> {
|
||||||
Vec { ptr: OwnedPtr(ptr), len: length, cap: capacity }
|
Vec { ptr: UniquePtr(ptr), len: length, cap: capacity }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a vector by copying the elements from a raw pointer.
|
/// Creates a vector by copying the elements from a raw pointer.
|
||||||
@@ -803,7 +803,7 @@ impl<T> Vec<T> {
|
|||||||
unsafe {
|
unsafe {
|
||||||
// Overflow check is unnecessary as the vector is already at
|
// Overflow check is unnecessary as the vector is already at
|
||||||
// least this large.
|
// least this large.
|
||||||
self.ptr = OwnedPtr(reallocate(self.ptr.0 as *mut u8,
|
self.ptr = UniquePtr(reallocate(self.ptr.0 as *mut u8,
|
||||||
self.cap * mem::size_of::<T>(),
|
self.cap * mem::size_of::<T>(),
|
||||||
self.len * mem::size_of::<T>(),
|
self.len * mem::size_of::<T>(),
|
||||||
mem::min_align_of::<T>()) as *mut T);
|
mem::min_align_of::<T>()) as *mut T);
|
||||||
@@ -1110,7 +1110,7 @@ impl<T> Vec<T> {
|
|||||||
let size = max(old_size, 2 * mem::size_of::<T>()) * 2;
|
let size = max(old_size, 2 * mem::size_of::<T>()) * 2;
|
||||||
if old_size > size { panic!("capacity overflow") }
|
if old_size > size { panic!("capacity overflow") }
|
||||||
unsafe {
|
unsafe {
|
||||||
self.ptr = OwnedPtr(alloc_or_realloc(self.ptr.0, old_size, size));
|
self.ptr = UniquePtr(alloc_or_realloc(self.ptr.0, old_size, size));
|
||||||
if self.ptr.0.is_null() { ::alloc::oom() }
|
if self.ptr.0.is_null() { ::alloc::oom() }
|
||||||
}
|
}
|
||||||
self.cap = max(self.cap, 2) * 2;
|
self.cap = max(self.cap, 2) * 2;
|
||||||
@@ -1231,7 +1231,7 @@ impl<T> Vec<T> {
|
|||||||
let size = capacity.checked_mul(mem::size_of::<T>())
|
let size = capacity.checked_mul(mem::size_of::<T>())
|
||||||
.expect("capacity overflow");
|
.expect("capacity overflow");
|
||||||
unsafe {
|
unsafe {
|
||||||
self.ptr = OwnedPtr(alloc_or_realloc(self.ptr.0,
|
self.ptr = UniquePtr(alloc_or_realloc(self.ptr.0,
|
||||||
self.cap * mem::size_of::<T>(),
|
self.cap * mem::size_of::<T>(),
|
||||||
size));
|
size));
|
||||||
if self.ptr.0.is_null() { ::alloc::oom() }
|
if self.ptr.0.is_null() { ::alloc::oom() }
|
||||||
@@ -1420,7 +1420,7 @@ impl<T> IntoIter<T> {
|
|||||||
for _x in self { }
|
for _x in self { }
|
||||||
let IntoIter { allocation, cap, ptr: _ptr, end: _end } = self;
|
let IntoIter { allocation, cap, ptr: _ptr, end: _end } = self;
|
||||||
mem::forget(self);
|
mem::forget(self);
|
||||||
Vec { ptr: OwnedPtr(allocation), cap: cap, len: 0 }
|
Vec { ptr: UniquePtr(allocation), cap: cap, len: 0 }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -505,28 +505,28 @@ impl<T> PartialOrd for *mut T {
|
|||||||
|
|
||||||
/// A wrapper around a raw `*mut T` that indicates that the possessor
|
/// A wrapper around a raw `*mut T` that indicates that the possessor
|
||||||
/// of this wrapper owns the referent. This in turn implies that the
|
/// of this wrapper owns the referent. This in turn implies that the
|
||||||
/// `OwnedPtr<T>` is `Send`/`Sync` if `T` is `Send`/`Sync`, unlike a
|
/// `UniquePtr<T>` is `Send`/`Sync` if `T` is `Send`/`Sync`, unlike a
|
||||||
/// raw `*mut T` (which conveys no particular ownership semantics).
|
/// raw `*mut T` (which conveys no particular ownership semantics).
|
||||||
/// Useful for building abstractions like `Vec<T>` or `Box<T>`, which
|
/// Useful for building abstractions like `Vec<T>` or `Box<T>`, which
|
||||||
/// internally use raw pointers to manage the memory that they own.
|
/// internally use raw pointers to manage the memory that they own.
|
||||||
pub struct OwnedPtr<T>(pub *mut T);
|
pub struct UniquePtr<T>(pub *mut T);
|
||||||
|
|
||||||
/// `OwnedPtr` pointers are `Send` if `T` is `Send` because the data they
|
/// `UniquePtr` pointers are `Send` if `T` is `Send` because the data they
|
||||||
/// reference is unaliased. Note that this aliasing invariant is
|
/// reference is unaliased. Note that this aliasing invariant is
|
||||||
/// unenforced by the type system; the abstraction using the
|
/// unenforced by the type system; the abstraction using the
|
||||||
/// `OwnedPtr` must enforce it.
|
/// `UniquePtr` must enforce it.
|
||||||
impl<T:Send> Send for OwnedPtr<T> { }
|
impl<T:Send> Send for UniquePtr<T> { }
|
||||||
|
|
||||||
/// `OwnedPtr` pointers are `Sync` if `T` is `Sync` because the data they
|
/// `UniquePtr` pointers are `Sync` if `T` is `Sync` because the data they
|
||||||
/// reference is unaliased. Note that this aliasing invariant is
|
/// reference is unaliased. Note that this aliasing invariant is
|
||||||
/// unenforced by the type system; the abstraction using the
|
/// unenforced by the type system; the abstraction using the
|
||||||
/// `OwnedPtr` must enforce it.
|
/// `UniquePtr` must enforce it.
|
||||||
impl<T:Sync> Sync for OwnedPtr<T> { }
|
impl<T:Sync> Sync for UniquePtr<T> { }
|
||||||
|
|
||||||
impl<T> OwnedPtr<T> {
|
impl<T> UniquePtr<T> {
|
||||||
/// Returns a null OwnedPtr.
|
/// Returns a null UniquePtr.
|
||||||
pub fn null() -> OwnedPtr<T> {
|
pub fn null() -> UniquePtr<T> {
|
||||||
OwnedPtr(RawPtr::null())
|
UniquePtr(RawPtr::null())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return an (unsafe) pointer into the memory owned by `self`.
|
/// Return an (unsafe) pointer into the memory owned by `self`.
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ extern crate libc;
|
|||||||
|
|
||||||
use libc::{c_void, size_t, c_int};
|
use libc::{c_void, size_t, c_int};
|
||||||
use std::c_vec::CVec;
|
use std::c_vec::CVec;
|
||||||
use std::ptr::OwnedPtr;
|
use std::ptr::UniquePtr;
|
||||||
|
|
||||||
#[link(name = "miniz", kind = "static")]
|
#[link(name = "miniz", kind = "static")]
|
||||||
extern {
|
extern {
|
||||||
@@ -60,7 +60,7 @@ fn deflate_bytes_internal(bytes: &[u8], flags: c_int) -> Option<CVec<u8>> {
|
|||||||
&mut outsz,
|
&mut outsz,
|
||||||
flags);
|
flags);
|
||||||
if !res.is_null() {
|
if !res.is_null() {
|
||||||
let res = OwnedPtr(res);
|
let res = UniquePtr(res);
|
||||||
Some(CVec::new_with_dtor(res.0 as *mut u8, outsz as uint, move|:| libc::free(res.0)))
|
Some(CVec::new_with_dtor(res.0 as *mut u8, outsz as uint, move|:| libc::free(res.0)))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
@@ -86,7 +86,7 @@ fn inflate_bytes_internal(bytes: &[u8], flags: c_int) -> Option<CVec<u8>> {
|
|||||||
&mut outsz,
|
&mut outsz,
|
||||||
flags);
|
flags);
|
||||||
if !res.is_null() {
|
if !res.is_null() {
|
||||||
let res = OwnedPtr(res);
|
let res = UniquePtr(res);
|
||||||
Some(CVec::new_with_dtor(res.0 as *mut u8, outsz as uint, move|:| libc::free(res.0)))
|
Some(CVec::new_with_dtor(res.0 as *mut u8, outsz as uint, move|:| libc::free(res.0)))
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ pub struct Upvar {
|
|||||||
// different kinds of pointers:
|
// different kinds of pointers:
|
||||||
#[deriving(Clone, Copy, PartialEq, Eq, Hash, Show)]
|
#[deriving(Clone, Copy, PartialEq, Eq, Hash, Show)]
|
||||||
pub enum PointerKind {
|
pub enum PointerKind {
|
||||||
OwnedPtr,
|
UniquePtr,
|
||||||
BorrowedPtr(ty::BorrowKind, ty::Region),
|
BorrowedPtr(ty::BorrowKind, ty::Region),
|
||||||
Implicit(ty::BorrowKind, ty::Region), // Implicit deref of a borrowed ptr.
|
Implicit(ty::BorrowKind, ty::Region), // Implicit deref of a borrowed ptr.
|
||||||
UnsafePtr(ast::Mutability)
|
UnsafePtr(ast::Mutability)
|
||||||
@@ -199,7 +199,7 @@ pub fn opt_deref_kind(t: Ty) -> Option<deref_kind> {
|
|||||||
match t.sty {
|
match t.sty {
|
||||||
ty::ty_uniq(_) |
|
ty::ty_uniq(_) |
|
||||||
ty::ty_closure(box ty::ClosureTy {store: ty::UniqTraitStore, ..}) => {
|
ty::ty_closure(box ty::ClosureTy {store: ty::UniqTraitStore, ..}) => {
|
||||||
Some(deref_ptr(OwnedPtr))
|
Some(deref_ptr(UniquePtr))
|
||||||
}
|
}
|
||||||
|
|
||||||
ty::ty_rptr(r, mt) => {
|
ty::ty_rptr(r, mt) => {
|
||||||
@@ -315,7 +315,7 @@ impl MutabilityCategory {
|
|||||||
pub fn from_pointer_kind(base_mutbl: MutabilityCategory,
|
pub fn from_pointer_kind(base_mutbl: MutabilityCategory,
|
||||||
ptr: PointerKind) -> MutabilityCategory {
|
ptr: PointerKind) -> MutabilityCategory {
|
||||||
match ptr {
|
match ptr {
|
||||||
OwnedPtr => {
|
UniquePtr => {
|
||||||
base_mutbl.inherit()
|
base_mutbl.inherit()
|
||||||
}
|
}
|
||||||
BorrowedPtr(borrow_kind, _) | Implicit(borrow_kind, _) => {
|
BorrowedPtr(borrow_kind, _) | Implicit(borrow_kind, _) => {
|
||||||
@@ -1351,7 +1351,7 @@ impl<'t,'tcx,TYPER:Typer<'tcx>> MemCategorizationContext<'t,TYPER> {
|
|||||||
Implicit(..) => {
|
Implicit(..) => {
|
||||||
"dereference (dereference is implicit, due to indexing)".to_string()
|
"dereference (dereference is implicit, due to indexing)".to_string()
|
||||||
}
|
}
|
||||||
OwnedPtr => format!("dereference of `{}`", ptr_sigil(pk)),
|
UniquePtr => format!("dereference of `{}`", ptr_sigil(pk)),
|
||||||
_ => format!("dereference of `{}`-pointer", ptr_sigil(pk))
|
_ => format!("dereference of `{}`-pointer", ptr_sigil(pk))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1412,7 +1412,7 @@ impl<'tcx> cmt_<'tcx> {
|
|||||||
}
|
}
|
||||||
cat_downcast(ref b, _) |
|
cat_downcast(ref b, _) |
|
||||||
cat_interior(ref b, _) |
|
cat_interior(ref b, _) |
|
||||||
cat_deref(ref b, _, OwnedPtr) => {
|
cat_deref(ref b, _, UniquePtr) => {
|
||||||
b.guarantor()
|
b.guarantor()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1431,7 +1431,7 @@ impl<'tcx> cmt_<'tcx> {
|
|||||||
cat_deref(ref b, _, BorrowedPtr(ty::UniqueImmBorrow, _)) |
|
cat_deref(ref b, _, BorrowedPtr(ty::UniqueImmBorrow, _)) |
|
||||||
cat_deref(ref b, _, Implicit(ty::UniqueImmBorrow, _)) |
|
cat_deref(ref b, _, Implicit(ty::UniqueImmBorrow, _)) |
|
||||||
cat_downcast(ref b, _) |
|
cat_downcast(ref b, _) |
|
||||||
cat_deref(ref b, _, OwnedPtr) |
|
cat_deref(ref b, _, UniquePtr) |
|
||||||
cat_interior(ref b, _) => {
|
cat_interior(ref b, _) => {
|
||||||
// Aliasability depends on base cmt
|
// Aliasability depends on base cmt
|
||||||
b.freely_aliasable(ctxt)
|
b.freely_aliasable(ctxt)
|
||||||
@@ -1523,7 +1523,7 @@ impl<'tcx> Repr<'tcx> for categorization<'tcx> {
|
|||||||
|
|
||||||
pub fn ptr_sigil(ptr: PointerKind) -> &'static str {
|
pub fn ptr_sigil(ptr: PointerKind) -> &'static str {
|
||||||
match ptr {
|
match ptr {
|
||||||
OwnedPtr => "Box",
|
UniquePtr => "Box",
|
||||||
BorrowedPtr(ty::ImmBorrow, _) |
|
BorrowedPtr(ty::ImmBorrow, _) |
|
||||||
Implicit(ty::ImmBorrow, _) => "&",
|
Implicit(ty::ImmBorrow, _) => "&",
|
||||||
BorrowedPtr(ty::MutBorrow, _) |
|
BorrowedPtr(ty::MutBorrow, _) |
|
||||||
|
|||||||
@@ -33,11 +33,11 @@ use std::rc::Rc;
|
|||||||
|
|
||||||
// FIXME (#16118): These functions are intended to allow the borrow checker to
|
// FIXME (#16118): These functions are intended to allow the borrow checker to
|
||||||
// be less precise in its handling of Box while still allowing moves out of a
|
// be less precise in its handling of Box while still allowing moves out of a
|
||||||
// Box. They should be removed when OwnedPtr is removed from LoanPath.
|
// Box. They should be removed when UniquePtr is removed from LoanPath.
|
||||||
|
|
||||||
fn owned_ptr_base_path<'a, 'tcx>(loan_path: &'a LoanPath<'tcx>) -> &'a LoanPath<'tcx> {
|
fn owned_ptr_base_path<'a, 'tcx>(loan_path: &'a LoanPath<'tcx>) -> &'a LoanPath<'tcx> {
|
||||||
//! Returns the base of the leftmost dereference of an OwnedPtr in
|
//! Returns the base of the leftmost dereference of an UniquePtr in
|
||||||
//! `loan_path`. If there is no dereference of an OwnedPtr in `loan_path`,
|
//! `loan_path`. If there is no dereference of an UniquePtr in `loan_path`,
|
||||||
//! then it just returns `loan_path` itself.
|
//! then it just returns `loan_path` itself.
|
||||||
|
|
||||||
return match helper(loan_path) {
|
return match helper(loan_path) {
|
||||||
@@ -48,7 +48,7 @@ fn owned_ptr_base_path<'a, 'tcx>(loan_path: &'a LoanPath<'tcx>) -> &'a LoanPath<
|
|||||||
fn helper<'a, 'tcx>(loan_path: &'a LoanPath<'tcx>) -> Option<&'a LoanPath<'tcx>> {
|
fn helper<'a, 'tcx>(loan_path: &'a LoanPath<'tcx>) -> Option<&'a LoanPath<'tcx>> {
|
||||||
match loan_path.kind {
|
match loan_path.kind {
|
||||||
LpVar(_) | LpUpvar(_) => None,
|
LpVar(_) | LpUpvar(_) => None,
|
||||||
LpExtend(ref lp_base, _, LpDeref(mc::OwnedPtr)) => {
|
LpExtend(ref lp_base, _, LpDeref(mc::UniquePtr)) => {
|
||||||
match helper(&**lp_base) {
|
match helper(&**lp_base) {
|
||||||
v @ Some(_) => v,
|
v @ Some(_) => v,
|
||||||
None => Some(&**lp_base)
|
None => Some(&**lp_base)
|
||||||
@@ -72,7 +72,7 @@ fn owned_ptr_base_path_rc<'tcx>(loan_path: &Rc<LoanPath<'tcx>>) -> Rc<LoanPath<'
|
|||||||
fn helper<'tcx>(loan_path: &Rc<LoanPath<'tcx>>) -> Option<Rc<LoanPath<'tcx>>> {
|
fn helper<'tcx>(loan_path: &Rc<LoanPath<'tcx>>) -> Option<Rc<LoanPath<'tcx>>> {
|
||||||
match loan_path.kind {
|
match loan_path.kind {
|
||||||
LpVar(_) | LpUpvar(_) => None,
|
LpVar(_) | LpUpvar(_) => None,
|
||||||
LpExtend(ref lp_base, _, LpDeref(mc::OwnedPtr)) => {
|
LpExtend(ref lp_base, _, LpDeref(mc::UniquePtr)) => {
|
||||||
match helper(lp_base) {
|
match helper(lp_base) {
|
||||||
v @ Some(_) => v,
|
v @ Some(_) => v,
|
||||||
None => Some(lp_base.clone())
|
None => Some(lp_base.clone())
|
||||||
@@ -880,7 +880,7 @@ impl<'a, 'tcx> CheckLoanCtxt<'a, 'tcx> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mc::cat_deref(b, _, mc::OwnedPtr) => {
|
mc::cat_deref(b, _, mc::UniquePtr) => {
|
||||||
assert_eq!(cmt.mutbl, mc::McInherited);
|
assert_eq!(cmt.mutbl, mc::McInherited);
|
||||||
cmt = b;
|
cmt = b;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -291,9 +291,9 @@ fn add_fragment_siblings<'tcx>(this: &MoveData<'tcx>,
|
|||||||
add_fragment_siblings(this, tcx, gathered_fragments, loan_parent.clone(), origin_id);
|
add_fragment_siblings(this, tcx, gathered_fragments, loan_parent.clone(), origin_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// *LV for OwnedPtr consumes the contents of the box (at
|
// *LV for UniquePtr consumes the contents of the box (at
|
||||||
// least when it is non-copy...), so propagate inward.
|
// least when it is non-copy...), so propagate inward.
|
||||||
LpExtend(ref loan_parent, _, LpDeref(mc::OwnedPtr)) => {
|
LpExtend(ref loan_parent, _, LpDeref(mc::UniquePtr)) => {
|
||||||
add_fragment_siblings(this, tcx, gathered_fragments, loan_parent.clone(), origin_id);
|
add_fragment_siblings(this, tcx, gathered_fragments, loan_parent.clone(), origin_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -190,7 +190,7 @@ fn check_and_get_illegal_move_origin<'a, 'tcx>(bccx: &BorrowckCtxt<'a, 'tcx>,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mc::cat_deref(ref b, _, mc::OwnedPtr) => {
|
mc::cat_deref(ref b, _, mc::UniquePtr) => {
|
||||||
check_and_get_illegal_move_origin(bccx, b)
|
check_and_get_illegal_move_origin(bccx, b)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ impl<'a, 'tcx> GuaranteeLifetimeContext<'a, 'tcx> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mc::cat_downcast(ref base, _) |
|
mc::cat_downcast(ref base, _) |
|
||||||
mc::cat_deref(ref base, _, mc::OwnedPtr) | // L-Deref-Send
|
mc::cat_deref(ref base, _, mc::UniquePtr) | // L-Deref-Send
|
||||||
mc::cat_interior(ref base, _) => { // L-Field
|
mc::cat_interior(ref base, _) => { // L-Field
|
||||||
self.check(base, discr_scope)
|
self.check(base, discr_scope)
|
||||||
}
|
}
|
||||||
@@ -129,7 +129,7 @@ impl<'a, 'tcx> GuaranteeLifetimeContext<'a, 'tcx> {
|
|||||||
r
|
r
|
||||||
}
|
}
|
||||||
mc::cat_downcast(ref cmt, _) |
|
mc::cat_downcast(ref cmt, _) |
|
||||||
mc::cat_deref(ref cmt, _, mc::OwnedPtr) |
|
mc::cat_deref(ref cmt, _, mc::UniquePtr) |
|
||||||
mc::cat_interior(ref cmt, _) => {
|
mc::cat_interior(ref cmt, _) => {
|
||||||
self.scope(cmt)
|
self.scope(cmt)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ impl<'a, 'tcx> RestrictionsContext<'a, 'tcx> {
|
|||||||
|
|
||||||
mc::cat_deref(cmt_base, _, pk) => {
|
mc::cat_deref(cmt_base, _, pk) => {
|
||||||
match pk {
|
match pk {
|
||||||
mc::OwnedPtr => {
|
mc::UniquePtr => {
|
||||||
// R-Deref-Send-Pointer
|
// R-Deref-Send-Pointer
|
||||||
//
|
//
|
||||||
// When we borrow the interior of an owned pointer, we
|
// When we borrow the interior of an owned pointer, we
|
||||||
|
|||||||
@@ -1460,7 +1460,7 @@ fn link_region<'a, 'tcx>(rcx: &Rcx<'a, 'tcx>,
|
|||||||
}
|
}
|
||||||
|
|
||||||
mc::cat_downcast(cmt_base, _) |
|
mc::cat_downcast(cmt_base, _) |
|
||||||
mc::cat_deref(cmt_base, _, mc::OwnedPtr) |
|
mc::cat_deref(cmt_base, _, mc::UniquePtr) |
|
||||||
mc::cat_interior(cmt_base, _) => {
|
mc::cat_interior(cmt_base, _) => {
|
||||||
// Borrowing interior or owned data requires the base
|
// Borrowing interior or owned data requires the base
|
||||||
// to be valid and borrowable in the same fashion.
|
// to be valid and borrowable in the same fashion.
|
||||||
@@ -1684,7 +1684,7 @@ fn adjust_upvar_borrow_kind_for_mut<'a, 'tcx>(rcx: &Rcx<'a, 'tcx>,
|
|||||||
cmt.repr(rcx.tcx()));
|
cmt.repr(rcx.tcx()));
|
||||||
|
|
||||||
match cmt.cat.clone() {
|
match cmt.cat.clone() {
|
||||||
mc::cat_deref(base, _, mc::OwnedPtr) |
|
mc::cat_deref(base, _, mc::UniquePtr) |
|
||||||
mc::cat_interior(base, _) |
|
mc::cat_interior(base, _) |
|
||||||
mc::cat_downcast(base, _) => {
|
mc::cat_downcast(base, _) => {
|
||||||
// Interior or owned data is mutable if base is
|
// Interior or owned data is mutable if base is
|
||||||
@@ -1731,7 +1731,7 @@ fn adjust_upvar_borrow_kind_for_unique<'a, 'tcx>(rcx: &Rcx<'a, 'tcx>, cmt: mc::c
|
|||||||
cmt.repr(rcx.tcx()));
|
cmt.repr(rcx.tcx()));
|
||||||
|
|
||||||
match cmt.cat.clone() {
|
match cmt.cat.clone() {
|
||||||
mc::cat_deref(base, _, mc::OwnedPtr) |
|
mc::cat_deref(base, _, mc::UniquePtr) |
|
||||||
mc::cat_interior(base, _) |
|
mc::cat_interior(base, _) |
|
||||||
mc::cat_downcast(base, _) => {
|
mc::cat_downcast(base, _) => {
|
||||||
// Interior or owned data is unique if base is
|
// Interior or owned data is unique if base is
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ use num::{Int, UnsignedInt};
|
|||||||
use ops::{Deref, DerefMut, Drop};
|
use ops::{Deref, DerefMut, Drop};
|
||||||
use option::Option;
|
use option::Option;
|
||||||
use option::Option::{Some, None};
|
use option::Option::{Some, None};
|
||||||
use ptr::{OwnedPtr, RawPtr, copy_nonoverlapping_memory, zero_memory};
|
use ptr::{UniquePtr, RawPtr, copy_nonoverlapping_memory, zero_memory};
|
||||||
use ptr;
|
use ptr;
|
||||||
use rt::heap::{allocate, deallocate};
|
use rt::heap::{allocate, deallocate};
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ const EMPTY_BUCKET: u64 = 0u64;
|
|||||||
pub struct RawTable<K, V> {
|
pub struct RawTable<K, V> {
|
||||||
capacity: uint,
|
capacity: uint,
|
||||||
size: uint,
|
size: uint,
|
||||||
hashes: OwnedPtr<u64>,
|
hashes: UniquePtr<u64>,
|
||||||
// Because K/V do not appear directly in any of the types in the struct,
|
// Because K/V do not appear directly in any of the types in the struct,
|
||||||
// inform rustc that in fact instances of K and V are reachable from here.
|
// inform rustc that in fact instances of K and V are reachable from here.
|
||||||
marker: marker::CovariantType<(K,V)>,
|
marker: marker::CovariantType<(K,V)>,
|
||||||
@@ -563,7 +563,7 @@ impl<K, V> RawTable<K, V> {
|
|||||||
return RawTable {
|
return RawTable {
|
||||||
size: 0,
|
size: 0,
|
||||||
capacity: 0,
|
capacity: 0,
|
||||||
hashes: OwnedPtr::null(),
|
hashes: UniquePtr::null(),
|
||||||
marker: marker::CovariantType,
|
marker: marker::CovariantType,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -602,7 +602,7 @@ impl<K, V> RawTable<K, V> {
|
|||||||
RawTable {
|
RawTable {
|
||||||
capacity: capacity,
|
capacity: capacity,
|
||||||
size: 0,
|
size: 0,
|
||||||
hashes: OwnedPtr(hashes),
|
hashes: UniquePtr(hashes),
|
||||||
marker: marker::CovariantType,
|
marker: marker::CovariantType,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user