Fix errors caused by removal of ~str from Rust