Skip to content

Commit

Permalink
Merge pull request #611 from RalfJung/str-index-mut
Browse files Browse the repository at this point in the history
test mutable string slice indexing
  • Loading branch information
RalfJung authored Feb 14, 2019
2 parents 39275ab + ad8a5d9 commit b468789
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion rust-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
nightly-2019-02-13
nightly-2019-02-14
7 changes: 7 additions & 0 deletions tests/run-pass/strings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,17 @@ fn fat_pointer_on_32_bit() {
Some(5).expect("foo");
}

fn str_indexing() {
let mut x = "Hello".to_string();
let _v = &mut x[..3]; // Test IndexMut on String.
}

fn main() {
assert_eq!(empty(), "");
assert_eq!(hello(), "Hello, world!");
assert_eq!(hello_bytes(), b"Hello, world!");
assert_eq!(hello_bytes_fat(), b"Hello, world!");

fat_pointer_on_32_bit(); // Should run without crashing.
str_indexing();
}

0 comments on commit b468789

Please sign in to comment.