@@ -2,28 +2,43 @@ error[E0308]: mismatched types
22 --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:5:5
33 |
44LL | fn foo() -> impl std::fmt::Display {
5- | ---------------------- expected `_ ` because of return type
5+ | ---------------------- expected `i32 ` because of return type
66...
77LL | 1u32
88 | ^^^^ expected `i32`, found `u32`
9+ |
10+ help: change the type of the numeric literal from `u32` to `i32`
11+ |
12+ LL | 1i32
13+ | ~~~
914
1015error[E0308]: mismatched types
1116 --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:12:16
1217 |
1318LL | fn bar() -> impl std::fmt::Display {
14- | ---------------------- expected `_ ` because of return type
19+ | ---------------------- expected `i32 ` because of return type
1520...
1621LL | return 1u32;
1722 | ^^^^ expected `i32`, found `u32`
23+ |
24+ help: change the type of the numeric literal from `u32` to `i32`
25+ |
26+ LL | return 1i32;
27+ | ~~~
1828
1929error[E0308]: mismatched types
2030 --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:20:9
2131 |
2232LL | fn baz() -> impl std::fmt::Display {
23- | ---------------------- expected `_ ` because of return type
33+ | ---------------------- expected `i32 ` because of return type
2434...
2535LL | 1u32
2636 | ^^^^ expected `i32`, found `u32`
37+ |
38+ help: you can convert a `u32` to an `i32` and panic if the converted value doesn't fit
39+ |
40+ LL | }.try_into().unwrap()
41+ | ++++++++++++++++++++
2742
2843error[E0308]: `if` and `else` have incompatible types
2944 --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:28:9
@@ -36,36 +51,56 @@ LL | | 1u32
3651 | | ^^^^ expected `i32`, found `u32`
3752LL | | }
3853 | |_____- `if` and `else` have incompatible types
54+ |
55+ help: change the type of the numeric literal from `u32` to `i32`
56+ |
57+ LL | 1i32
58+ | ~~~
3959
4060error[E0308]: mismatched types
4161 --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:35:14
4262 |
4363LL | fn bat() -> impl std::fmt::Display {
44- | ---------------------- expected `_ ` because of return type
64+ | ---------------------- expected `i32 ` because of return type
4565...
4666LL | _ => 1u32,
4767 | ^^^^ expected `i32`, found `u32`
68+ |
69+ help: you can convert a `u32` to an `i32` and panic if the converted value doesn't fit
70+ |
71+ LL | }.try_into().unwrap()
72+ | ++++++++++++++++++++
4873
4974error[E0308]: mismatched types
5075 --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:40:5
5176 |
5277LL | fn can() -> impl std::fmt::Display {
53- | ---------------------- expected `_ ` because of return type
78+ | ---------------------- expected `i32 ` because of return type
5479LL | / match 13 {
5580LL | | 0 => return 0i32,
5681LL | | 1 => 1u32,
5782LL | | _ => 2u32,
5883LL | | }
5984 | |_____^ expected `i32`, found `u32`
85+ |
86+ help: you can convert a `u32` to an `i32` and panic if the converted value doesn't fit
87+ |
88+ LL | }.try_into().unwrap()
89+ | ++++++++++++++++++++
6090
6191error[E0308]: mismatched types
6292 --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:53:13
6393 |
6494LL | fn cat() -> impl std::fmt::Display {
65- | ---------------------- expected `_ ` because of return type
95+ | ---------------------- expected `i32 ` because of return type
6696...
6797LL | 1u32
6898 | ^^^^ expected `i32`, found `u32`
99+ |
100+ help: you can convert a `u32` to an `i32` and panic if the converted value doesn't fit
101+ |
102+ LL | }.try_into().unwrap()
103+ | ++++++++++++++++++++
69104
70105error[E0308]: `match` arms have incompatible types
71106 --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:61:14
@@ -78,6 +113,11 @@ LL | | 1 => 1u32,
78113LL | | _ => 2u32,
79114LL | | }
80115 | |_____- `match` arms have incompatible types
116+ |
117+ help: change the type of the numeric literal from `u32` to `i32`
118+ |
119+ LL | 1 => 1i32,
120+ | ~~~
81121
82122error[E0308]: `if` and `else` have incompatible types
83123 --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:97:9
@@ -90,6 +130,11 @@ LL | | 1u32
90130 | | ^^^^ expected `i32`, found `u32`
91131LL | | }
92132 | |_____- `if` and `else` have incompatible types
133+ |
134+ help: change the type of the numeric literal from `u32` to `i32`
135+ |
136+ LL | 1i32
137+ | ~~~
93138
94139error[E0746]: return type cannot have an unboxed trait object
95140 --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:66:13
@@ -125,6 +170,11 @@ LL | | 1 => 1u32,
125170LL | | _ => 2u32,
126171LL | | }
127172 | |_____- `match` arms have incompatible types
173+ |
174+ help: change the type of the numeric literal from `u32` to `i32`
175+ |
176+ LL | 1 => 1i32,
177+ | ~~~
128178
129179error[E0746]: return type cannot have an unboxed trait object
130180 --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:77:13
@@ -164,6 +214,11 @@ LL | | 1u32
164214 | | ^^^^ expected `i32`, found `u32`
165215LL | | }
166216 | |_____- `if` and `else` have incompatible types
217+ |
218+ help: change the type of the numeric literal from `u32` to `i32`
219+ |
220+ LL | 1i32
221+ | ~~~
167222
168223error[E0746]: return type cannot have an unboxed trait object
169224 --> $DIR/point-to-type-err-cause-on-impl-trait-return.rs:85:13
0 commit comments