Closed
Description
Recall from the borrowing rules that if we have an immutable reference to something, we cannot also take a mutable reference. Because clear needs to truncate the String, it tries to take a mutable reference, which fails. Not only has Rust made our API easier to use, but it has also eliminated an entire class of errors at compile time!
"it tries to take a mutable reference, which fails" sounds dynamic. But the whole point is that this is statically checked.