rust/src/test
bors 0ccee30773 Auto merge of #58281 - mark-i-m:synthesis, r=estebank
Add outlives suggestions for some lifetime errors

This PR implements suggestion diagnostics for some lifetime mismatch errors. When the borrow checker finds that some lifetime 'a doesn't outlive some other lifetime 'b that it should outlive, then in addition to the current lifetime error, we also emit a suggestion for how to fix the problem by adding a bound:

- If a and b are normal named regions, suggest to add the bound `'a: 'b`
- If b is static, suggest to replace a with static
- If b also needs to outlive a, they must be the same, so suggest unifying  them

We start with a simpler implementation that avoids diagnostic regression or implementation complexity:
- We only makes suggestions for lifetimes the user can already name (eg not closure regions or elided regions)
- For now, we only emit a help note, not an actually suggestion because it is significantly easier.

Finally, there is one hack: it seems that implicit regions in async fn are given the name '_ incorrectly. To avoid suggesting '_: 'x, we simply filter out such lifetimes by name.

For more info, see this internals thread:

https://internals.rust-lang.org/t/mechanical-suggestions-for-some-borrow-checker-errors/9049/3

TL;DR Make suggestions to add a `where 'a: 'b` constraint for some lifetime errors. Details are in the paper linked from the internals thread above.

r? @estebank

TODO
- [x] Clean up code
- [x] Only make idiomatic suggestions
     - [x] don't suggest naming `&'a self`
     - [x] rather than `'a: 'static`, suggest replacing `'a` with `'static`
     - [x] rather than `'a: 'b, 'b: 'a`, suggest replacing `'a` with `'b` or vice versa
- [x] Performance (maybe need a perf run when this is closer to the finish line?)
     - perf run was clean...
     - EDIT: perf run seems to only check non-error performance... How do we check that error performance didn't regress?
- [x] Needs ui tests
- [x] Integrate the `help` message into the main lifetime `error`
2019-11-18 22:08:31 +00:00
..
assembly
auxiliary
codegen Do not require extra LLVM backends for x.py test to pass 2019-11-04 16:54:34 +03:00
codegen-units Update test output. 2019-10-25 14:52:39 +02:00
compile-fail A Downcast is now reached when const-checking a for loop 2019-11-15 10:33:52 -08:00
debuginfo fix debuginfo/issue22656 with LLDB 8 2019-09-18 10:42:55 -04:00
incremental Rollup merge of #66216 - wesleywiser:const_prop_codegen_improvements, r=oli-obk 2019-11-10 09:27:17 +09:00
mir-opt Auto merge of #66233 - cjgillot:constkind, r=oli-obk 2019-11-14 04:54:51 +00:00
pretty Fix a previously forgotten pretty-printing test after a change to the pretty-printing mechanism. 2019-10-28 18:43:59 +01:00
run-fail [const-prop] Handle MIR Rvalue::Aggregates 2019-10-18 06:29:57 -04:00
run-make Upgrade Emscripten targets to use upstream LLVM backend 2019-10-16 17:06:48 -07:00
run-make-fulldeps Auto merge of #54733 - GuillaumeGomez:stabilize-rustdoc-theme, r=ollie27,Dylan-DPC 2019-11-18 19:03:21 +00:00
run-pass-valgrind
rustdoc Auto merge of #66238 - ehuss:stabilize-rustdoc-edition, r=GuillaumeGomez 2019-11-18 03:06:42 +00:00
rustdoc-js
rustdoc-js-std
rustdoc-ui Rollup merge of #66166 - GuillaumeGomez:rename-rustdoc-to-doc, r=QuietMisdreavus 2019-11-13 22:09:13 +09:00
rustfix
ui Auto merge of #58281 - mark-i-m:synthesis, r=estebank 2019-11-18 22:08:31 +00:00
ui-fulldeps rustc_plugin: Remove Registry::register_attribute 2019-11-16 18:50:23 +03:00
COMPILER_TESTS.md