Skip to content

Commit b468789

Browse files
authored
Merge pull request #611 from RalfJung/str-index-mut
test mutable string slice indexing
2 parents 39275ab + ad8a5d9 commit b468789

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

rust-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
nightly-2019-02-13
1+
nightly-2019-02-14

tests/run-pass/strings.rs

+7
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)