logoalt Hacker News

mjr00yesterday at 8:47 PM2 repliesview on HN

This is Rust we're talking about. It doesn't even need to work; as long as it compiles, it's correct.


Replies

speedgooseyesterday at 8:52 PM

    use std::fs::File;
    use std::io::prelude::*;
    
    fn main() -> std::io::Result<()> {
        let mut file = File::create("content.txt")?;
        file.write_all(b"3!")?;
        Ok(())
    }
show 1 reply
dataflowyesterday at 9:20 PM

> This is Rust we're talking about. It doesn't even need to work; as long as it compiles, it's correct.

No, it doesn't even need to compile. The mere fact that it's in Rust means it's correct.