Mastodon Feed: Post

Mastodon Feed

NfNitLoop ("Cody Casterline 🏳️‍🌈") wrote:

@dysfun what things can’t you explore with RAII?

The main complaint I hear about rusts RAII is that Drop::drop() can’t return a Result, so any errors in cleaning things up (ex: File.close()) either get swallowed or have to become panics.

Rust lets you mark some types (ex: Result) as must_use.

I feel like a must_drop (manually) annotation would be a great addition to help remind folks to manually clean up and handle errors.