3 ms·
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 codebas
by 01HNNWZ0MV43FF 1y ago
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")`)
- steveklabnik 1y agoI 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/0e80dbe59ea986ea53cc3caabffd40b2eaee4dc6 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 https://godbolt.org/z/14hcb3ETG
- pcwalton 1y agoMy 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".)
- steveklabnik 1y agoYeah 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.