Skip to content

Commit e5972c3

Browse files
committed
test mutable string slice indexing
1 parent 9e0e219 commit e5972c3

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

tests/run-pass/strings.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,17 @@ fn fat_pointer_on_32_bit() {
1818
Some(5).expect("foo");
1919
}
2020

21+
fn str_indexing() {
22+
let mut x = "Hello".to_string();
23+
let _v = &mut x[..3]; // Test IndexMut on String.
24+
}
25+
2126
fn main() {
2227
assert_eq!(empty(), "");
2328
assert_eq!(hello(), "Hello, world!");
2429
assert_eq!(hello_bytes(), b"Hello, world!");
2530
assert_eq!(hello_bytes_fat(), b"Hello, world!");
31+
2632
fat_pointer_on_32_bit(); // Should run without crashing.
33+
str_indexing();
2734
}

0 commit comments

Comments
 (0)