rust/src
Manish Goregaokar 40199f68d9
Rollup merge of #32756 - nikomatsakis:borrowck-snippet, r=nrc
Overhaul borrowck error messages and compiler error formatting generally

This is a major overhaul of how the compiler reports errors. The primary goal is to be able to give many spans within the same overall context, such as this:

```
./borrow-errors.rs:73:17: 73:20: error: cannot borrow `*vec` as immutable because previous closure requires unique access [E0501]
70     let append = |e| {
                    ~~~ closure construction occurs here
71         vec.push(e)
           ~~~ previous borrow occurs due to use of `vec` in closure
72     };
73     let data = &vec[3];
                   ~~~ borrow occurs here
74 }
   ~ borrow from closure ends here
```

However, in the process we made a number of other changes:

- Removed the repetitive filenames from snippets and just give the line number.
- Color the line numbers blue so they "fade away"
- Remove the file name and line number from the error code suggestions since they don't seem to fit anymore. (This should probably happen in more places, like existing notes.)
- Newlines in between errors to help group them better.

This PR is not quite ready to land, but we thought it made sense to stop here and get some feedback from people at large. It'd be great if people can check out the branch and play with it. We'd be especially interested in hearing about cases that don't look good with the new formatting (I suspect they exist).

Here is a checklist of some pending work items for this PR. Some of them may be best left for follow-up PRs:

- [x] Accommodate multiple files in a `MultiSpan` (this should be easy)
  - In this case, we want to print filenames though.
- [x] Remove duplicate E0500 code.
- [x] Make the header message bold, rather than current hack that makes all errors/warnings bold
- [x] Update warning text color (yellow is hard to read w/ a white background)

Moved numerous follow-ups to: https://github.com/rust-lang/rust/issues/33240

Joint work with @jonathandturner.

Fixes https://github.com/rust-lang/rust/issues/3533
2016-05-03 08:05:26 +05:30
..
bootstrap test: Move run-make tests into compiletest 2016-04-28 21:46:40 -07:00
build_helper whoops 2016-04-04 21:14:15 +10:00
compiler-rt@57315f7e07
doc Rollup merge of #33253 - ergenekonyigit:master, r=alexcrichton 2016-04-29 19:17:58 +05:30
driver
etc test: Move run-make tests into compiletest 2016-04-28 21:46:40 -07:00
grammar
jemalloc@aab1c0a0e0
liballoc
liballoc_jemalloc Fix alloc_jemalloc on windows gnu targets 2016-05-01 13:16:06 +01:00
liballoc_system
libarena
libbacktrace
libcollections Auto merge of #33276 - bwinterton:btreeset-insert-doc-fix, r=GuillaumeGomez 2016-04-30 08:59:46 -07:00
libcollectionstest
libcore Auto merge of #33289 - birkenfeld:chain-find, r=bluss 2016-05-02 04:46:58 -07:00
libcoretest Implement find() on Chain iterators 2016-04-30 11:16:35 +02:00
libflate
libfmt_macros
libgetopts
libgraphviz
liblibc@7265c17d18
liblog bootstrap: Add a bunch of Cargo.toml files 2016-02-11 11:12:32 -08:00
librand
librbml std: Stabilize APIs for the 1.9 release 2016-04-11 08:57:53 -07:00
librustc move "lint level defined here" into secondary note 2016-05-02 11:49:25 -04:00
librustc_back Auto merge of #33115 - mbrubeck:vfp3-d16, r=nrc 2016-04-25 10:43:36 -07:00
librustc_bitflags
librustc_borrowck replace fileline_{help,note} with {help,note} 2016-05-02 11:49:23 -04:00
librustc_const_eval replace fileline_{help,note} with {help,note} 2016-05-02 11:49:23 -04:00
librustc_const_math don't report bitshift overflow twice 2016-04-26 14:10:07 +02:00
librustc_data_structures Make the codegen unit partitioner also emit item declarations. 2016-04-28 16:53:00 -04:00
librustc_driver patch travis failure 2016-05-02 11:49:26 -04:00
librustc_incremental
librustc_lint replace fileline_{help,note} with {help,note} 2016-05-02 11:49:23 -04:00
librustc_llvm Make the codegen unit partitioner also emit item declarations. 2016-04-28 16:53:00 -04:00
librustc_metadata replace fileline_{help,note} with {help,note} 2016-05-02 11:49:23 -04:00
librustc_mir Handle coercion casts properly when building the MIR 2016-05-01 17:56:07 +12:00
librustc_passes replace fileline_{help,note} with {help,note} 2016-05-02 11:49:23 -04:00
librustc_platform_intrinsics
librustc_plugin
librustc_privacy
librustc_resolve fix rebase flaws 2016-05-02 11:49:26 -04:00
librustc_save_analysis Avoid using the lowering context in librustc_save_analysis 2016-05-01 23:30:18 +00:00
librustc_trans Finish up with 'old school' error mode 2016-05-02 11:49:25 -04:00
librustc_typeck replace fileline_{help,note} with {help,note} 2016-05-02 11:49:23 -04:00
librustc_unicode
librustdoc Auto merge of #33151 - ollie27:rustdoc_abi, r=alexcrichton 2016-04-27 23:16:41 -07:00
libserialize std: Stabilize APIs for the 1.9 release 2016-04-11 08:57:53 -07:00
libstd Auto merge of #33148 - sfackler:entry-key, r=alexcrichton 2016-04-29 18:11:25 -07:00
libsyntax assert we get at least two rendered lines back 2016-05-02 13:05:14 -04:00
libsyntax_ext fix rebase flaws 2016-05-02 11:49:26 -04:00
libterm
libtest
llvm@751345228a Update llvm to 751345228a0ef03fd147394bb5104359b7a808be 2016-04-26 17:03:14 -07:00
rt
rtstartup
rust-installer@c37d3747da
rustc rustc: update Cargo.lock 2016-04-24 19:38:49 -04:00
rustllvm Update llvm to 751345228a0ef03fd147394bb5104359b7a808be 2016-04-26 17:03:14 -07:00
test Rollup merge of #32756 - nikomatsakis:borrowck-snippet, r=nrc 2016-05-03 08:05:26 +05:30
tools adapt JSON to new model 2016-05-02 11:47:10 -04:00
stage0.txt mk: Bootstrap from stable instead of snapshots 2016-04-19 10:56:49 -07:00