rust/src/librustc/middle
bors 0e80dbe59e auto merge of #15336 : jakub-/rust/diagnostics, r=brson
This is a continuation of @brson's work from https://github.com/rust-lang/rust/pull/12144.

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. Example:

```rust
fn f(x: Option<bool>) {
	match x {
		Some(true) | Some(false) => (),
		None => (),
		Some(true) => ()
	}
}
```

```shell
[~/rust]$ ./build/x86_64-apple-darwin/stage2/bin/rustc ./diagnostics.rs --crate-type dylib
diagnostics.rs:5:3: 5:13 error: unreachable pattern [E0001] (pass `--explain E0001` to see a detailed explanation)
diagnostics.rs:5 		Some(true) => ()
                 		^~~~~~~~~~
error: aborting due to previous error
[~/rust]$ ./build/x86_64-apple-darwin/stage2/bin/rustc --explain E0001

    This error suggests that the expression arm corresponding to the noted pattern
    will never be reached as for all possible values of the expression being matched,
    one of the preceeding patterns will match.

    This means that perhaps some of the preceeding patterns are too general, this
    one is too specific or the ordering is incorrect.

```

I've refrained from migrating many errors to actually use the new macros as it can be done in an incremental fashion but if we're happy with the approach, it'd be good to do all of them sooner rather than later.

Originally, I was going to make libdiagnostics a separate crate but that's posing some interesting challenges with semi-circular dependencies. In particular, librustc would have a plugin-phase dependency on libdiagnostics, which itself depends on librustc. Per my conversation with @alexcrichton, it seems like the snapshotting process would also have to change. So for now the relevant modules from libdiagnostics are included using `#[path = ...] mod`.
2014-07-10 23:26:39 +00:00
..
borrowck std: Rename the ToStr trait to ToString, and to_str to to_string. 2014-07-08 13:01:43 -07:00
cfg std: Rename the ToStr trait to ToString, and to_str to to_string. 2014-07-08 13:01:43 -07:00
save std: Rename the ToStr trait to ToString, and to_str to to_string. 2014-07-08 13:01:43 -07:00
trans auto merge of #15563 : luqmana/rust/nif, r=pcwalton 2014-07-10 11:01:32 +00:00
typeck auto merge of #15336 : jakub-/rust/diagnostics, r=brson 2014-07-10 23:26:39 +00:00
astencode.rs Fix all the test fallout 2014-07-09 00:49:54 -07:00
check_const.rs std: Rename the ToStr trait to ToString, and to_str to to_string. 2014-07-08 13:01:43 -07:00
check_loop.rs rustc: Move the AST from @T to Gc<T> 2014-06-11 09:51:37 -07:00
check_match.rs Add scaffolding for assigning alpha-numeric codes to rustc diagnostics 2014-07-11 00:32:00 +02:00
check_static.rs std: Rename the ToStr trait to ToString, and to_str to to_string. 2014-07-08 13:01:43 -07:00
const_eval.rs Fix #15129 2014-06-24 17:22:48 -07:00
dataflow.rs std: Rename the ToStr trait to ToString, and to_str to to_string. 2014-07-08 13:01:43 -07:00
dead.rs librustc: Accept type aliases for structures in structure literals and 2014-07-04 17:07:31 -07:00
def.rs Introduce VecPerParamSpace and use it to represent sets of types and 2014-06-13 13:20:24 -04:00
dependency_format.rs Fallout from the libcollections movement 2014-06-05 13:55:11 -07:00
effect.rs std: Rename the ToStr trait to ToString, and to_str to to_string. 2014-07-08 13:01:43 -07:00
entry.rs Rename Iterator::len to count 2014-06-06 19:51:31 -07:00
expr_use_visitor.rs librustc: Fix expr_use_visitor (and, transitively, the borrow check) 2014-07-01 14:32:57 -07:00
freevars.rs Move Def out of syntax crate, where it does not belong 2014-06-06 19:51:23 -04:00
graph.rs librustc: Remove uses of advance. 2014-07-09 15:51:58 -07:00
intrinsicck.rs librustc: Forbid transmute from being called on types whose size is 2014-06-13 13:53:55 -07:00
kind.rs std: Rename the ToStr trait to ToString, and to_str to to_string. 2014-07-08 13:01:43 -07:00
lang_items.rs librustc (RFC #34): Implement the new Index and IndexMut traits. 2014-07-07 11:43:23 -07:00
liveness.rs std: Rename the ToStr trait to ToString, and to_str to to_string. 2014-07-08 13:01:43 -07:00
mem_categorization.rs std: Rename the ToStr trait to ToString, and to_str to to_string. 2014-07-08 13:01:43 -07:00
pat_util.rs Simplify PatIdent to contain an Ident rather than a Path 2014-07-03 12:54:51 -07:00
privacy.rs std: Rename the ToStr trait to ToString, and to_str to to_string. 2014-07-08 13:01:43 -07:00
reachable.rs std: Rename the ToStr trait to ToString, and to_str to to_string. 2014-07-08 13:01:43 -07:00
region.rs std: Rename the ToStr trait to ToString, and to_str to to_string. 2014-07-08 13:01:43 -07:00
resolve_lifetime.rs std: Rename the ToStr trait to ToString, and to_str to to_string. 2014-07-08 13:01:43 -07:00
resolve.rs librustc: Remove uses of advance. 2014-07-09 15:51:58 -07:00
stability.rs rustdoc: incorporate stability index throughout 2014-06-30 22:36:24 -07:00
subst.rs Revise VecPerParamSpace to use a one Vec rather than three. 2014-07-05 06:29:27 +02:00
ty_fold.rs RegionFolder should only invoke callback on free regions. 2014-06-22 06:19:56 +02:00
ty.rs librustc: Remove uses of advance. 2014-07-09 15:51:58 -07:00
weak_lang_items.rs Fallout from the libcollections movement 2014-06-05 13:55:11 -07:00