Tweak and add test for detecting libraries with mismatching target triples.

Closes #10814.
Add error message specific to \<carriage return>.

This can crop-up with a misconfigured editor or an unexpected
interaction between version control and certain operating systems.

Closes #11669.
Add more "help: ..."'s to the parser.

Adds a method for printing a fatal error and also a help message to the
parser and uses this in a variety of places to improve error messages.

Closes #12213.
Use the correct span for out-of-range int literals.

This corrects the error message to point at the literal, not the next
token.

Closes #17123.
auto merge of #18840 : huonw/rust/tweaks, r=alexcrichton

Fix some old papercuts with diagnostics, e.g. tweaking spans, rewording messages. See individual commits.
Improve examples for syntax::ext::deriving::encodable

The examples in the documentation for syntax::ext::deriving::encodable
are outdated, and do not work. To fix this, the following changes are
applied:

- emit_field() -> emit_struct_field()
- read_field() -> read_struct_field()
- Use Result to report errors
- Add the mut keyword to Encoder/Decoder
- Prefer Encodable::encode() to emit_uint