rust/src/test/ui/traits
Mazdak Farrokhzad b4c340e4bb
Rollup merge of #60444 - nikomatsakis:issue-60010-cycle-error-investigation, r=pnkfelix
forego caching for all participants in cycles, apart from root node

This is a targeted fix for #60010, which uncovered a pretty bad failure of our caching strategy in the face of coinductive cycles. The problem is explained in the comment in the PR on the new field, `in_cycle`, but I'll reproduce it here:

> Starts out as false -- if, during evaluation, we encounter a
> cycle, then we will set this flag to true for all participants
> in the cycle (apart from the "head" node). These participants
> will then forego caching their results. This is not the most
> efficient solution, but it addresses #60010. The problem we
> are trying to prevent:
>
> - If you have `A: AutoTrait` requires `B: AutoTrait` and `C: NonAutoTrait`
> - `B: AutoTrait` requires `A: AutoTrait` (coinductive cycle, ok)
> - `C: NonAutoTrait` requires `A: AutoTrait` (non-coinductive cycle, not ok)
>
> you don't want to cache that `B: AutoTrait` or `A: AutoTrait`
> is `EvaluatedToOk`; this is because they were only considered
> ok on the premise that if `A: AutoTrait` held, but we indeed
> encountered a problem (later on) with `A: AutoTrait. So we
> currently set a flag on the stack node for `B: AutoTrait` (as
> well as the second instance of `A: AutoTrait`) to supress
> caching.
>
> This is a simple, targeted fix. The correct fix requires
> deeper changes, but would permit more caching: we could
> basically defer caching until we have fully evaluated the
> tree, and then cache the entire tree at once.

I'm not sure what the impact of this fix will be in terms of existing crates or performance: we were accepting incorrect code before, so there will perhaps be some regressions, and we are now caching less.

As the comment above notes, we could do a lot better than this fix, but that would involve more invasive rewrites. I thought it best to start with something simple.

r? @pnkfelix -- but let's do crater/perf run
cc @arielb1
2019-05-14 22:00:13 +02:00
..
auxiliary new trait alias tests 2019-01-10 17:04:26 -05:00
conservative_impl_trait.rs Remove licenses 2018-12-25 21:08:33 -07:00
cycle-cache-err-60010.rs forego caching for all participants in cycles, apart from root node 2019-05-01 17:57:44 -04:00
cycle-cache-err-60010.stderr forego caching for all participants in cycles, apart from root node 2019-05-01 17:57:44 -04:00
trait-alias-ambiguous.rs resolve all in scope trait aliases, then elaborate their bounds 2019-04-01 11:23:40 -07:00
trait-alias-ambiguous.stderr resolve all in scope trait aliases, then elaborate their bounds 2019-04-01 11:23:40 -07:00
trait-alias-cross-crate.rs new trait alias tests 2019-01-10 17:04:26 -05:00
trait-alias-cross-crate.stderr new trait alias tests 2019-01-10 17:04:26 -05:00
trait-alias-impl.rs Remove licenses 2018-12-25 21:08:33 -07:00
trait-alias-impl.stderr Update tests 2019-03-11 23:10:26 +03:00
trait-alias-object.rs Remove licenses 2018-12-25 21:08:33 -07:00
trait-alias-object.stderr hide --explain hint if error has no extended info 2019-04-18 13:29:28 -04:00
trait-alias-syntax.rs Added tests. 2019-02-12 14:33:58 +00:00
trait-alias-syntax.stderr Update tests 2019-03-11 23:10:26 +03:00
trait-alias-wf.rs Remove licenses 2018-12-25 21:08:33 -07:00
trait-alias-wf.stderr Update tests 2019-03-11 23:10:26 +03:00
trait-as-struct-constructor.rs Remove licenses 2018-12-25 21:08:33 -07:00
trait-as-struct-constructor.stderr hide --explain hint if error has no extended info 2019-04-18 13:29:28 -04:00
trait-bounds-not-on-bare-trait.rs Remove licenses 2018-12-25 21:08:33 -07:00
trait-bounds-not-on-bare-trait.stderr Fix broken links to second edition TRPL. 2019-01-01 12:53:07 -05:00
trait-bounds-not-on-struct.rs Remove licenses 2018-12-25 21:08:33 -07:00
trait-bounds-not-on-struct.stderr Update tests 2019-03-11 23:10:26 +03:00
trait-bounds-on-structs-and-enums-in-fns.rs Remove licenses 2018-12-25 21:08:33 -07:00
trait-bounds-on-structs-and-enums-in-fns.stderr Remove licenses 2018-12-25 21:08:33 -07:00
trait-bounds-on-structs-and-enums-in-impls.rs Remove licenses 2018-12-25 21:08:33 -07:00
trait-bounds-on-structs-and-enums-in-impls.stderr Remove licenses 2018-12-25 21:08:33 -07:00
trait-bounds-on-structs-and-enums-locals.rs Remove licenses 2018-12-25 21:08:33 -07:00
trait-bounds-on-structs-and-enums-locals.stderr Remove licenses 2018-12-25 21:08:33 -07:00
trait-bounds-on-structs-and-enums-static.rs Remove licenses 2018-12-25 21:08:33 -07:00
trait-bounds-on-structs-and-enums-static.stderr Remove licenses 2018-12-25 21:08:33 -07:00
trait-bounds-on-structs-and-enums-xc.rs Remove licenses 2018-12-25 21:08:33 -07:00
trait-bounds-on-structs-and-enums-xc.stderr Remove licenses 2018-12-25 21:08:33 -07:00
trait-bounds-on-structs-and-enums-xc1.rs Remove licenses 2018-12-25 21:08:33 -07:00
trait-bounds-on-structs-and-enums-xc1.stderr Remove licenses 2018-12-25 21:08:33 -07:00
trait-bounds-on-structs-and-enums.rs Remove licenses 2018-12-25 21:08:33 -07:00
trait-bounds-on-structs-and-enums.stderr Update tests 2019-03-11 23:10:26 +03:00
trait-bounds-sugar.rs Remove licenses 2018-12-25 21:08:33 -07:00
trait-bounds-sugar.stderr Update tests 2019-03-11 23:10:26 +03:00
trait-coercion-generic-bad.rs Remove licenses 2018-12-25 21:08:33 -07:00
trait-coercion-generic-bad.stderr Remove licenses 2018-12-25 21:08:33 -07:00
trait-coercion-generic-regions.rs Remove licenses 2018-12-25 21:08:33 -07:00
trait-coercion-generic-regions.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
trait-duplicate-methods.rs Remove licenses 2018-12-25 21:08:33 -07:00
trait-duplicate-methods.stderr Update tests 2019-03-11 23:10:26 +03:00
trait-impl-1.rs Remove licenses 2018-12-25 21:08:33 -07:00
trait-impl-1.stderr Update tests 2019-03-11 23:10:26 +03:00
trait-impl-can-not-have-untraitful-items.rs Remove licenses 2018-12-25 21:08:33 -07:00
trait-impl-can-not-have-untraitful-items.stderr hide --explain hint if error has no extended info 2019-04-18 13:29:28 -04:00
trait-impl-different-num-params.rs Remove licenses 2018-12-25 21:08:33 -07:00
trait-impl-different-num-params.stderr Remove licenses 2018-12-25 21:08:33 -07:00
trait-impl-for-module.rs Remove licenses 2018-12-25 21:08:33 -07:00
trait-impl-for-module.stderr hide --explain hint if error has no extended info 2019-04-18 13:29:28 -04:00
trait-impl-method-mismatch.rs Remove licenses 2018-12-25 21:08:33 -07:00
trait-impl-method-mismatch.stderr Remove licenses 2018-12-25 21:08:33 -07:00
trait-impl-of-supertrait-has-wrong-lifetime-parameters.rs Remove licenses 2018-12-25 21:08:33 -07:00
trait-impl-of-supertrait-has-wrong-lifetime-parameters.stderr hide --explain hint if error has no extended info 2019-04-18 13:29:28 -04:00
trait-item-privacy.rs Remove licenses 2018-12-25 21:08:33 -07:00
trait-item-privacy.stderr hide --explain hint if error has no extended info 2019-04-18 13:29:28 -04:00
trait-matching-lifetimes.rs Remove licenses 2018-12-25 21:08:33 -07:00
trait-matching-lifetimes.stderr Remove licenses 2018-12-25 21:08:33 -07:00
trait-method-private.rs Remove licenses 2018-12-25 21:08:33 -07:00
trait-method-private.stderr Update tests 2019-03-11 23:10:26 +03:00
trait-object-auto-dedup-in-impl.rs Remove licenses 2018-12-25 21:08:33 -07:00
trait-object-auto-dedup-in-impl.stderr hide --explain hint if error has no extended info 2019-04-18 13:29:28 -04:00
trait-object-macro-matcher.rs Remove licenses 2018-12-25 21:08:33 -07:00
trait-object-macro-matcher.stderr hide --explain hint if error has no extended info 2019-04-18 13:29:28 -04:00
trait-object-safety.rs Remove licenses 2018-12-25 21:08:33 -07:00
trait-object-safety.stderr Update tests 2019-03-11 23:10:26 +03:00
trait-object-vs-lifetime-2.rs Remove licenses 2018-12-25 21:08:33 -07:00
trait-object-vs-lifetime-2.stderr hide --explain hint if error has no extended info 2019-04-18 13:29:28 -04:00
trait-object-vs-lifetime.rs Update tests 2019-02-07 15:02:17 +01:00
trait-object-vs-lifetime.stderr hide --explain hint if error has no extended info 2019-04-18 13:29:28 -04:00
trait-object-with-self-in-projection-output-bad.rs improve tests as suggested by review comments 2018-12-18 00:33:21 +02:00
trait-object-with-self-in-projection-output-bad.stderr improve tests as suggested by review comments 2018-12-18 00:33:21 +02:00
trait-object-with-self-in-projection-output-good.rs improve tests as suggested by review comments 2018-12-18 00:33:21 +02:00
trait-object-with-self-in-projection-output-repeated-supertrait.rs compiletest: only use make_exe_name for tests that end up being executed. 2019-05-07 04:49:54 +03:00
trait-or-new-type-instead.rs Remove licenses 2018-12-25 21:08:33 -07:00
trait-or-new-type-instead.stderr Update tests 2019-03-11 23:10:26 +03:00
trait-privacy.rs Stabilize Any::get_type_id and rename to type_id 2019-01-22 14:25:27 +01:00
trait-resolution-in-overloaded-op.rs Remove licenses 2018-12-25 21:08:33 -07:00
trait-resolution-in-overloaded-op.stderr Better diagnostic for binary operation on BoxedValues 2019-03-27 13:13:09 -04:00
trait-safety-fn-body.rs Remove licenses 2018-12-25 21:08:33 -07:00
trait-safety-fn-body.stderr Remove licenses 2018-12-25 21:08:33 -07:00
trait-safety-inherent-impl.rs Remove licenses 2018-12-25 21:08:33 -07:00
trait-safety-inherent-impl.stderr Update tests 2019-03-11 23:10:26 +03:00
trait-safety-trait-impl-cc.rs Remove licenses 2018-12-25 21:08:33 -07:00
trait-safety-trait-impl-cc.stderr Update tests 2019-03-11 23:10:26 +03:00
trait-safety-trait-impl.rs Remove licenses 2018-12-25 21:08:33 -07:00
trait-safety-trait-impl.stderr hide --explain hint if error has no extended info 2019-04-18 13:29:28 -04:00
trait-static-method-generic-inference.rs Remove licenses 2018-12-25 21:08:33 -07:00
trait-static-method-generic-inference.stderr Remove licenses 2018-12-25 21:08:33 -07:00
trait-suggest-where-clause.rs Remove licenses 2018-12-25 21:08:33 -07:00
trait-suggest-where-clause.stderr Fix broken links to second edition TRPL. 2019-01-01 12:53:07 -05:00
trait-test-2.rs Remove licenses 2018-12-25 21:08:33 -07:00
trait-test-2.stderr hide --explain hint if error has no extended info 2019-04-18 13:29:28 -04:00
trait-test.rs Remove licenses 2018-12-25 21:08:33 -07:00
trait-test.stderr Update tests 2019-03-11 23:10:26 +03:00
traits-assoc-type-in-supertrait-bad.rs Remove licenses 2018-12-25 21:08:33 -07:00
traits-assoc-type-in-supertrait-bad.stderr Update tests 2019-03-11 23:10:26 +03:00
traits-inductive-overflow-simultaneous.rs Remove licenses 2018-12-25 21:08:33 -07:00
traits-inductive-overflow-simultaneous.stderr Remove licenses 2018-12-25 21:08:33 -07:00
traits-inductive-overflow-supertrait-oibit.rs Remove licenses 2018-12-25 21:08:33 -07:00
traits-inductive-overflow-supertrait-oibit.stderr hide --explain hint if error has no extended info 2019-04-18 13:29:28 -04:00
traits-inductive-overflow-supertrait.rs Remove licenses 2018-12-25 21:08:33 -07:00
traits-inductive-overflow-supertrait.stderr Update tests 2019-03-11 23:10:26 +03:00
traits-inductive-overflow-two-traits.rs Remove licenses 2018-12-25 21:08:33 -07:00
traits-inductive-overflow-two-traits.stderr Update tests 2019-03-11 23:10:26 +03:00
traits-issue-23003-overflow.rs Remove licenses 2018-12-25 21:08:33 -07:00
traits-multidispatch-bad.rs Remove licenses 2018-12-25 21:08:33 -07:00
traits-multidispatch-bad.stderr Suggest try_into when possible 2019-04-29 14:38:26 -07:00
traits-multidispatch-convert-ambig-dest.rs Remove licenses 2018-12-25 21:08:33 -07:00
traits-multidispatch-convert-ambig-dest.stderr Remove licenses 2018-12-25 21:08:33 -07:00
traits-negative-impls.rs Remove licenses 2018-12-25 21:08:33 -07:00
traits-negative-impls.stderr Remove licenses 2018-12-25 21:08:33 -07:00
traits-repeated-supertrait-ambig.rs Remove licenses 2018-12-25 21:08:33 -07:00
traits-repeated-supertrait-ambig.stderr Update tests 2019-03-11 23:10:26 +03:00