rust/src/test/run-make
bors 44b3cd8c46 Auto 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-02 19:21:56 -07:00
..
a-b-a-linker-guard document test, don't use grep 2016-03-25 14:07:20 -04:00
alloc-extern-crates std: Stabilize APIs for the 1.6 release 2015-12-05 15:09:44 -08:00
allow-non-lint-warnings-cmdline Remove empty test files 2015-09-17 12:04:34 -04:00
allow-warnings-cmdline-stability Remove all uses of #[staged_api] 2015-11-25 21:55:26 +03:00
archive-duplicate-names rmake: Get all tests passing on MSVC 2015-09-17 08:40:33 -07:00
bare-outfile Fix run-make/bare-outfile test 2015-10-03 17:20:45 -04:00
c-dynamic-dylib rmake: Get all tests passing on MSVC 2015-09-17 08:40:33 -07:00
c-dynamic-rlib rmake: Get all tests passing on MSVC 2015-09-17 08:40:33 -07:00
c-link-to-rust-dylib Fix test fallout 2016-01-16 12:35:00 -05:00
c-link-to-rust-staticlib Fix test fallout 2016-01-16 12:35:00 -05:00
c-static-dylib rmake: Get all tests passing on MSVC 2015-09-17 08:40:33 -07:00
c-static-rlib rmake: Get all tests passing on MSVC 2015-09-17 08:40:33 -07:00
codegen-options-parsing use a compatible syntax for grep GNU/BSD 2016-02-13 20:03:08 +01:00
compile-stdin Add a test that rustc can compile standard input 2015-10-01 23:28:01 -04:00
compiler-lookup-paths Deduplicate libraries on hash instead of filename. 2016-04-14 13:29:47 -07:00
compiler-lookup-paths-2 rustc: Fix a leak in dependency= paths 2015-01-16 08:48:16 -08:00
compiler-rt-works-on-mingw Build compiler-rt/builtins with MSVC 2015-11-04 11:43:41 +08:00
crate-data-smoke rustc: Remove deprecated flags 2015-01-20 11:16:26 -08:00
crate-name-priority rmake: Get all tests passing on MSVC 2015-09-17 08:40:33 -07:00
debug-assertions Add opt-level=s and opt-level=z tests to the existing tests that confirm proper 2016-04-28 23:08:30 -07:00
dep-info rustc: Emit phony targets for inputs in dep-info 2015-10-02 09:33:06 -07:00
dep-info-spaces rustc: Remove deprecated flags 2015-01-20 11:16:26 -08:00
duplicate-output-flavors Deduplicate --crate-type arguments 2015-02-09 19:51:21 +02:00
dylib-chain rustc: Default to static linking dylibs 2014-11-03 15:08:20 -08:00
emit Add opt-level=s and opt-level=z tests to the existing tests that confirm proper 2016-04-28 23:08:30 -07:00
error-found-staticlib-instead-crate Improve error message, when found staticlib instead crate 2015-02-06 04:41:49 +03:00
error-writing-dependencies rustc: Remove deprecated flags 2015-01-20 11:16:26 -08:00
execution-engine rebasing 2016-04-20 10:16:10 +12:00
extern-diff-internal-name rustc: Turn off multiple versions of crate warning 2015-01-06 08:22:59 -08:00
extern-flag-disambiguates Use assert_eq! instead of assert! in tests 2015-06-13 14:55:55 +03:00
extern-flag-fun Deduplicate libraries on hash instead of filename. 2016-04-14 13:29:47 -07:00
extern-fn-generic rmake: Get all tests passing on MSVC 2015-09-17 08:40:33 -07:00
extern-fn-mangle rmake: Get all tests passing on MSVC 2015-09-17 08:40:33 -07:00
extern-fn-reachable std: Clean out deprecated APIs 2016-03-12 12:31:13 -08:00
extern-fn-struct-passing-abi trans: Use an isize to count the number of registers so we don't underflow for fn's with > 7 args in debug builds. 2015-10-16 21:10:52 -04:00
extern-fn-with-packed-struct rmake: Get all tests passing on MSVC 2015-09-17 08:40:33 -07:00
extern-fn-with-union Get tests working on MSVC 32-bit 2016-01-29 16:25:21 -08:00
extern-multiple-copies rustc: Fix extern crate being order dependent 2015-11-20 10:58:38 -08:00
extern-overrides-distribution Make the compiler emit an error if the crate graph contains two crates with the same crate-name and crate-salt but different SVHs. 2016-03-25 14:07:18 -04:00
extra-filename-with-temp-outputs msvc: Get codegen-units working 2015-07-07 20:07:20 -07:00
graphviz-flowgraph Patch graphviz tests to account for the fact that nested items are not 2015-11-18 19:23:29 -05:00
include_bytes_deps Added a test for include_bytes! dep info 2015-04-15 10:40:04 -04:00
interdependent-c-libraries rmake: Get all tests passing on MSVC 2015-09-17 08:40:33 -07:00
intrinsic-unreachable Fallout in tests and docs from feature renamings 2015-06-17 09:07:16 -07:00
invalid-library rustc: Better error when loading invalid libraries 2014-03-01 23:36:28 -08:00
invalid-staticlib Don't ICE if an archive isn't actually an archive 2015-09-26 01:54:12 -04:00
issue-7349 Mass rename uint/int to usize/isize 2015-03-26 12:10:22 -07:00
issue-11908 Deduplicate libraries on hash instead of filename. 2016-04-14 13:29:47 -07:00
issue-14500 Preserve public static items across LTO 2015-11-06 05:04:43 -05:00
issue-14698 Emit an error upon failing to create a temp dir instead of panicking 2015-09-16 13:52:02 -04:00
issue-15460 rmake: Get all tests passing on MSVC 2015-09-17 08:40:33 -07:00
issue-18943 Add regression test for #18943 2015-05-02 15:22:27 +02:00
issue-19371 Allow custom filenames for anonymous inputs 2016-03-14 20:03:43 +01:00
issue-20626 Add regression test for #20626 2015-05-07 00:25:54 +02:00
issue-22131 test: Move run-make tests into compiletest 2016-04-28 21:46:40 -07:00
issue-24445 std: Fix thread_local! in non-PIE binaries 2015-04-15 09:14:48 -07:00
issue-25581 tests: Update run-make/issue-25581 to reflect how fat pointers are passed. 2016-03-18 15:54:27 +02:00
issue-26006 Make the compiler emit an error if the crate graph contains two crates with the same crate-name and crate-salt but different SVHs. 2016-03-25 14:07:18 -04:00
issue-26092 rmake: Get all tests passing on MSVC 2015-09-17 08:40:33 -07:00
issue-28595 rustc: Swap link order of native libs/rust deps 2015-09-30 20:17:54 -07:00
issue-28766 Translate zero-sized return types as void 2016-01-15 18:29:29 +01:00
issue-30063 regression test for issue #30063 2015-12-08 05:39:00 +01:00
libs-and-bins Strip all leading/trailing newlines 2015-03-15 09:08:21 -07:00
libs-through-symlinks fix tests & rustdoc 2015-11-26 18:22:40 +02:00
link-path-order rmake: Get all tests passing on MSVC 2015-09-17 08:40:33 -07:00
linkage-attr-on-static rmake: Get all tests passing on MSVC 2015-09-17 08:40:33 -07:00
linker-output-non-utf8 Add a regression test for #29122 (fixed in #29134) 2015-10-23 17:11:33 -04:00
llvm-pass Add LLVM FunctionPass regression test using run-make. 2016-02-15 10:08:04 -05:00
ls-metadata Move --ls behind -Z ls 2014-04-16 17:45:06 +02:00
lto-no-link-whole-rlib trans: Don't link whole rlibs to executables 2016-02-14 11:45:59 -08:00
lto-readonly-lib rustc: Fix permission denied error in 'ar' when lto is enabled 2014-09-29 15:07:14 +02:00
lto-smoke Move -Z lto to -C lto. 2014-09-21 02:17:31 -04:00
lto-smoke-c Fix test fallout 2016-01-16 12:35:00 -05:00
manual-crate-name rustc: Repurpose the --crate-name CLI flag 2014-07-05 12:46:42 -07:00
manual-link Strip all leading/trailing newlines 2015-03-15 09:08:21 -07:00
many-crates-but-no-match Strip trailing whitespace 2015-03-15 11:25:43 -07:00
metadata-flag-frobs-symbols Mass rename uint/int to usize/isize 2015-03-26 12:10:22 -07:00
mismatching-target-triples syntax: Implement #![no_core] 2015-08-03 17:23:01 -07:00
missing-crate-dependency Strip trailing whitespace 2015-03-15 11:25:43 -07:00
mixing-deps Mass rename uint/int to usize/isize 2015-03-26 12:10:22 -07:00
mixing-formats Strip all leading/trailing newlines 2015-03-15 09:08:21 -07:00
mixing-libs Refactoring: Introduce distinct host and target rpath var setters. 2014-05-18 22:56:26 +02:00
no-duplicate-libs std: Stabilize APIs for the 1.6 release 2015-12-05 15:09:44 -08:00
no-intermediate-extras Remove workaround of #13793/#10872 2014-08-18 13:45:08 +09:00
obey-crate-type-flag Strip all leading/trailing newlines 2015-03-15 09:08:21 -07:00
output-type-permutations Fix test fallout 2016-01-16 12:35:00 -05:00
output-with-hyphens rustc: Remove support for hyphens in crate names 2015-03-27 10:19:59 -07:00
prefer-dylib rustc: Default to static linking dylibs 2014-11-03 15:08:20 -08:00
prefer-rlib extern mod => extern crate 2014-02-14 22:55:21 -08:00
pretty-expanded Mass rename uint/int to usize/isize 2015-03-26 12:10:22 -07:00
pretty-expanded-hygiene syntax: Implement #![no_core] 2015-08-03 17:23:01 -07:00
pretty-print-path-suffix rustc: retire hir::map's paths. 2016-04-06 13:51:55 +03:00
pretty-print-to-file rustc: Remove deprecated flags 2015-01-20 11:16:26 -08:00
print-cfg Test target feature computation 2016-04-09 00:41:23 +02:00
print-target-list rustc: add a --print target-list command 2016-02-12 10:39:19 -05:00
prune-link-args test: Fix run-make on windows 2014-04-28 11:45:30 +09:00
relocation-model Add a "link-guard" to avoid accidentally linking to a wrong dylib at runtime. 2016-03-25 14:07:19 -04:00
reproducible-build check only that symbol names are deterministic 2016-03-25 14:07:20 -04:00
rlib-chain Use new attribute syntax in python files in src/etc too (#13478) 2014-04-14 21:00:31 +05:30
save-analysis save-analysis: expand smoke test to cover json and csv formats 2016-04-26 10:16:44 +12:00
sepcomp-cci-copies Rollup merge of #23803 - richo:unused-braces, r=Manishearth 2015-03-28 18:12:06 +05:30
sepcomp-inlining rustc: Start "stabilizing" some flags 2014-12-19 11:38:24 -08:00
sepcomp-separate Mass rename uint/int to usize/isize 2015-03-26 12:10:22 -07:00
simd-ffi Simply two cfg attributes 2015-12-23 22:31:53 -05:00
simple-dylib rustc: Default to static linking dylibs 2014-11-03 15:08:20 -08:00
simple-rlib extern mod => extern crate 2014-02-14 22:55:21 -08:00
stable-symbol-names Add run-make test for stable symbol-name generation. 2016-04-03 00:44:17 -04:00
static-dylib-by-default Fix test fallout 2016-01-16 12:35:00 -05:00
static-unwinding Use assert_eq! instead of assert! in tests 2015-06-13 14:55:55 +03:00
staticlib-blank-lib rustc: Add knowledge of separate lookup paths 2014-12-23 10:08:17 -08:00
suspicious-library rustc: Default to static linking dylibs 2014-11-03 15:08:20 -08:00
symbols-are-reasonable Use consistent terminology for byte string literals 2015-09-03 10:54:53 +03:00
symbols-include-type-name Include type name in symbol for methods 2015-12-12 00:01:08 +09:00
symlinked-extern Properly canonicalize crate paths specified via --extern 2014-08-15 14:40:09 +02:00
symlinked-libraries rustc: Default to static linking dylibs 2014-11-03 15:08:20 -08:00
symlinked-rlib Added a test 2016-04-08 17:14:05 -07:00
target-cpu-native Add support for target-cpu=native 2015-03-10 01:56:51 +01:00
target-specs Make data-layout mandatory in target specs. 2016-04-19 16:08:45 +03:00
test-harness Add a test for --quiet in test harness. 2016-03-15 17:59:01 +01:00
trace-macros-flag Remove & from redirected output 2015-04-16 14:57:31 +02:00
unicode-input Fix unicode test to use original error format 2016-05-02 11:49:26 -04:00
use-extern-for-plugins Add Illumos support 2016-01-31 18:57:26 +03:00
version rustc: Start "stabilizing" some flags 2014-12-19 11:38:24 -08:00
volatile-intrinsics Add tests for read_volatile and write_volatile 2016-02-19 23:45:49 +00:00
weird-output-filenames Fix fallout of removing quotes in crate names 2015-03-27 11:43:40 -07:00
tools.mk test: Move run-make tests into compiletest 2016-04-28 21:46:40 -07:00