News for hackers. Stuff that matters.
Re:Pre-Pooping Your Pants with Rust by mcguire on Monday April 27, 2015 @11:21AM (#9446851)
Largely unrelated question: In the code about a third of the way into the article, there is,

    impl<'a> Drop for Foo<'a> {
        fn drop(&mut self) {
            *self.0 += 1;
        }
    }
What does the line "self.0 += 1;" do? Specifically, the ".0"? Foo is a basically a reference to an i32, so I would have thought that would be "self += 1;".
Re:Pre-Pooping Your Pants with Rust by steveklabnik on Monday April 27, 2015 @11:35AM (#9446939)
The .0 is a tuple access. Foo is a 'tuple struct' of length 1: http://doc.rust-lang.org/nightly/book/tuple-structs.html (though the syntax is explained in the section on tuples: http://doc.rust-lang.org/nightly/book/primitive-types.html#t... )
Re:Pre-Pooping Your Pants with Rust by mcguire on Monday April 27, 2015 @12:29PM (#9447316)
Ah! Cool. Thanks!