rust/src/test/ui/impl-trait
Esteban Küber d3c96f03b5 Suggest -> impl Trait and -> Box<dyn Trait> on fn that doesn't return
During development, a function could have a return type set that is a
bare trait object by accident. We already suggest using either a boxed
trait object or `impl Trait` if the return paths will allow it. We now
do so too when there are *no* return paths or they all resolve to `!`.
We still don't handle cases where the trait object is *not* the entirety
of the return type gracefully.
2020-04-20 09:24:41 -07:00
..
auxiliary tests: Move run-pass tests without naming conflicts to ui 2019-07-27 18:56:16 +03:00
issues keep predicate order and tweak output 2020-02-28 11:37:59 -08:00
multiple-lifetimes bless output of ui test impl-trait/multiple-lifetimes/error-handling.rs 2020-03-30 01:28:27 +02:00
associated-impl-trait-type-generic-trait.rs Replace "existential" by "opaque" 2019-08-02 02:44:36 +01:00
associated-impl-trait-type-trivial.rs Replace "existential" by "opaque" 2019-08-02 02:44:36 +01:00
associated-impl-trait-type.rs Replace "existential" by "opaque" 2019-08-02 02:44:36 +01:00
auto-trait-leak-rpass.rs tests: Move run-pass tests with naming conflicts to ui 2019-07-27 18:56:17 +03:00
auto-trait-leak.rs Update tests 2020-01-09 21:23:12 +03:00
auto-trait-leak.stderr Small tweaks to required bound span 2020-04-08 14:40:51 -07:00
auto-trait-leak2.rs Remove unnecessary ignore-tidy-linelength 2019-04-23 11:42:14 +01:00
auto-trait-leak2.stderr Small tweaks to required bound span 2020-04-08 14:40:51 -07:00
auto-trait.rs Add additional tests for type alias impl trait coherence 2019-09-24 15:59:02 -04:00
auto-trait.stderr Add additional tests for type alias impl trait coherence 2019-09-24 15:59:02 -04:00
bindings-opaque.rs add impl_trait_in_bindings to INCOMPLETE_FEATURES 2019-05-13 18:45:20 +03:00
bindings-opaque.stderr rustc: Add a warning count upon completion 2020-04-11 16:15:24 +02:00
bindings.rs add impl_trait_in_bindings to INCOMPLETE_FEATURES 2019-05-13 18:45:20 +03:00
bindings.stderr rustc: Add a warning count upon completion 2020-04-11 16:15:24 +02:00
bound-normalization-fail.rs compiletest: error if compile-fail header in ui test. 2020-02-02 02:08:30 -05:00
bound-normalization-fail.stderr rustc: Add a warning count upon completion 2020-04-11 16:15:24 +02:00
bound-normalization-pass.rs Remove async_await gates from tests. 2019-08-20 03:08:42 +02:00
bound-normalization-pass.stderr rustc: Add a warning count upon completion 2020-04-11 16:15:24 +02:00
bounds_regression.rs tests: Move run-pass tests without naming conflicts to ui 2019-07-27 18:56:16 +03:00
can-return-unconstrained-closure.rs Migrate compile-pass annotations to build-pass 2019-07-03 06:30:28 +09:00
closure-calling-parent-fn.rs Update test stderr with results of enabling unused lints 2019-09-08 11:32:28 -04:00
deprecated_annotation.rs Migrate compile-pass annotations to build-pass 2019-07-03 06:30:28 +09:00
does-not-live-long-enough.rs Suggest move for closures and async blocks in more cases. 2020-04-08 13:01:53 +02:00
does-not-live-long-enough.stderr Suggest move for closures and async blocks in more cases. 2020-04-08 13:01:53 +02:00
dyn-trait-elided-two-inputs-assoc.rs distinguish object-lifetime-default elision from other elision 2019-08-19 13:50:42 -04:00
dyn-trait-elided-two-inputs-param.rs distinguish object-lifetime-default elision from other elision 2019-08-19 13:50:42 -04:00
dyn-trait-elided-two-inputs-ref-assoc.rs use static as object-lifetime default for type XX in Foo<Item=XX> 2019-08-19 13:50:44 -04:00
dyn-trait-elided-two-inputs-ref-param.rs distinguish object-lifetime-default elision from other elision 2019-08-19 13:50:42 -04:00
dyn-trait-return-should-be-impl-trait.rs Suggest -> impl Trait and -> Box<dyn Trait> on fn that doesn't return 2020-04-20 09:24:41 -07:00
dyn-trait-return-should-be-impl-trait.stderr Suggest -> impl Trait and -> Box<dyn Trait> on fn that doesn't return 2020-04-20 09:24:41 -07:00
equal-hidden-lifetimes.rs Handle equal regions in opaque type inference 2020-02-14 22:40:03 +00:00
equal-hidden-lifetimes.stderr rustc: Add a warning count upon completion 2020-04-11 16:15:24 +02:00
equality-rpass.rs tests: Move run-pass tests with naming conflicts to ui 2019-07-27 18:56:17 +03:00
equality.rs Surround types with backticks in type errors 2019-11-18 11:03:04 -08:00
equality.stderr Account for object safety when suggesting Box<dyn Trait> 2020-01-16 09:49:14 -08:00
equality2.rs Surround types with backticks in type errors 2019-11-18 11:03:04 -08:00
equality2.stderr review comments 2020-01-08 09:29:47 -08:00
example-calendar.rs tests: Move run-pass tests without naming conflicts to ui 2019-07-27 18:56:16 +03:00
example-st.rs tests: Move run-pass tests without naming conflicts to ui 2019-07-27 18:56:16 +03:00
extra-item.rs resolve: Do not skip extern prelude during speculative resolution 2018-10-17 10:31:37 +03:00
extra-item.stderr Update tests 2019-03-11 23:10:26 +03:00
hidden-lifetimes.rs Add better tests for hidden lifetimes in impl trait 2019-05-18 13:16:45 +01:00
hidden-lifetimes.stderr Print lifetimes with backticks 2019-10-11 16:08:53 +09:00
impl-generic-mismatch-ab.rs Remove licenses 2018-12-25 21:08:33 -07:00
impl-generic-mismatch-ab.stderr Specific labels when referring to "expected" and "found" types 2019-11-18 11:02:22 -08:00
impl-generic-mismatch.rs tests: remove ignore directives from tests that mention core/alloc/std spans. 2020-04-02 11:48:34 +03:00
impl-generic-mismatch.stderr tests: remove ignore directives from tests that mention core/alloc/std spans. 2020-04-02 11:48:34 +03:00
impl-trait-plus-priority.rs Remove unecessary -Z continue-parse-after-error from tests 2019-05-30 18:57:17 -07:00
impl-trait-plus-priority.stderr Remove licenses 2018-12-25 21:08:33 -07:00
impl_trait_projections.rs Remove licenses 2018-12-25 21:08:33 -07:00
impl_trait_projections.stderr hide --explain hint if error has no extended info 2019-04-18 13:29:28 -04:00
issue-55872-1.rs Replace "existential" by "opaque" 2019-08-02 02:44:36 +01:00
issue-55872-1.stderr Tweak suggest_constraining_type_param 2020-03-29 13:13:17 -07:00
issue-55872-2.rs Remove async_await gates from tests. 2019-08-20 03:08:42 +02:00
issue-55872-2.stderr --bless post no async_await gates in tests. 2019-08-20 03:08:42 +02:00
issue-55872.rs Replace "existential" by "opaque" 2019-08-02 02:44:36 +01:00
issue-55872.stderr Replace "existential" by "opaque" 2019-08-02 02:44:36 +01:00
issue-57200.rs Add FIXMEs 2020-03-09 16:50:46 +09:00
issue-57200.stderr Add FIXMEs 2020-03-09 16:50:46 +09:00
issue-57201.rs Add FIXMEs 2020-03-09 16:50:46 +09:00
issue-57201.stderr Add FIXMEs 2020-03-09 16:50:46 +09:00
issue-60473.rs Add FIXMEs 2020-03-09 16:50:46 +09:00
issue-60473.stderr Add FIXMEs 2020-03-09 16:50:46 +09:00
issue-67166.rs Add FIXMEs 2020-03-09 16:50:46 +09:00
issue-67166.stderr Add FIXMEs 2020-03-09 16:50:46 +09:00
lifetimes.rs tests: Move run-pass tests without naming conflicts to ui 2019-07-27 18:56:16 +03:00
method-suggestion-no-duplication.rs Remove unnecessary ignore-tidy-linelength 2019-04-23 11:42:14 +01:00
method-suggestion-no-duplication.stderr Unify output of "variant not found" errors 2020-01-08 08:05:31 -08:00
multiple-lifetimes.rs Migrate compile-pass annotations to build-pass 2019-07-03 06:30:28 +09:00
must_outlive_least_region_or_bound.nll.stderr Change wording for lifetime suggestion for opaque types from constraint to bound 2019-12-31 12:13:35 +01:00
must_outlive_least_region_or_bound.rs fix various typos 2020-03-06 15:19:31 +01:00
must_outlive_least_region_or_bound.stderr Tweak binding lifetime suggestion text 2020-02-19 18:04:03 -08:00
needs_least_region_or_bound.rs Update test stderr with results of enabling unused lints 2019-09-08 11:32:28 -04:00
negative-reasoning.rs Add additional tests for type alias impl trait coherence 2019-09-24 15:59:02 -04:00
negative-reasoning.stderr Add additional tests for type alias impl trait coherence 2019-09-24 15:59:02 -04:00
nested-return-type.rs Fix and test nested impl Trait 2020-02-14 22:40:03 +00:00
nesting.rs tests: Move run-pass tests without naming conflicts to ui 2019-07-27 18:56:16 +03:00
no-method-suggested-traits.rs Unify output of "variant not found" errors 2020-01-08 08:05:31 -08:00
no-method-suggested-traits.stderr Store idents for DefPathData into crate metadata 2020-03-22 23:40:19 -04:00
no-trait.rs Remove licenses 2018-12-25 21:08:33 -07:00
no-trait.stderr Update tests 2019-03-11 23:10:26 +03:00
object-unsafe-trait-in-return-position-dyn-trait.rs Account for object safety when suggesting Box<dyn Trait> 2020-01-16 09:49:14 -08:00
object-unsafe-trait-in-return-position-dyn-trait.stderr Use more appropriate spans on object unsafe traits and provide structured suggestions when possible 2020-02-02 11:53:10 -08:00
object-unsafe-trait-in-return-position-impl-trait.rs Account for object safety when suggesting Box<dyn Trait> 2020-01-16 09:49:14 -08:00
object-unsafe-trait-in-return-position-impl-trait.stderr Account for object safety when suggesting Box<dyn Trait> 2020-01-16 09:49:14 -08:00
recursive-impl-trait-type-direct.rs Update tests 2020-02-14 22:40:03 +00:00
recursive-impl-trait-type-direct.stderr Update tests 2020-02-14 22:40:03 +00:00
recursive-impl-trait-type-indirect.rs Update tests 2020-02-14 22:40:03 +00:00
recursive-impl-trait-type-indirect.stderr Update tests 2020-02-14 22:40:03 +00:00
recursive-impl-trait-type-through-non-recursive.rs Don't ICE for completely unexpandable impl Trait types 2019-10-24 21:33:09 +01:00
recursive-impl-trait-type-through-non-recursive.stderr Don't ICE for completely unexpandable impl Trait types 2019-10-24 21:33:09 +01:00
region-escape-via-bound-contravariant-closure.rs Remove feature(nll) when compare mode is sufficient 2019-05-12 18:46:43 +01:00
region-escape-via-bound-contravariant.rs Remove feature(nll) when compare mode is sufficient 2019-05-12 18:46:43 +01:00
region-escape-via-bound.rs Remove feature(nll) when compare mode is sufficient 2019-05-12 18:46:43 +01:00
region-escape-via-bound.stderr Print lifetimes with backticks 2019-10-11 16:08:53 +09:00
return-position-impl-trait-minimal.rs Replace "existential" by "opaque" 2019-08-02 02:44:36 +01:00
static-return-lifetime-infered.nll.stderr Change wording for lifetime suggestion for opaque types from constraint to bound 2019-12-31 12:13:35 +01:00
static-return-lifetime-infered.rs Remove licenses 2018-12-25 21:08:33 -07:00
static-return-lifetime-infered.stderr Change wording for lifetime suggestion for opaque types from constraint to bound 2019-12-31 12:13:35 +01:00
trait_type.rs Remove licenses 2018-12-25 21:08:33 -07:00
trait_type.stderr review comment 2020-02-08 21:08:59 -08:00
type-alias-generic-param.rs Fix opaque types resulting from projections in function signature 2019-11-24 14:37:23 -05:00
type-alias-impl-trait-in-fn-body.rs Replace "existential" by "opaque" 2019-08-02 02:44:36 +01:00
type_parameters_captured.nll.stderr Change compare mode to use -Zborrowck=mir 2019-05-12 18:46:43 +01:00
type_parameters_captured.rs Remove licenses 2018-12-25 21:08:33 -07:00
type_parameters_captured.stderr Tweak binding lifetime suggestion text 2020-02-19 18:04:03 -08:00
universal-mismatched-type.rs Remove licenses 2018-12-25 21:08:33 -07:00
universal-mismatched-type.stderr Specific labels when referring to "expected" and "found" types 2019-11-18 11:02:22 -08:00
universal-two-impl-traits.rs Remove licenses 2018-12-25 21:08:33 -07:00
universal-two-impl-traits.stderr Specific labels when referring to "expected" and "found" types 2019-11-18 11:02:22 -08:00
universal_hrtb_anon.rs tests: Move run-pass tests without naming conflicts to ui 2019-07-27 18:56:16 +03:00
universal_hrtb_named.rs tests: Move run-pass tests without naming conflicts to ui 2019-07-27 18:56:16 +03:00
universal_in_adt_in_parameters.rs tests: Move run-pass tests without naming conflicts to ui 2019-07-27 18:56:16 +03:00
universal_in_impl_trait_in_parameters.rs tests: Move run-pass tests without naming conflicts to ui 2019-07-27 18:56:16 +03:00
universal_in_trait_defn_parameters.rs tests: Move run-pass tests without naming conflicts to ui 2019-07-27 18:56:16 +03:00
universal_multiple_bounds.rs tests: Move run-pass tests without naming conflicts to ui 2019-07-27 18:56:16 +03:00
universal_wrong_bounds.rs resolve: Attempt to resolve unresolved paths in macro namespace 2019-07-18 13:42:45 +03:00
universal_wrong_bounds.stderr Increase spacing for suggestions in diagnostics 2019-10-24 12:26:01 -07:00
unsafety-checking-cycle.rs Call is_freeze less in unsafety-checking 2020-02-14 20:12:46 +00:00
where-allowed-2.rs Fix 'type annotations needed' error with opaque types 2019-11-18 14:01:36 -05:00
where-allowed-2.stderr Fix 'type annotations needed' error with opaque types 2019-11-18 14:01:36 -05:00
where-allowed.rs Fix 'type annotations needed' error with opaque types 2019-11-18 14:01:36 -05:00
where-allowed.stderr --bless --compare-mode=nll 2020-02-09 20:43:49 +01:00
xcrate.rs tests: Move run-pass tests without naming conflicts to ui 2019-07-27 18:56:16 +03:00
xcrate_simple.rs tests: Move run-pass tests without naming conflicts to ui 2019-07-27 18:56:16 +03:00