You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pure fn mk_str() -> ~str {
let mut s = ~"";
str::push_char(&mut s, 'c');
s
}
This doesn't work because push_char isn't pure. Morally, it seems like it should work, though, because although push_char does modify memory it doesn't own, mk_str owns the memory and should be allowed to call a function that modifies it.
I'm sure this question has come up before, but I don't know if there's an issue on it. If we do keep purity in the language, it seems like it's worth thinking about.