]> git.lizzy.rs Git - rust.git/blob - tests/ui/return/return-impl-trait-bad.stderr
Rollup merge of #106106 - jyn514:remote-tracking-branch, r=Mark-Simulacrum
[rust.git] / tests / ui / return / return-impl-trait-bad.stderr
1 error[E0308]: mismatched types
2   --> $DIR/return-impl-trait-bad.rs:5:5
3    |
4 LL | fn bad_echo<T>(_t: T) -> T {
5    |             -            - expected `T` because of return type
6    |             |
7    |             this type parameter
8 LL |     "this should not suggest impl Trait"
9    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected type parameter `T`, found `&str`
10    |
11    = note: expected type parameter `T`
12                    found reference `&'static str`
13
14 error[E0308]: mismatched types
15   --> $DIR/return-impl-trait-bad.rs:9:5
16    |
17 LL | fn bad_echo_2<T: Trait>(_t: T) -> T {
18    |               -                   - expected `T` because of return type
19    |               |
20    |               this type parameter
21 LL |     "this will not suggest it, because that would probably be wrong"
22    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected type parameter `T`, found `&str`
23    |
24    = note: expected type parameter `T`
25                    found reference `&'static str`
26
27 error[E0308]: mismatched types
28   --> $DIR/return-impl-trait-bad.rs:17:5
29    |
30 LL | fn other_bounds_bad<T>() -> T
31    |                     -       - expected `T` because of return type
32    |                     |
33    |                     this type parameter
34 ...
35 LL |     "don't suggest this, because Option<T> places additional constraints"
36    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected type parameter `T`, found `&str`
37    |
38    = note: expected type parameter `T`
39                    found reference `&'static str`
40
41 error[E0308]: mismatched types
42   --> $DIR/return-impl-trait-bad.rs:28:5
43    |
44 LL | fn used_in_trait<T>() -> T
45    |                  -       -
46    |                  |       |
47    |                  |       expected `T` because of return type
48    |                  |       help: consider using an impl return type: `impl Send`
49    |                  this type parameter
50 ...
51 LL |     "don't suggest this, because the generic param is used in the bound."
52    |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected type parameter `T`, found `&str`
53    |
54    = note: expected type parameter `T`
55                    found reference `&'static str`
56
57 error: aborting due to 4 previous errors
58
59 For more information about this error, try `rustc --explain E0308`.