]> git.lizzy.rs Git - rust.git/blob - tests/ui/associated-types/impl-trait-return-missing-constraint.stderr
Rollup merge of #107519 - joboet:raw_os_error_ty, r=Amanieu
[rust.git] / tests / ui / associated-types / impl-trait-return-missing-constraint.stderr
1 error[E0271]: type mismatch resolving `<impl Bar as Foo>::Item == i32`
2   --> $DIR/impl-trait-return-missing-constraint.rs:25:13
3    |
4 LL | fn bar() -> impl Bar {
5    |             -------- the expected opaque type
6 ...
7 LL | fn baz() -> impl Bar<Item = i32> {
8    |             ^^^^^^^^^^^^^^^^^^^^ expected associated type, found `i32`
9 LL |
10 LL |     bar()
11    |     ----- return type was inferred to be `impl Bar` here
12    |
13    = note: expected associated type `<impl Bar as Foo>::Item`
14                          found type `i32`
15    = help: consider constraining the associated type `<impl Bar as Foo>::Item` to `i32` or calling a method that returns `<impl Bar as Foo>::Item`
16    = note: for more information, visit https://doc.rust-lang.org/book/ch19-03-advanced-traits.html
17 help: consider constraining the associated type `<impl Bar as Foo>::Item` to `i32`
18    |
19 LL | fn bar() -> impl Bar<Item = i32> {
20    |                     ++++++++++++
21
22 error: aborting due to previous error
23
24 For more information about this error, try `rustc --explain E0271`.