rust/src/test/ui/hrtb
Esteban Küber 3a795fba03 On type mismatch involving associated type, suggest constraint
When an associated type is found when a specific type was expected, if
possible provide a structured suggestion constraining the associated
type in a bound.

```
error[E0271]: type mismatch resolving `<T as Foo>::Y == i32`
  --> $DIR/associated-types-multiple-types-one-trait.rs:13:5
   |
LL |     want_y(t);
   |     ^^^^^^ expected `i32`, found associated type
...
LL | fn want_y<T:Foo<Y=i32>>(t: &T) { }
   |                 ----- required by this bound in `want_y`
   |
   = note:         expected type `i32`
           found associated type `<T as Foo>::Y`
help: consider constraining the associated type `<T as Foo>::Y` to `i32`
   |
LL | fn have_x_want_y<T:Foo<X=u32, Y = i32>>(t: &T)
   |                             ^^^^^^^^^
```

```
error[E0308]: mismatched types
  --> $DIR/trait-with-missing-associated-type-restriction.rs:12:9
   |
LL |     qux(x.func())
   |         ^^^^^^^^ expected `usize`, found associated type
   |
   = note:         expected type `usize`
           found associated type `<impl Trait as Trait>::A`
help: consider constraining the associated type `<impl Trait as Trait>::A` to `usize`
   |
LL | fn foo(x: impl Trait<A = usize>) {
   |                     ^^^^^^^^^^
```
2020-05-02 18:23:46 -07:00
..
due-to-where-clause.nll.stderr reserve variable for empty root region 2020-04-16 11:03:41 +00:00
due-to-where-clause.rs Make lifetimes in constants live at the point of use 2019-10-02 20:39:01 +01:00
due-to-where-clause.stderr Make lifetimes in constants live at the point of use 2019-10-02 20:39:01 +01:00
hrtb-cache-issue-54302.nll.stderr Change compare mode to use -Zborrowck=mir 2019-05-12 18:46:43 +01:00
hrtb-cache-issue-54302.rs make evaluation track whether outlives relationships mattered 2019-01-02 17:35:05 -05:00
hrtb-cache-issue-54302.stderr Tweak unsatisfied HRTB errors 2019-09-16 15:34:33 -07:00
hrtb-conflate-regions.rs Remove meaningless comments in src/test 2019-08-16 10:54:20 +01:00
hrtb-conflate-regions.stderr Add label to item source of bound obligation 2020-04-18 17:19:53 -07:00
hrtb-debruijn-in-receiver.rs Remove licenses 2018-12-25 21:08:33 -07:00
hrtb-debruijn-in-receiver.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
hrtb-exists-forall-fn.rs address tmandry nits 2019-01-02 17:35:06 -05:00
hrtb-exists-forall-fn.stderr Point at type in let assignment on type errors 2019-11-21 19:24:31 -08:00
hrtb-exists-forall-trait-contravariant.rs update test files to reflect new output 2019-02-21 11:32:17 -05:00
hrtb-exists-forall-trait-contravariant.stderr Add label to item source of bound obligation 2020-04-18 17:19:53 -07:00
hrtb-exists-forall-trait-covariant.rs update test files to reflect new output 2019-02-21 11:32:17 -05:00
hrtb-exists-forall-trait-covariant.stderr Add label to item source of bound obligation 2020-04-18 17:19:53 -07:00
hrtb-exists-forall-trait-invariant.rs update test files to reflect new output 2019-02-21 11:32:17 -05:00
hrtb-exists-forall-trait-invariant.stderr Add label to item source of bound obligation 2020-04-18 17:19:53 -07:00
hrtb-higher-ranker-supertraits-transitive.rs tests: worse diagnostics, but basically same errors 2019-01-02 17:35:05 -05:00
hrtb-higher-ranker-supertraits-transitive.stderr Add label to item source of bound obligation 2020-04-18 17:19:53 -07:00
hrtb-higher-ranker-supertraits.rs update test files to reflect new output 2019-02-21 11:32:17 -05:00
hrtb-higher-ranker-supertraits.stderr Add label to item source of bound obligation 2020-04-18 17:19:53 -07:00
hrtb-identity-fn-borrows.rs update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
hrtb-identity-fn-borrows.stderr update tests for migrate mode by default 2019-04-22 08:40:08 +01:00
hrtb-just-for-static.rs apply the new placeholder errors even with just one placeholder 2019-01-02 17:35:06 -05:00
hrtb-just-for-static.stderr Add label to item source of bound obligation 2020-04-18 17:19:53 -07:00
hrtb-perfect-forwarding.nll.stderr rustc: Add a warning count upon completion 2020-04-11 16:15:24 +02:00
hrtb-perfect-forwarding.polonius.stderr bless output of ui test hrtb/hrtb-perfect-forwarding.rs 2020-03-30 01:18:27 +02:00
hrtb-perfect-forwarding.rs Update tests 2020-01-09 21:23:12 +03:00
hrtb-perfect-forwarding.stderr Update tests 2020-01-09 21:23:12 +03:00
issue-30786.migrate.stderr Tweak unsatisfied HRTB errors 2019-09-16 15:34:33 -07:00
issue-30786.nll.stderr Update tests 2020-01-09 21:23:12 +03:00
issue-30786.rs Update tests 2020-01-09 21:23:12 +03:00
issue-46989.rs restore the actual leak-check 2019-02-21 11:32:17 -05:00
issue-46989.stderr Small tweaks to required bound span 2020-04-08 14:40:51 -07:00
issue-57639.rs Update test stderr with results of enabling unused lints 2019-09-08 11:32:28 -04:00
issue-58451.rs On mismatched argument count point at arguments 2020-02-11 12:42:00 -08:00
issue-58451.stderr On mismatched argument count point at arguments 2020-02-11 12:42:00 -08:00
issue-62203-hrtb-ice.rs Regression test. 2019-07-09 13:57:22 +02:00
issue-62203-hrtb-ice.stderr On type mismatch involving associated type, suggest constraint 2020-05-02 18:23:46 -07:00