]> git.lizzy.rs Git - rust.git/blobdiff - src/test/run-pass/overloaded-deref.rs
libstd: Implement `StrBuf`, a new string buffer type like `Vec`, and
[rust.git] / src / test / run-pass / overloaded-deref.rs
index aa9a66daed7918cb2b1ff485ea9e6dc5104afd14..27edb2f0088bc24110a9c76c093cf47e456ff82c 100644 (file)
@@ -10,6 +10,7 @@
 
 use std::cell::RefCell;
 use std::rc::Rc;
+use std::strbuf::StrBuf;
 
 #[deriving(Eq, Show)]
 struct Point {
@@ -31,7 +32,7 @@ pub fn main() {
     assert_eq!(*s, ~"foo");
     assert_eq!((*s).as_slice(), "foo");
 
-    let mut_s = Rc::new(RefCell::new(~"foo"));
+    let mut_s = Rc::new(RefCell::new(StrBuf::from_str("foo")));
     (*(*mut_s).borrow_mut()).push_str("bar");
     // assert_eq! would fail here because it stores the LHS and RHS in two locals.
     assert!((*(*mut_s).borrow()).as_slice() == "foobar");