rust/src/test
Zack M. Davis 032d97fa01 in which inferable outlives-requirements are linted
RFC 2093 (tracking issue #44493) lets us leave off
commonsensically inferable `T: 'a` outlives requirements. (A separate
feature-gate was split off for the case of 'static lifetimes, for
which questions still remain.) Detecting these was requested as an
idioms-2018 lint.

It turns out that issuing a correct, autofixable suggestion here is
somewhat subtle in the presence of other bounds and generic
parameters. Basically, we want to handle these three cases:

 • One outlives-bound. We want to drop the bound altogether, including
   the colon—

   MyStruct<'a, T: 'a>
                 ^^^^ help: remove this bound

 • An outlives bound first, followed by a trait bound. We want to
   delete the outlives bound and the following plus sign (and
   hopefully get the whitespace right, too)—

   MyStruct<'a, T: 'a + MyTrait>
                   ^^^^^ help: remove this bound

 • An outlives bound after a trait bound. We want to delete the
   outlives lifetime and the preceding plus sign—

   MyStruct<'a, T: MyTrait + 'a>
                          ^^^^^ help: remove this bound

This gets (slightly) even more complicated in the case of where
clauses, where we want to drop the where clause altogether if there's
just the one bound. Hopefully the comments are enough to explain
what's going on!

A script (in Python, sorry) was used to generate the
hopefully-sufficiently-exhaustive UI test input. Some of these are
split off into a different file because rust-lang-nursery/rustfix#141
(and, causally upstream of that, #53934) prevents them from being
`run-rustfix`-tested.

We also make sure to include a UI test of a case (copied from RFC
2093) where the outlives-bound can't be inferred. Special thanks to
Niko Matsakis for pointing out the `inferred_outlives_of` query,
rather than blindly stripping outlives requirements as if we weren't a
production compiler and didn't care.

This concerns #52042.
2018-09-27 20:24:14 -07:00
..
auxiliary
codegen add codegen test 2018-09-22 21:01:21 +02:00
codegen-units Really make CGU names unique across crates. 2018-09-12 12:46:48 +02:00
compile-fail stabilize #[panic_handler] 2018-09-07 13:27:30 +02:00
compile-fail-fulldeps resolve: Do not block derive helper resolutions on single import resolutions 2018-09-25 22:20:21 +03:00
debuginfo make the nil-enum test work again 2018-09-22 21:01:21 +02:00
incremental incr.comp.: Allow for more fine-grained testing of CGU reuse and use it to test incremental ThinLTO. 2018-09-18 16:33:24 +02:00
incremental-fulldeps Ignore new test on Windows 2018-09-21 10:05:23 -07:00
mir-opt Auto merge of #53438 - matthewjasper:permissive-match-access, r=pnkfelix 2018-09-25 01:04:12 +00:00
parse-fail Fix existing test 2018-09-05 07:03:02 -07:00
pretty update result of issue 12590 test 2018-09-10 15:44:42 +02:00
run-fail Restrict most uses of const_fn to min_const_fn 2018-08-31 08:40:00 +02:00
run-fail-fulldeps mv (mod) codemap source_map 2018-08-19 23:01:00 +02:00
run-make rustc: Continue to tweak "std internal symbols" 2018-08-26 16:34:14 -07:00
run-make-fulldeps don't run the test on macOS 2018-09-26 16:22:52 +02:00
run-pass Allow unused_variables lint to placate test failure exposed by macos builders. 2018-09-27 21:00:44 +02:00
run-pass-fulldeps Auto merge of #53824 - ljedrz:begone_onevector, r=michaelwoerister 2018-09-26 10:04:42 +00:00
run-pass-valgrind Implement simple codegen for unsized rvalues. 2018-08-19 08:07:33 +09:00
rustdoc Auto merge of #54199 - nikomatsakis:predicate_may_hold-failure, r=eddyb 2018-09-26 12:39:20 +00:00
rustdoc-js Remove outdated rustdoc PinBox tests 2018-09-18 01:42:27 -07:00
rustdoc-ui add -Zui-testing to rustdoc 2018-09-19 18:39:39 -05:00
rustfix
ui in which inferable outlives-requirements are linted 2018-09-27 20:24:14 -07:00
ui-fulldeps resolve: Do not block derive helper resolutions on single import resolutions 2018-09-25 22:20:21 +03:00
COMPILER_TESTS.md Link compiler test documentation to rustc-guide 2018-08-10 08:05:48 -06:00