←back to thread

134 points ingve | 1 comments | | HN request time: 0.21s | source
Show context
01HNNWZ0MV43FF ◴[] No.44007289[source]
I'm surprised 1.0 didn't have the error codes. Error codes should be table stakes for anything that produces errors, really (Looking at you, proprietary codebases where I was putting in error codes while other people were writing the C++ equivalent of `.expect("the value to be right")`)
replies(1): >>44007558 #
steveklabnik ◴[] No.44007558[source]
I was a big advocate of adding error codes. I don't remember specifically the timeline, but we had so much stuff to do for 1.0, it doesn't surprise me that it got pushed back a bit.

At the time, I was thinking about the big old chunky Visual Basic manuals I used to own, and how useful those were.

EDIT: okay, so I'm doing some digging: error codes were added before 1.0... https://github.com/rust-lang/rust/commit/0e80dbe59ea986ea53c...

> This implements the minimal scaffolding that allows mapping diagnostic messages to alpha-numeric codes, which could improve the searchability of errors. In addition, there's a new compiler option, `--explain {code}` which takes an error code and prints out a somewhat detailed explanation of the error.

committed on Jul 10, 2014

I think I've figured out what happened here: the particular error that was chosen didn't have a code until 1.2. The example from this commit does show a code on Rust 1.0.0: https://godbolt.org/z/14hcb3ETG

replies(1): >>44008037 #
pcwalton ◴[] No.44008037[source]
My recollection is that Brian Anderson, who came from the C# world, was an early advocate of the easily-googlable error codes that Microsoft compilers use a lot, and pushed to get them in. That was a good call. (In general Brian had a lot of behind-the-scenes positive influence on Rust: my favorite brson-ism is "if the code doesn't have a test it doesn't exist".)
replies(1): >>44008083 #
1. steveklabnik ◴[] No.44008083[source]
Yeah this PR cites it as explicitly a continuation of Bryan’s work. I never did any implementation work on errors, I was just a big fan of the codes concept.