rustc: Add UI for extended diagnostics

When diagnostics with codes are emitted they appear in magenta brackets,
like `[A0002]`. After failure a note is emitted indicating whether
any errors had extended documentation and suggesting the `--explain help`
flag.
Slightly improve the format of the diagnostic database.