]> git.lizzy.rs Git - rust.git/commitdiff
Rename misleading contains_managed to owns_managed
authorNiko Matsakis <niko@alum.mit.edu>
Tue, 5 Nov 2013 19:50:33 +0000 (14:50 -0500)
committerNiko Matsakis <niko@alum.mit.edu>
Tue, 5 Nov 2013 20:51:18 +0000 (15:51 -0500)
15 files changed:
src/librustc/middle/trans/_match.rs
src/librustc/middle/trans/base.rs
src/librustc/middle/trans/closure.rs
src/librustc/middle/trans/datum.rs
src/librustc/middle/trans/debuginfo.rs
src/librustc/middle/trans/glue.rs
src/librustc/middle/trans/intrinsic.rs
src/librustc/middle/trans/reflect.rs
src/librustc/middle/trans/tvec.rs
src/librustc/middle/trans/type_of.rs
src/librustc/middle/trans/uniq.rs
src/librustc/middle/ty.rs
src/librustc/middle/typeck/check/mod.rs
src/libstd/unstable/intrinsics.rs
src/libstd/vec.rs

index a36d938052a9175b7b2736b29218248fe2da30ae..9bafea6d861be50987060cdb11b15c6402fc7699 100644 (file)
@@ -1600,7 +1600,7 @@ fn compile_submatch_continue(mut bcx: @mut Block,
         let pat_ty = node_id_type(bcx, pat_id);
         let llbox = Load(bcx, val);
         let unboxed = match ty::get(pat_ty).sty {
-            ty::ty_uniq(*) if !ty::type_contents(bcx.tcx(), pat_ty).contains_managed() => llbox,
+            ty::ty_uniq(*) if !ty::type_contents(bcx.tcx(), pat_ty).owns_managed() => llbox,
             _ => GEPi(bcx, llbox, [0u, abi::box_field_body])
         };
         compile_submatch(bcx, enter_uniq(bcx, dm, m, col, val),
@@ -2220,7 +2220,7 @@ fn bind_irrefutable_pat(bcx: @mut Block,
             let pat_ty = node_id_type(bcx, pat.id);
             let llbox = Load(bcx, val);
             let unboxed = match ty::get(pat_ty).sty {
-                ty::ty_uniq(*) if !ty::type_contents(bcx.tcx(), pat_ty).contains_managed() => llbox,
+                ty::ty_uniq(*) if !ty::type_contents(bcx.tcx(), pat_ty).owns_managed() => llbox,
                     _ => GEPi(bcx, llbox, [0u, abi::box_field_body])
             };
             bcx = bind_irrefutable_pat(bcx, inner, unboxed, binding_mode);
index 64a4c453b2deb9e3befe5ff102ae5c0ebdb2b1ce..37e4d4e82be51fde768c59cd7d311caa8a8a1117 100644 (file)
@@ -409,7 +409,7 @@ pub fn malloc_general(bcx: @mut Block, t: ty::t, heap: heap) -> MallocResult {
 }
 
 pub fn heap_for_unique(bcx: @mut Block, t: ty::t) -> heap {
-    if ty::type_contents(bcx.tcx(), t).contains_managed() {
+    if ty::type_contents(bcx.tcx(), t).owns_managed() {
         heap_managed_unique
     } else {
         heap_exchange
index f036f922de9ccf57db9c2298ff2e6d8cc43835e9..9629615c64dd9210c4678ae390e7b5620d7b4528 100644 (file)
@@ -156,7 +156,7 @@ pub fn mk_closure_tys(tcx: ty::ctxt,
 }
 
 fn heap_for_unique_closure(bcx: @mut Block, t: ty::t) -> heap {
-    if ty::type_contents(bcx.tcx(), t).contains_managed() {
+    if ty::type_contents(bcx.tcx(), t).owns_managed() {
         heap_managed_unique
     } else {
         heap_exchange_closure
index d57c24e37d57e61f5202dbcfa66a93794aad1247..1efa7f763d8f9a96a3240317947c53d3559ac589 100644 (file)
@@ -566,7 +566,7 @@ pub fn box_body(&self, bcx: @mut Block) -> Datum {
             }
         };
 
-        if !header && !ty::type_contents(bcx.tcx(), content_ty).contains_managed() {
+        if !header && !ty::type_contents(bcx.tcx(), content_ty).owns_managed() {
             let ptr = self.to_value_llval(bcx);
             let ty = type_of::type_of(bcx.ccx(), content_ty);
             let body = PointerCast(bcx, ptr, ty.ptr_to());
index 3e17bc1b585a1a514b3e04d888c0a0de7b8d0629..c6a33864620ad3f0756e8d426fc44c577baa8232 100644 (file)
@@ -2060,7 +2060,7 @@ fn create_pointer_to_box_metadata(cx: &mut CrateContext,
                 ty::vstore_fixed(len) => {
                     fixed_vec_metadata(cx, mt.ty, len, usage_site_span)
                 }
-                ty::vstore_uniq if ty::type_contents(cx.tcx, mt.ty).contains_managed() => {
+                ty::vstore_uniq if ty::type_contents(cx.tcx, mt.ty).owns_managed() => {
                     let boxed_vec_metadata = boxed_vec_metadata(cx, mt.ty, usage_site_span);
                     pointer_type_metadata(cx, t, boxed_vec_metadata)
                 }
@@ -2077,7 +2077,7 @@ fn create_pointer_to_box_metadata(cx: &mut CrateContext,
                 }
             }
         },
-        ty::ty_uniq(ref mt) if ty::type_contents(cx.tcx, mt.ty).contains_managed() => {
+        ty::ty_uniq(ref mt) if ty::type_contents(cx.tcx, mt.ty).owns_managed() => {
             create_pointer_to_box_metadata(cx, t, mt.ty)
         },
         ty::ty_uniq(ref mt)    |
index 02b44907f336adbe09cb89d8193682ee35b80bd2..f461120e4c38aa8644e537e3d7c86a659fe1123d 100644 (file)
@@ -603,7 +603,7 @@ pub fn declare_tydesc(ccx: &mut CrateContext, t: ty::t) -> @mut tydesc_info {
 
     let has_header = match ty::get(t).sty {
         ty::ty_box(*) => true,
-        ty::ty_uniq(*) => ty::type_contents(ccx.tcx, t).contains_managed(),
+        ty::ty_uniq(*) => ty::type_contents(ccx.tcx, t).owns_managed(),
         _ => false
     };
 
index 3d1c74028cc3b2e623922c48d6277c915ffe5c76..a7af10b491ee6d9443035178f5996ec16572cb10 100644 (file)
@@ -387,9 +387,9 @@ fn count_zeros_intrinsic(bcx: @mut Block, name: &'static str) {
             let tp_ty = substs.tys[0];
             Ret(bcx, C_bool(ty::type_needs_drop(ccx.tcx, tp_ty)));
         }
-        "contains_managed" => {
+        "owns_managed" => {
             let tp_ty = substs.tys[0];
-            Ret(bcx, C_bool(ty::type_contents(ccx.tcx, tp_ty).contains_managed()));
+            Ret(bcx, C_bool(ty::type_contents(ccx.tcx, tp_ty).owns_managed()));
         }
         "visit_tydesc" => {
             let td = get_param(decl, first_real_arg);
index c56d88355495f4f08bfc4a860a0244d2f2a3c922..2f4fcfed20be9754c7302cd54186f20df087a9d1 100644 (file)
@@ -183,7 +183,7 @@ pub fn visit_ty(&mut self, t: ty::t) {
           ty::ty_evec(ref mt, vst) => {
               let (name, extra) = self.vstore_name_and_extra(t, vst);
               let extra = extra + self.c_mt(mt);
-              if "uniq" == name && ty::type_contents(bcx.tcx(), t).contains_managed() {
+              if "uniq" == name && ty::type_contents(bcx.tcx(), t).owns_managed() {
                   self.visit("evec_uniq_managed", extra)
               } else {
                   self.visit(~"evec_" + name, extra)
@@ -195,7 +195,7 @@ pub fn visit_ty(&mut self, t: ty::t) {
           }
           ty::ty_uniq(ref mt) => {
               let extra = self.c_mt(mt);
-              if ty::type_contents(bcx.tcx(), t).contains_managed() {
+              if ty::type_contents(bcx.tcx(), t).owns_managed() {
                   self.visit("uniq_managed", extra)
               } else {
                   self.visit("uniq", extra)
index 1f9e9037179313b0375ab0a0942558ada62fd8df..93718fc1a238292b2a1edd09d3da4ca9bb536f52 100644 (file)
@@ -65,7 +65,7 @@ pub fn get_alloc(bcx: @mut Block, vptr: ValueRef) -> ValueRef {
 }
 
 pub fn get_bodyptr(bcx: @mut Block, vptr: ValueRef, t: ty::t) -> ValueRef {
-    if ty::type_contents(bcx.tcx(), t).contains_managed() {
+    if ty::type_contents(bcx.tcx(), t).owns_managed() {
         GEPi(bcx, vptr, [0u, abi::box_field_body])
     } else {
         vptr
index 2a8d16a2ceb83ab784368bf26984c0123a57171b..604321a0492a117728db3772764cd95152b20109 100644 (file)
@@ -226,7 +226,7 @@ pub fn type_of(cx: &mut CrateContext, t: ty::t) -> Type {
       ty::ty_opaque_box => Type::opaque_box(cx).ptr_to(),
       ty::ty_uniq(ref mt) => {
           let ty = type_of(cx, mt.ty);
-          if ty::type_contents(cx.tcx, mt.ty).contains_managed() {
+          if ty::type_contents(cx.tcx, mt.ty).owns_managed() {
               Type::unique(cx, &ty).ptr_to()
           } else {
               ty.ptr_to()
@@ -235,7 +235,7 @@ pub fn type_of(cx: &mut CrateContext, t: ty::t) -> Type {
       ty::ty_evec(ref mt, ty::vstore_uniq) => {
           let ty = type_of(cx, mt.ty);
           let ty = Type::vec(cx.sess.targ_cfg.arch, &ty);
-          if ty::type_contents(cx.tcx, mt.ty).contains_managed() {
+          if ty::type_contents(cx.tcx, mt.ty).owns_managed() {
               Type::unique(cx, &ty).ptr_to()
           } else {
               ty.ptr_to()
index 93335de229275391842d6d2ac37013bf23f23f6c..8ff270e236fa5901c43678be67cde359a1fb765b 100644 (file)
@@ -27,7 +27,7 @@ pub fn make_free_glue(bcx: @mut Block, vptrptr: ValueRef, box_ty: ty::t)
         let body_datum = box_datum.box_body(bcx);
         let bcx = glue::drop_ty(bcx, body_datum.to_ref_llval(bcx),
                                 body_datum.ty);
-        if ty::type_contents(bcx.tcx(), box_ty).contains_managed() {
+        if ty::type_contents(bcx.tcx(), box_ty).owns_managed() {
             glue::trans_free(bcx, box_datum.val)
         } else {
             glue::trans_exchange_free(bcx, box_datum.val)
index 6168ecb4506cae2dd763179bf27bb70247b4390d..7f9edba2f141673bd5377b1a9abf37e093355b6c 100644 (file)
@@ -1954,7 +1954,7 @@ pub fn is_sendable(&self, _: ctxt) -> bool {
         !self.intersects(TC::Nonsendable)
     }
 
-    pub fn contains_managed(&self) -> bool {
+    pub fn owns_managed(&self) -> bool {
         self.intersects(TC::OwnsManaged)
     }
 
index 9678331848100f8442bdf1beafe454b89746d1b8..32284584b65837e03a54da2710679401ae2eb0ff 100644 (file)
@@ -3732,7 +3732,7 @@ fn param(ccx: @mut CrateCtxt, n: uint) -> ty::t {
                ty::mk_nil())
             }
             "needs_drop" => (1u, ~[], ty::mk_bool()),
-            "contains_managed" => (1u, ~[], ty::mk_bool()),
+            "owns_managed" => (1u, ~[], ty::mk_bool()),
             "atomic_xchg"     | "atomic_xadd"     | "atomic_xsub"     |
             "atomic_xchg_acq" | "atomic_xadd_acq" | "atomic_xsub_acq" |
             "atomic_xchg_rel" | "atomic_xadd_rel" | "atomic_xsub_rel" => {
index 404ed85985c422dcdaea509fa0a9b38381c23712..030364c75af4b36b4f3a1f78537f5765614aeacd 100644 (file)
@@ -337,8 +337,13 @@ fn visit_leave_fn(&mut self, purity: uint, proto: uint,
     pub fn needs_drop<T>() -> bool;
 
     /// Returns `true` if a type is managed (will be allocated on the local heap)
+    #[cfg(stage0)]
     pub fn contains_managed<T>() -> bool;
 
+    /// Returns `true` if a type is managed (will be allocated on the local heap)
+    #[cfg(not(stage0))]
+    pub fn owns_managed<T>() -> bool;
+
     pub fn visit_tydesc(td: *TyDesc, tv: &mut TyVisitor);
 
     /// Get the address of the `__morestack` stack growth function.
index b10d0ded5b47757345b2b3b6bca964dd0cb27aa9..c9d557350151eba2f95318da29924a0d63b98e8d 100644 (file)
 use uint;
 use unstable::finally::Finally;
 use unstable::intrinsics;
-use unstable::intrinsics::{get_tydesc, contains_managed};
+use unstable::intrinsics::{get_tydesc};
 use unstable::raw::{Box, Repr, Slice, Vec};
 use vec;
 use util;
 
+#[cfg(not(stage0))]
+use unstable::intrinsics::owns_managed;
+
+#[cfg(stage0)]
+unsafe fn owns_managed<T>() -> bool {
+    intrinsics::contains_managed::<T>()
+}
+
 /**
  * Creates and initializes an owned vector.
  *
@@ -180,7 +188,7 @@ pub fn from_elem<T:Clone>(n_elts: uint, t: T) -> ~[T] {
 #[inline]
 pub fn with_capacity<T>(capacity: uint) -> ~[T] {
     unsafe {
-        if contains_managed::<T>() {
+        if owns_managed::<T>() {
             let mut vec = ~[];
             vec.reserve(capacity);
             vec
@@ -1401,7 +1409,7 @@ fn reserve(&mut self, n: uint) {
         if self.capacity() < n {
             unsafe {
                 let td = get_tydesc::<T>();
-                if contains_managed::<T>() {
+                if owns_managed::<T>() {
                     let ptr: *mut *mut Box<Vec<()>> = cast::transmute(self);
                     ::at_vec::raw::reserve_raw(td, ptr, n);
                 } else {
@@ -1437,7 +1445,7 @@ fn reserve_additional(&mut self, n: uint) {
     #[inline]
     fn capacity(&self) -> uint {
         unsafe {
-            if contains_managed::<T>() {
+            if owns_managed::<T>() {
                 let repr: **Box<Vec<()>> = cast::transmute(self);
                 (**repr).data.alloc / mem::nonzero_size_of::<T>()
             } else {
@@ -1460,7 +1468,7 @@ fn shrink_to_fit(&mut self) {
     #[inline]
     fn push(&mut self, t: T) {
         unsafe {
-            if contains_managed::<T>() {
+            if owns_managed::<T>() {
                 let repr: **Box<Vec<()>> = cast::transmute(&mut *self);
                 let fill = (**repr).data.fill;
                 if (**repr).data.alloc <= fill {
@@ -1482,7 +1490,7 @@ fn push(&mut self, t: T) {
         // This doesn't bother to make sure we have space.
         #[inline] // really pretty please
         unsafe fn push_fast<T>(this: &mut ~[T], t: T) {
-            if contains_managed::<T>() {
+            if owns_managed::<T>() {
                 let repr: **mut Box<Vec<u8>> = cast::transmute(this);
                 let fill = (**repr).data.fill;
                 (**repr).data.fill += mem::nonzero_size_of::<T>();
@@ -2057,9 +2065,14 @@ pub mod raw {
     use mem;
     use unstable::intrinsics;
     use vec::{with_capacity, ImmutableVector, MutableVector};
-    use unstable::intrinsics::contains_managed;
     use unstable::raw::{Box, Vec, Slice};
 
+    #[cfg(not(stage0))]
+    use unstable::intrinsics::owns_managed;
+
+    #[cfg(stage0)]
+    use vec::owns_managed;
+
     /**
      * Sets the length of a vector
      *
@@ -2069,7 +2082,7 @@ pub mod raw {
      */
     #[inline]
     pub unsafe fn set_len<T>(v: &mut ~[T], new_len: uint) {
-        if contains_managed::<T>() {
+        if owns_managed::<T>() {
             let repr: **mut Box<Vec<()>> = cast::transmute(v);
             (**repr).data.fill = new_len * mem::nonzero_size_of::<T>();
         } else {