rust/src/test/ui/rust-2018
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 rustc: Suggest removing extern crate in 2018 2018-08-27 10:52:21 -07:00
uniform-paths rustc_resolve: use continue instead of return to "exit" a loop iteration. 2018-09-15 22:48:10 +03:00
uniform-paths-forward-compat rustc_resolve: use continue instead of return to "exit" a loop iteration. 2018-09-15 22:48:10 +03:00
async-ident-allowed.rs Fix typos found by codespell. 2018-08-19 17:41:28 +02:00
async-ident-allowed.stderr Generalize async_idents to all new keywords 2018-08-29 09:34:53 -07:00
async-ident.fixed we now successfully warn about async in macro invocations 2018-09-11 08:56:59 -04:00
async-ident.rs we now successfully warn about async in macro invocations 2018-09-11 08:56:59 -04:00
async-ident.stderr we now successfully warn about async in macro invocations 2018-09-11 08:56:59 -04:00
dyn-keyword.fixed Treat dyn as a keyword in the 2018 edition 2018-09-16 23:34:42 +01:00
dyn-keyword.rs Treat dyn as a keyword in the 2018 edition 2018-09-16 23:34:42 +01:00
dyn-keyword.stderr Treat dyn as a keyword in the 2018 edition 2018-09-16 23:34:42 +01:00
dyn-trait-compatibility.rs Treat dyn as a keyword in the 2018 edition 2018-09-16 23:34:42 +01:00
dyn-trait-compatibility.stderr Treat dyn as a keyword in the 2018 edition 2018-09-16 23:34:42 +01:00
edition-lint-fully-qualified-paths.fixed Remove crate_visibility_modifier from 2018 edition 2018-09-09 02:28:13 +02:00
edition-lint-fully-qualified-paths.rs Remove crate_visibility_modifier from 2018 edition 2018-09-09 02:28:13 +02:00
edition-lint-fully-qualified-paths.stderr Fix naming conventions for new lints 2018-05-25 02:35:07 +03:00
edition-lint-infer-outlives-multispan.rs in which inferable outlives-requirements are linted 2018-09-27 20:24:14 -07:00
edition-lint-infer-outlives-multispan.stderr in which inferable outlives-requirements are linted 2018-09-27 20:24:14 -07:00
edition-lint-infer-outlives.fixed in which inferable outlives-requirements are linted 2018-09-27 20:24:14 -07:00
edition-lint-infer-outlives.rs in which inferable outlives-requirements are linted 2018-09-27 20:24:14 -07:00
edition-lint-infer-outlives.stderr in which inferable outlives-requirements are linted 2018-09-27 20:24:14 -07:00
edition-lint-nested-empty-paths.fixed Remove crate_visibility_modifier from 2018 edition 2018-09-09 02:28:13 +02:00
edition-lint-nested-empty-paths.rs Remove crate_visibility_modifier from 2018 edition 2018-09-09 02:28:13 +02:00
edition-lint-nested-empty-paths.stderr Fix naming conventions for new lints 2018-05-25 02:35:07 +03:00
edition-lint-nested-paths.fixed Remove crate_visibility_modifier from 2018 edition 2018-09-09 02:28:13 +02:00
edition-lint-nested-paths.rs Remove crate_visibility_modifier from 2018 edition 2018-09-09 02:28:13 +02:00
edition-lint-nested-paths.stderr Fix naming conventions for new lints 2018-05-25 02:35:07 +03:00
edition-lint-paths.fixed rustc_resolve: don't allow paths starting with ::crate. 2018-08-17 12:59:56 +03:00
edition-lint-paths.rs rustc_resolve: don't allow paths starting with ::crate. 2018-08-17 12:59:56 +03:00
edition-lint-paths.stderr Fix naming conventions for new lints 2018-05-25 02:35:07 +03:00
edition-lint-uninferable-outlives.rs in which inferable outlives-requirements are linted 2018-09-27 20:24:14 -07:00
extern-crate-idiomatic-in-2018.fixed rustc_resolve: don't allow ::crate_name to bypass extern_prelude. 2018-09-15 22:48:10 +03:00
extern-crate-idiomatic-in-2018.rs rustc_resolve: don't allow ::crate_name to bypass extern_prelude. 2018-09-15 22:48:10 +03:00
extern-crate-idiomatic-in-2018.stderr rustc_resolve: don't allow ::crate_name to bypass extern_prelude. 2018-09-15 22:48:10 +03:00
extern-crate-idiomatic.fixed rustc_resolve: don't allow ::crate_name to bypass extern_prelude. 2018-09-15 22:48:10 +03:00
extern-crate-idiomatic.rs rustc_resolve: don't allow ::crate_name to bypass extern_prelude. 2018-09-15 22:48:10 +03:00
extern-crate-referenced-by-self-path.fixed Fix naming conventions for new lints 2018-05-25 02:35:07 +03:00
extern-crate-referenced-by-self-path.rs Fix naming conventions for new lints 2018-05-25 02:35:07 +03:00
extern-crate-rename.fixed Fix naming conventions for new lints 2018-05-25 02:35:07 +03:00
extern-crate-rename.rs Fix naming conventions for new lints 2018-05-25 02:35:07 +03:00
extern-crate-rename.stderr Fix naming conventions for new lints 2018-05-25 02:35:07 +03:00
extern-crate-submod.fixed Fix naming conventions for new lints 2018-05-25 02:35:07 +03:00
extern-crate-submod.rs Fix naming conventions for new lints 2018-05-25 02:35:07 +03:00
extern-crate-submod.stderr Fix naming conventions for new lints 2018-05-25 02:35:07 +03:00
issue-51008-1.rs also reset anon-param-mode for fn() types 2018-05-30 14:54:51 -04:00
issue-51008.rs reset the "anonymous lifetime mode" for parenthesized where clauses 2018-05-30 14:54:51 -04:00
issue-52202-use-suggestions.rs tests: prefer edition: directives to compile-flags:--edition. 2018-08-16 10:36:11 +03:00
issue-52202-use-suggestions.stderr in which use suggestions meet edition 2018 2018-07-09 23:21:29 -07:00
issue-54006.rs rustc_resolve: don't allow ::crate_name to bypass extern_prelude. 2018-09-15 22:48:10 +03:00
issue-54006.stderr rustc_resolve: don't allow ::crate_name to bypass extern_prelude. 2018-09-15 22:48:10 +03:00
macro-use-warned-against.rs Stabilize use_extern_macros 2018-08-17 13:14:26 +03:00
macro-use-warned-against.stderr Stabilize use_extern_macros 2018-08-17 13:14:26 +03:00
remove-extern-crate.fixed rustc_resolve: always include core, std and meta in the extern prelude. 2018-09-15 22:48:10 +03:00
remove-extern-crate.rs rustc_resolve: always include core, std and meta in the extern prelude. 2018-09-15 22:48:10 +03:00
remove-extern-crate.stderr rustc_resolve: don't allow ::crate_name to bypass extern_prelude. 2018-09-15 22:48:10 +03:00
try-ident.fixed Generalize async_idents to all new keywords 2018-08-29 09:34:53 -07:00
try-ident.rs Generalize async_idents to all new keywords 2018-08-29 09:34:53 -07:00
try-ident.stderr Generalize async_idents to all new keywords 2018-08-29 09:34:53 -07:00
try-macro.fixed add test case 2018-09-10 17:21:01 -04:00
try-macro.rs add test case 2018-09-10 17:21:01 -04:00
try-macro.stderr add test case 2018-09-10 17:21:01 -04:00