Skip to content

Instantly share code, notes, and snippets.

@iamtakingiteasy
Created July 14, 2012 11:29
Show Gist options
  • Save iamtakingiteasy/3110756 to your computer and use it in GitHub Desktop.
Save iamtakingiteasy/3110756 to your computer and use it in GitHub Desktop.
import to_str::*;
class bf_stack {
priv {
let mut data : ~[int];
}
new() {
self.data = ~[0];
}
fn to_str() -> str {
self.data.to_str()
}
}
fn main() {
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
user@note ~/soft/mine/rust $ rustc main.rs && echo done && ./main
main.rs:13:8: 13:17 error: illegal borrow unless pure: creating immutable alias to aliasable, mutable memory
main.rs:13 self.data.to_str()
^~~~~~~~~
main.rs:13:8: 13:24 note: impure due to access to impure function
main.rs:13 self.data.to_str()
^~~~~~~~~~~~~~~~
error: aborting due to previous error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment