about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2015-01-08 12:39:56 +0000
committerbors <bors@rust-lang.org>2015-01-08 12:39:56 +0000
commit2f99a41fe1a27a48e96bc2616ec9faa6de924386 (patch)
tree1afcf7d9dfc207fb8205ba10063963ffea4bf99d /src
parent5364c4853fa61aced8fdf773d9de41b929a0d318 (diff)
parent3155b3101108dc9a3be32b6cb3cf33b9e1c45a0c (diff)
downloadrust-2f99a41fe1a27a48e96bc2616ec9faa6de924386.tar.gz
rust-2f99a41fe1a27a48e96bc2616ec9faa6de924386.zip
auto merge of #20744 : huonw/rust/fix-string-slicing, r=pnkfelix
Diffstat (limited to 'src')
-rw-r--r--src/libcollections/string.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/libcollections/string.rs b/src/libcollections/string.rs
index 1bb0be05b1e..317f03e1b7d 100644
--- a/src/libcollections/string.rs
+++ b/src/libcollections/string.rs
@@ -932,7 +932,7 @@ pub trait ToString {
     fn to_string(&self) -> String;
 }
 
-impl<T: fmt::String> ToString for T {
+impl<T: fmt::String + ?Sized> ToString for T {
     fn to_string(&self) -> String {
         use core::fmt::Writer;
         let mut buf = String::new();
@@ -995,6 +995,12 @@ mod tests {
     }
 
     #[test]
+    fn test_unsized_to_string() {
+        let s: &str = "abc";
+        let _: String = (*s).to_string();
+    }
+
+    #[test]
     fn test_from_utf8() {
         let xs = b"hello".to_vec();
         assert_eq!(String::from_utf8(xs).unwrap(),