Skip to content

Instantly share code, notes, and snippets.

@olsonjeffery
Created September 15, 2013 15:46
Show Gist options
  • Save olsonjeffery/6571905 to your computer and use it in GitHub Desktop.
Save olsonjeffery/6571905 to your computer and use it in GitHub Desktop.
fn rmdir(&self) {
let p = self.get_path().to_str();
match suppressed_stat(|| self.stat()) {
Some(s) => {
match s.is_dir {
true => rmdir(self.get_path()),
false => {
let ioerr = IoError {
kind: MismatchedFileTypeForOperation,
desc: fmt!("%s is not a directory", p),
detail: None
};
io_error::cond.raise(ioerr);
}
}
},
None =>
io_error::cond.raise(IoError {
kind: PathDoesntExist,
desc: self.get_path().to_str() + ~" doesn't exist",
detail: None
})
}
}
/Users/jeff/src/rust/src/libstd/rt/io/file.rs:370:34: 370:67 error: borrowed value does not live long enough
/Users/jeff/src/rust/src/libstd/rt/io/file.rs:370 desc: fmt!("%s is not a directory", p),
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment