Feb. 4th, 2013

tim: Tim with short hair, smiling, wearing a black jacket over a white T-shirt (Default)
Over on geekfeminism.org, I wrote a reflection on Joseph Reagle's article "Free as in sexist?": "Open Source, Closed Minds?" I've written a few other posts on geekfeminism.org that I forgot to link to here:
tim: Tim with short hair, smiling, wearing a black jacket over a white T-shirt (Default)
I'm glad people got something out of my previous post! I would like to write more posts like that, but they take *a long time* to write. It's more important to me to make sure I post regularly about work than to post the highest-quality content than I can, so I usually stick with this "what did I do today?" format. Still, I'll try to occasionally write a longer post to mix it up (and you can always ask me a question about Rust, here or on Twitter; it just might inspire me).

The snapshot I tried to build over the weekend failed to build on Mac and Linux, and I'm glad I decided to just set that aside for the rest of the weekend, because I never would have figured out the problem on my own. The problem relates to two fun aspects of Rust: the compiler is self-hosting, and on Mac and Linux, we cross-compile so as to generate binaries for both 32-bit and 64-bit machines. That's why the build only failed on Mac and Linux.

Often when we're trying to remove a feature from the language (I was -- structural records), we'll add #[cfg(stage0)] attributes -- same for 1, 2, and/or 3 -- so as to have different versions of the same piece of code that gets used in different compiler "stages". Stage 0 is the snapshot, stage 1 is the result of building the compiler from a new source code tree using the snapshot, stage 2 is the same as stage 1 except building with the stage1 compiler (on the same source code tree) instead of the snapshot, and so on. (So it's *not* actually turtles all the way down.) Also, macros and staging interact in "fun" ways and so it's particularly hard to remove a feature when macros generate code that uses it. I was trying to change the Buffer type, which the pipes compiler (implemented as a syntax extension) uses, and I accidentally made the "old" version active in stage0 and stage1, and the new one only in stage2. What threw me off was that the FreeBSD and Windows snapshots built anyway -- but it turns out our build system interprets stages in some weird ways when we're cross-compiling.

Figuring that out was the painful part (though Graydon helped a lot) and then it was just a matter of following the type errors. Just another day of compiler janitor work (and I wouldn't want it any other way). Removing deprecated features is one of those things they don't (usually) teach you about in grad school.

As soon as the snapshot finishes building, I think that should allow me to banish structural records completely from the core library! (Which is only the first step to removing them completely; the compiler still uses them.) I actually submitted a pull request earlier that removes the last structural records from the standard library, which doesn't require the snapshot. Our shiny new build automation robot will, I hope, merge it in due course.


tim: Tim with short hair, smiling, wearing a black jacket over a white T-shirt (Default)
Tim Chevalier

October 2017

8910 11121314
15 161718192021

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags