]> git.lizzy.rs Git - rust.git/commitdiff
Remove Rc's borrow method to avoid conflicts with RefCell's borrow in Rc<RefCell...
authorEduard Burtescu <edy.burt@gmail.com>
Thu, 27 Feb 2014 22:02:27 +0000 (00:02 +0200)
committerEduard Burtescu <edy.burt@gmail.com>
Thu, 13 Mar 2014 12:21:45 +0000 (14:21 +0200)
28 files changed:
src/doc/tutorial.md
src/libarena/lib.rs
src/librustc/middle/astencode.rs
src/librustc/middle/borrowck/check_loans.rs
src/librustc/middle/borrowck/gather_loans/gather_moves.rs
src/librustc/middle/borrowck/gather_loans/mod.rs
src/librustc/middle/const_eval.rs
src/librustc/middle/kind.rs
src/librustc/middle/liveness.rs
src/librustc/middle/subst.rs
src/librustc/middle/trans/closure.rs
src/librustc/middle/trans/consts.rs
src/librustc/middle/ty.rs
src/librustc/middle/typeck/check/method.rs
src/librustc/middle/typeck/check/mod.rs
src/librustc/middle/typeck/check/vtable.rs
src/librustc/middle/typeck/collect.rs
src/librustdoc/clean.rs
src/librustuv/idle.rs
src/libserialize/serialize.rs
src/libstd/hash/mod.rs
src/libstd/option.rs
src/libstd/rc.rs
src/libsyntax/ext/mtwt.rs
src/libsyntax/print/pprust.rs
src/libsyntax/util/interner.rs
src/test/compile-fail/issue-7013.rs
src/test/run-pass/self-re-assign.rs

index 8f37aecfc34c2edd8227e5d1a14dd86a4a267b7d..15fd21e9fbc079806ae067d495b6c0836185082e 100644 (file)
@@ -1687,7 +1687,7 @@ let x = Rc::new([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
 let y = x.clone(); // a new owner
 let z = x; // this moves `x` into `z`, rather than creating a new owner
 
-assert!(*z.borrow() == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
+assert!(*z == [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]);
 
 // the variable is mutable, but not the contents of the box
 let mut a = Rc::new([10, 9, 8, 7, 6, 5, 4, 3, 2, 1]);
index 1fc88eda37b5fcb3c090247b308ef9a68e93b036..2ccb8e9c4c25034ba764dd0af0228557063ded20 100644 (file)
@@ -51,11 +51,11 @@ struct Chunk {
 }
 impl Chunk {
     fn capacity(&self) -> uint {
-        self.data.borrow().borrow().get().capacity()
+        self.data.deref().borrow().get().capacity()
     }
 
     unsafe fn as_ptr(&self) -> *u8 {
-        self.data.borrow().borrow().get().as_ptr()
+        self.data.deref().borrow().get().as_ptr()
     }
 }
 
index 5959f5a9d02dd632f1541035d34afa77266665a7..06aec8c050e0d58a24fe653516991446eb868eb6 100644 (file)
@@ -1081,7 +1081,7 @@ fn encode_side_tables_for_id(ecx: &e::EncodeContext,
             ebml_w.tag(c::tag_table_capture_map, |ebml_w| {
                 ebml_w.id(id);
                 ebml_w.tag(c::tag_table_val, |ebml_w| {
-                    ebml_w.emit_from_vec(cap_vars.borrow().as_slice(),
+                    ebml_w.emit_from_vec(cap_vars.deref().as_slice(),
                                          |ebml_w, cap_var| {
                         cap_var.encode(ebml_w);
                     })
index 53a363b44f88d403394f45c34b62cf2cef0e2ba9..5972625caad0771fc2ee94122cdfca4ec82d6ca7 100644 (file)
@@ -716,7 +716,7 @@ fn check_captured_variables(&self,
                                 span: Span) {
         let capture_map = self.bccx.capture_map.borrow();
         let cap_vars = capture_map.get().get(&closure_id);
-        for cap_var in cap_vars.borrow().iter() {
+        for cap_var in cap_vars.deref().iter() {
             let var_id = ast_util::def_id_of_def(cap_var.def).node;
             let var_path = @LpVar(var_id);
             self.check_if_path_is_moved(closure_id, span,
index 6dd7ae31c9d386166311de26a7ef625fd406bfde..cfc4b3de38d8c9d1d04dc9650c6da0c5ee58016d 100644 (file)
@@ -49,7 +49,7 @@ pub fn gather_captures(bccx: &BorrowckCtxt,
                        closure_expr: &ast::Expr) {
     let capture_map = bccx.capture_map.borrow();
     let captured_vars = capture_map.get().get(&closure_expr.id);
-    for captured_var in captured_vars.borrow().iter() {
+    for captured_var in captured_vars.deref().iter() {
         match captured_var.mode {
             moves::CapMove => {
                 let cmt = bccx.cat_captured_var(closure_expr.id,
index e50d6da378af1e81a738b9146b3e7299fd4fbadc..135783f510ff0cbacecbfd91b816acf1edc26bdf 100644 (file)
@@ -406,7 +406,7 @@ fn guarantee_captures(&mut self,
                           closure_expr: &ast::Expr) {
         let capture_map = self.bccx.capture_map.borrow();
         let captured_vars = capture_map.get().get(&closure_expr.id);
-        for captured_var in captured_vars.borrow().iter() {
+        for captured_var in captured_vars.deref().iter() {
             match captured_var.mode {
                 moves::CapCopy | moves::CapMove => { continue; }
                 moves::CapRef => { }
index aaa623bd7b2fd527597d4bb85f3a7baa47e70252..7c46f05f1c1a68c83e696b4d500e0c91e9a650df 100644 (file)
@@ -512,7 +512,7 @@ pub fn lit_to_const(lit: &Lit) -> const_val {
     match lit.node {
         LitStr(ref s, _) => const_str((*s).clone()),
         LitBinary(ref data) => {
-            const_binary(Rc::new(data.borrow().iter().map(|x| *x).collect()))
+            const_binary(Rc::new(data.deref().iter().map(|x| *x).collect()))
         }
         LitChar(n) => const_uint(n as u64),
         LitInt(n, _) => const_int(n),
index 90c86cb5e74e2613573bed75859fbf1a0283df28..97aff130dfbfc369dc6d945ab1a25a970a64935a 100644 (file)
@@ -298,7 +298,7 @@ pub fn check_expr(cx: &mut Context, e: &Expr) {
                 }
               }
             };
-            let type_param_defs = type_param_defs.borrow();
+            let type_param_defs = type_param_defs.deref();
             if ts.len() != type_param_defs.len() {
                 // Fail earlier to make debugging easier
                 fail!("internal error: in kind::check_expr, length \
index 02a947a0ddc7af8aff406af13d47f9e8e05a95a3..48a6b5c92d4e8ed1ddeeec78e54e3f447216d8d4 100644 (file)
@@ -505,7 +505,7 @@ fn visit_expr(v: &mut LivenessVisitor, expr: &Expr, this: @IrMaps) {
         let capture_map = this.capture_map.borrow();
         let cvs = capture_map.get().get(&expr.id);
         let mut call_caps = Vec::new();
-        for cv in cvs.borrow().iter() {
+        for cv in cvs.deref().iter() {
             match moves::moved_variable_node_id_from_def(cv.def) {
               Some(rv) => {
                 let cv_ln = this.add_live_node(FreeVarNode(cv.span));
index b0cf17c5b5467f6362c18f8b31d2f58029de8031..82458a69ee65aaabe277d6af152d45a2579ab7f3 100644 (file)
@@ -142,7 +142,7 @@ impl<T:Subst> Subst for Rc<T> {
     fn subst_spanned(&self, tcx: ty::ctxt,
                      substs: &ty::substs,
                      span: Option<Span>) -> Rc<T> {
-        Rc::new(self.borrow().subst_spanned(tcx, substs, span))
+        Rc::new(self.deref().subst_spanned(tcx, substs, span))
     }
 }
 
index f18456a674dd257d5c5adf5568569b217de8cc1e..bfc9d8d2d6d0d47c545007b0dcee80dcb9ed72c0 100644 (file)
@@ -397,21 +397,13 @@ pub fn trans_expr_fn<'a>(
     // set an inline hint for all closures
     set_inline_hint(llfn);
 
-    let cap_vars = {
-        let capture_map = ccx.maps.capture_map.borrow();
-        capture_map.get().get_copy(&id)
-    };
+    let cap_vars = ccx.maps.capture_map.borrow().get().get_copy(&id);
     let ClosureResult {llbox, cdata_ty, bcx} =
-        build_closure(bcx, cap_vars.borrow().as_slice(), sigil);
+        build_closure(bcx, cap_vars.deref().as_slice(), sigil);
     trans_closure(ccx, decl, body, llfn,
                   bcx.fcx.param_substs, id,
                   [], ty::ty_fn_ret(fty),
-                  |bcx| {
-                      load_environment(bcx,
-                                       cdata_ty,
-                                       cap_vars.borrow().as_slice(),
-                                       sigil)
-                  });
+                  |bcx| load_environment(bcx, cdata_ty, cap_vars.deref().as_slice(), sigil));
     fill_fn_pair(bcx, dest_addr, llfn, llbox);
 
     bcx
index f1e6fff533985cfd12f5ca505793d124d8254966..c9317f18168f2f0aafd1d33198c8d96a0ce4b1bf 100644 (file)
@@ -76,9 +76,7 @@ pub fn const_lit(cx: &CrateContext, e: &ast::Expr, lit: ast::Lit)
         ast::LitBool(b) => C_bool(b),
         ast::LitNil => C_nil(),
         ast::LitStr(ref s, _) => C_str_slice(cx, (*s).clone()),
-        ast::LitBinary(ref data) => {
-            C_binary_slice(cx, data.borrow().as_slice())
-        }
+        ast::LitBinary(ref data) => C_binary_slice(cx, data.deref().as_slice()),
     }
 }
 
index b2a879b1946e1c566c7e55a09cbb524ff04ae8e4..7193f6576584b1b62a3f086adbcb8b5ded57fdc2 100644 (file)
@@ -1014,13 +1014,13 @@ pub struct Generics {
 
 impl Generics {
     pub fn has_type_params(&self) -> bool {
-        !self.type_param_defs.borrow().is_empty()
+        !self.type_param_defs.deref().is_empty()
     }
     pub fn type_param_defs<'a>(&'a self) -> &'a [TypeParameterDef] {
-        self.type_param_defs.borrow().as_slice()
+        self.type_param_defs.deref().as_slice()
     }
     pub fn region_param_defs<'a>(&'a self) -> &'a [RegionParameterDef] {
-        self.region_param_defs.borrow().as_slice()
+        self.region_param_defs.deref().as_slice()
     }
 }
 
index ca36fca687abd5afe1d54cf18118c98793ac35ad..114c385b5a0c4db23e4d607f75427e01b61a1be5 100644 (file)
@@ -1030,7 +1030,7 @@ fn confirm_candidate(&self, rcvr_ty: ty::t, candidate: &Candidate)
         let m_regions =
             self.fcx.infcx().region_vars_for_defs(
                 self.expr.span,
-                candidate.method_ty.generics.region_param_defs.borrow().as_slice());
+                candidate.method_ty.generics.region_param_defs.deref().as_slice());
         for &r in m_regions.iter() {
             all_regions.push(r);
         }
index 026d2d5d73454bd26383a7f161f11c69f1da7a72..d032f0f841fc7f4f11c1273397a9cde550684021 100644 (file)
@@ -569,7 +569,7 @@ pub fn check_item(ccx: @CrateCtxt, it: &ast::Item) {
                 fn_tpt.generics.type_param_defs(),
                 [],
                 [],
-                fn_tpt.generics.region_param_defs.borrow().as_slice(),
+                fn_tpt.generics.region_param_defs.deref().as_slice(),
                 body.id);
 
         check_bare_fn(ccx, decl, body, it.id, fn_tpt.ty, param_env);
@@ -3732,7 +3732,7 @@ pub fn instantiate_path(fcx: @FnCtxt,
                         nsupplied = num_supplied_regions));
         }
 
-        fcx.infcx().region_vars_for_defs(span, tpt.generics.region_param_defs.borrow().as_slice())
+        fcx.infcx().region_vars_for_defs(span, tpt.generics.region_param_defs.deref().as_slice())
     };
     let regions = ty::NonerasedRegions(regions);
 
index 57e85ab55d3bc0705b28fbaf91c81c64227e65f1..70fe3cfde50b837ade8370df4d3464826491f174 100644 (file)
@@ -709,15 +709,13 @@ fn mutability_allowed(a_mutbl: ast::Mutability,
             debug!("vtable resolution on parameter bounds for method call {}",
                    ex.repr(fcx.tcx()));
             let type_param_defs = ty::method_call_type_param_defs(cx.tcx, method.origin);
-            if has_trait_bounds(type_param_defs.borrow().as_slice()) {
+            if has_trait_bounds(type_param_defs.deref().as_slice()) {
                 let substs = fcx.method_ty_substs(ex.id);
                 let vcx = fcx.vtable_context();
-                let vtbls = lookup_vtables(&vcx,
-                                           &location_info_for_expr(ex),
-                                           type_param_defs.borrow()
+                let vtbls = lookup_vtables(&vcx, &location_info_for_expr(ex),
+                                           type_param_defs.deref()
                                                           .as_slice(),
-                                           &substs,
-                                           is_early);
+                                           &substs, is_early);
                 if !is_early {
                     insert_vtables(fcx, ex.id, vtbls);
                 }
@@ -829,7 +827,7 @@ pub fn resolve_impl(tcx: ty::ctxt,
 pub fn trans_resolve_method(tcx: ty::ctxt, id: ast::NodeId,
                             substs: &ty::substs) -> Option<vtable_res> {
     let generics = ty::lookup_item_type(tcx, ast_util::local_def(id)).generics;
-    let type_param_defs = generics.type_param_defs.borrow();
+    let type_param_defs = generics.type_param_defs.deref();
     if has_trait_bounds(type_param_defs.as_slice()) {
         let vcx = VtableContext {
             infcx: &infer::new_infer_ctxt(tcx),
index 234e6e92bac9fd8fa2c786339d224bf67db0b6b0..402f06f928ccef54637f7bd02b365c7714322de6 100644 (file)
@@ -342,7 +342,7 @@ fn make_static_method_ty(ccx: &CrateCtxt,
         let mut new_type_param_defs = Vec::new();
         let substd_type_param_defs =
             trait_ty_generics.type_param_defs.subst(tcx, &substs);
-        new_type_param_defs.push_all(substd_type_param_defs.borrow()
+        new_type_param_defs.push_all(substd_type_param_defs.deref()
                                                            .as_slice());
 
         // add in the "self" type parameter
@@ -360,7 +360,7 @@ fn make_static_method_ty(ccx: &CrateCtxt,
 
         // add in the type parameters from the method
         let substd_type_param_defs = m.generics.type_param_defs.subst(tcx, &substs);
-        new_type_param_defs.push_all(substd_type_param_defs.borrow()
+        new_type_param_defs.push_all(substd_type_param_defs.deref()
                                                            .as_slice());
 
         debug!("static method {} type_param_defs={} ty={}, substs={}",
index d42a611053f914618e2be3672a3e5a1d79a2208f..c27725fd5852aeccebbef9a2501565e276059489 100644 (file)
@@ -1192,7 +1192,7 @@ fn to_src(&self) -> ~str {
 fn lit_to_str(lit: &ast::Lit) -> ~str {
     match lit.node {
         ast::LitStr(ref st, _) => st.get().to_owned(),
-        ast::LitBinary(ref data) => format!("{:?}", data.borrow().as_slice()),
+        ast::LitBinary(ref data) => format!("{:?}", data.deref().as_slice()),
         ast::LitChar(c) => ~"'" + std::char::from_u32(c).unwrap().to_str() + "'",
         ast::LitInt(i, _t) => i.to_str(),
         ast::LitUint(u, _t) => u.to_str(),
index aae86b18512bf5224e3eec2c09df77d8e279b55e..a6c0a7b829ae94cdb993eda966090d2fe227616e 100644 (file)
@@ -113,7 +113,7 @@ impl Callback for MyCallback {
         fn call(&mut self) {
             let task = match *self {
                 MyCallback(ref rc, n) => {
-                    let mut slot = rc.borrow().borrow_mut();
+                    let mut slot = rc.deref().borrow_mut();
                     match *slot.get() {
                         (ref mut task, ref mut val) => {
                             *val = n;
@@ -140,7 +140,7 @@ fn mk(v: uint) -> (~IdleWatcher, Chan) {
     fn sleep(chan: &Chan) -> uint {
         let task: ~Task = Local::take();
         task.deschedule(1, |task| {
-            let mut slot = chan.borrow().borrow_mut();
+            let mut slot = chan.deref().borrow_mut();
             match *slot.get() {
                 (ref mut slot, _) => {
                     assert!(slot.is_none());
@@ -150,7 +150,7 @@ fn sleep(chan: &Chan) -> uint {
             Ok(())
         });
 
-        let slot = chan.borrow().borrow();
+        let slot = chan.deref().borrow();
         match *slot.get() { (_, n) => n }
     }
 
index 115bb6cb6f3cf46bb3478fd637d9a99f744b8b7f..fd57f47e8819d546cf02d78d049bd1e1db8c8684 100644 (file)
@@ -388,7 +388,7 @@ fn encode(&self, s: &mut S) {
 impl<S:Encoder,T:Encodable<S>> Encodable<S> for Rc<T> {
     #[inline]
     fn encode(&self, s: &mut S) {
-        self.borrow().encode(s)
+        self.deref().encode(s)
     }
 }
 
index 6c0ae280ed078baef4c1bc631f778fd4d2805f74..dd40f6008735f0d228c7599eb14d8a0bbcde2f71 100644 (file)
@@ -66,6 +66,7 @@
 use container::Container;
 use io::Writer;
 use iter::Iterator;
+use ops::Deref;
 use option::{Option, Some, None};
 use rc::Rc;
 use str::{Str, StrSlice};
@@ -246,7 +247,7 @@ fn hash(&self, state: &mut S) {
 impl<S: Writer, T: Hash<S>> Hash<S> for Rc<T> {
     #[inline]
     fn hash(&self, state: &mut S) {
-        self.borrow().hash(state);
+        self.deref().hash(state);
     }
 }
 
index 86f8c143a9e996b61aeee88c1ea91815f5cb0c9d..31605ca961e6ac1de5b761dc2642fa688dee84cb 100644 (file)
@@ -503,7 +503,7 @@ struct R {
         #[unsafe_destructor]
         impl ::ops::Drop for R {
            fn drop(&mut self) {
-                let ii = self.i.borrow();
+                let ii = self.i.deref();
                 ii.set(ii.get() + 1);
             }
         }
@@ -520,7 +520,7 @@ fn R(i: Rc<RefCell<int>>) -> R {
             let opt = Some(x);
             let _y = opt.unwrap();
         }
-        assert_eq!(i.borrow().get(), 1);
+        assert_eq!(i.deref().get(), 1);
     }
 
     #[test]
index 8a7edc728c0120452de390e3f331ce86a04cf7c9..5c4b19b4e4b8c8c347828edb1a7e30989bc0b9ac 100644 (file)
@@ -63,12 +63,6 @@ pub fn new(value: T) -> Rc<T> {
 }
 
 impl<T> Rc<T> {
-    /// Borrow the value contained in the reference-counted box
-    #[inline(always)]
-    pub fn borrow<'a>(&'a self) -> &'a T {
-        unsafe { &(*self.ptr).value }
-    }
-
     /// Downgrade the reference-counted pointer to a weak reference
     pub fn downgrade(&self) -> Weak<T> {
         unsafe {
@@ -93,7 +87,7 @@ fn drop(&mut self) {
             if self.ptr != 0 as *mut RcBox<T> {
                 (*self.ptr).strong -= 1;
                 if (*self.ptr).strong == 0 {
-                    ptr::read(self.borrow()); // destroy the contained object
+                    ptr::read(self.deref()); // destroy the contained object
 
                     // remove the implicit "strong weak" pointer now
                     // that we've destroyed the contents.
@@ -120,24 +114,24 @@ fn clone(&self) -> Rc<T> {
 
 impl<T: Eq> Eq for Rc<T> {
     #[inline(always)]
-    fn eq(&self, other: &Rc<T>) -> bool { *self.borrow() == *other.borrow() }
+    fn eq(&self, other: &Rc<T>) -> bool { *self.deref() == *other.deref() }
 
     #[inline(always)]
-    fn ne(&self, other: &Rc<T>) -> bool { *self.borrow() != *other.borrow() }
+    fn ne(&self, other: &Rc<T>) -> bool { *self.deref() != *other.deref() }
 }
 
 impl<T: Ord> Ord for Rc<T> {
     #[inline(always)]
-    fn lt(&self, other: &Rc<T>) -> bool { *self.borrow() < *other.borrow() }
+    fn lt(&self, other: &Rc<T>) -> bool { *self.deref() < *other.deref() }
 
     #[inline(always)]
-    fn le(&self, other: &Rc<T>) -> bool { *self.borrow() <= *other.borrow() }
+    fn le(&self, other: &Rc<T>) -> bool { *self.deref() <= *other.deref() }
 
     #[inline(always)]
-    fn gt(&self, other: &Rc<T>) -> bool { *self.borrow() > *other.borrow() }
+    fn gt(&self, other: &Rc<T>) -> bool { *self.deref() > *other.deref() }
 
     #[inline(always)]
-    fn ge(&self, other: &Rc<T>) -> bool { *self.borrow() >= *other.borrow() }
+    fn ge(&self, other: &Rc<T>) -> bool { *self.deref() >= *other.deref() }
 }
 
 /// Weak reference to a reference-counted box
@@ -197,30 +191,30 @@ mod tests {
     fn test_clone() {
         let x = Rc::new(RefCell::new(5));
         let y = x.clone();
-        x.borrow().with_mut(|inner| {
+        x.deref().with_mut(|inner| {
             *inner = 20;
         });
-        assert_eq!(y.borrow().with(|v| *v), 20);
+        assert_eq!(y.deref().with(|v| *v), 20);
     }
 
     #[test]
     fn test_simple() {
         let x = Rc::new(5);
-        assert_eq!(*x.borrow(), 5);
+        assert_eq!(*x.deref(), 5);
     }
 
     #[test]
     fn test_simple_clone() {
         let x = Rc::new(5);
         let y = x.clone();
-        assert_eq!(*x.borrow(), 5);
-        assert_eq!(*y.borrow(), 5);
+        assert_eq!(*x.deref(), 5);
+        assert_eq!(*y.deref(), 5);
     }
 
     #[test]
     fn test_destructor() {
         let x = Rc::new(~5);
-        assert_eq!(**x.borrow(), 5);
+        assert_eq!(**x.deref(), 5);
     }
 
     #[test]
@@ -243,7 +237,7 @@ fn gc_inside() {
         // see issue #11532
         use gc::Gc;
         let a = Rc::new(RefCell::new(Gc::new(1)));
-        assert!(a.borrow().try_borrow_mut().is_some());
+        assert!(a.deref().try_borrow_mut().is_some());
     }
 
     #[test]
@@ -254,7 +248,7 @@ struct Cycle {
 
         let a = Rc::new(Cycle { x: RefCell::new(None) });
         let b = a.clone().downgrade();
-        *a.borrow().x.borrow_mut().get() = Some(b);
+        *a.deref().x.borrow_mut().get() = Some(b);
 
         // hopefully we don't double-free (or leak)...
     }
index b0ed215f3e1036cbd258fa849265fdd790221af4..b7fad22a7ad94ed7a6bd2f04e4c19f7fff68c7db 100644 (file)
@@ -103,7 +103,7 @@ pub fn with_sctable<T>(op: |&SCTable| -> T) -> T {
             }
             Some(ts) => ts.clone()
         };
-        op(table.borrow())
+        op(table.deref())
     })
 }
 
@@ -158,7 +158,7 @@ fn with_resolve_table_mut<T>(op: |&mut ResolveTable| -> T) -> T {
             }
             Some(ts) => ts.clone()
         };
-        op(table.borrow().borrow_mut().get())
+        op(table.deref().borrow_mut().get())
     })
 }
 
index 45ab4c6956a49bb7bd36e3f5326d11d864c09b4c..6894d6a2b053736a764a9ee2fe38df9db4d25eef 100644 (file)
@@ -2291,7 +2291,7 @@ pub fn print_literal(s: &mut State, lit: &ast::Lit) -> io::IoResult<()> {
       ast::LitBinary(ref arr) => {
         try!(ibox(s, indent_unit));
         try!(word(&mut s.s, "["));
-        try!(commasep_cmnt(s, Inconsistent, arr.borrow().as_slice(),
+        try!(commasep_cmnt(s, Inconsistent, arr.deref().as_slice(),
                              |s, u| word(&mut s.s, format!("{}", *u)),
                              |_| lit.span));
         try!(word(&mut s.s, "]"));
index ba154a8d8923c12138a9e72a219e72f98913e22e..969c7cec87ccea623ffe595a6b93eb5eade6427f 100644 (file)
@@ -106,13 +106,13 @@ fn cmp(&self, other: &RcStr) -> Ordering {
 impl Str for RcStr {
     #[inline]
     fn as_slice<'a>(&'a self) -> &'a str {
-        let s: &'a str = *self.string.borrow();
+        let s: &'a str = *self.string.deref();
         s
     }
 
     #[inline]
     fn into_owned(self) -> ~str {
-        self.string.borrow().to_owned()
+        self.string.deref().to_owned()
     }
 }
 
index 05d7b878d767b146711caabb03e06254424d4b07..800549b7737c63c3f676e0b87b42837b5903a23c 100644 (file)
@@ -40,7 +40,7 @@ fn main()
     //~^ ERROR cannot pack type `~B`, which does not fulfill `Send`
     let v = Rc::new(RefCell::new(a));
     let w = v.clone();
-    let b = v.borrow();
+    let b = v.deref();
     let mut b = b.borrow_mut();
     b.get().v.set(w.clone());
 }
index 041c5cf4a640e5ac05bdffd1378604d0df7170de..cba142680dfb93fe27083d156cef1488ec44d631 100644 (file)
@@ -20,5 +20,5 @@ pub fn main() {
 
    let mut x = Rc::new(3);
    x = x;
-   assert!(*x.borrow() == 3);
+   assert!(*x.deref() == 3);
 }