You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/test/ui/impl-trait/equality.stderr
+1-1
Original file line number
Diff line number
Diff line change
@@ -23,7 +23,7 @@ LL | 0_u32
23
23
= note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
24
24
= help: if the trait `Foo` were object safe, you could return a boxed trait object
25
25
= note: for information on trait objects, see <https://doc.rust-lang.org/book/ch17-02-trait-objects.html#using-trait-objects-that-allow-for-values-of-different-types>
26
-
= help: alternatively, create a new `enum` with a variant for each returned type
26
+
= help: you could instead create a new `enum` with a variant for each returned type
Copy file name to clipboardExpand all lines: src/test/ui/impl-trait/object-unsafe-trait-in-return-position-impl-trait.stderr
+8-2
Original file line number
Diff line number
Diff line change
@@ -14,7 +14,7 @@ LL | B
14
14
= note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
15
15
= help: if the trait `NotObjectSafe` were object safe, you could return a boxed trait object
16
16
= note: for information on trait objects, see <https://doc.rust-lang.org/book/ch17-02-trait-objects.html#using-trait-objects-that-allow-for-values-of-different-types>
17
-
= help: alternatively, create a new `enum` with a variant for each returned type
17
+
= help: you could instead create a new `enum` with a variant for each returned type
= note: to return `impl Trait`, all returned values must be of the same type
32
32
= note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
33
33
= note: for information on trait objects, see <https://doc.rust-lang.org/book/ch17-02-trait-objects.html#using-trait-objects-that-allow-for-values-of-different-types>
34
-
= help: alternatively, create a new `enum` with a variant for each returned type
34
+
= help: you could instead create a new `enum` with a variant for each returned type
35
35
help: you could change the return type to be a boxed trait object
36
36
|
37
37
LL | fn cat() -> Box<dyn ObjectSafe> {
38
38
| ^^^^^^^ ^
39
+
help: if you change the return type to expect trait objects, box the returned expressions
Copy file name to clipboardExpand all lines: src/test/ui/point-to-type-err-cause-on-impl-trait-return.stderr
+46-8
Original file line number
Diff line number
Diff line change
@@ -13,11 +13,17 @@ LL | 1u32
13
13
= note: to return `impl Trait`, all returned values must be of the same type
14
14
= note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
15
15
= note: for information on trait objects, see <https://doc.rust-lang.org/book/ch17-02-trait-objects.html#using-trait-objects-that-allow-for-values-of-different-types>
16
-
= help: alternatively, create a new `enum` with a variant for each returned type
16
+
= help: you could instead create a new `enum` with a variant for each returned type
17
17
help: you could change the return type to be a boxed trait object
18
18
|
19
19
LL | fn foo() -> Box<dyn std::fmt::Display> {
20
20
| ^^^^^^^ ^
21
+
help: if you change the return type to expect trait objects, box the returned expressions
= note: to return `impl Trait`, all returned values must be of the same type
35
41
= note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
36
42
= note: for information on trait objects, see <https://doc.rust-lang.org/book/ch17-02-trait-objects.html#using-trait-objects-that-allow-for-values-of-different-types>
37
-
= help: alternatively, create a new `enum` with a variant for each returned type
43
+
= help: you could instead create a new `enum` with a variant for each returned type
38
44
help: you could change the return type to be a boxed trait object
39
45
|
40
46
LL | fn bar() -> Box<dyn std::fmt::Display> {
41
47
| ^^^^^^^ ^
48
+
help: if you change the return type to expect trait objects, box the returned expressions
= note: to return `impl Trait`, all returned values must be of the same type
56
68
= note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
57
69
= note: for information on trait objects, see <https://doc.rust-lang.org/book/ch17-02-trait-objects.html#using-trait-objects-that-allow-for-values-of-different-types>
58
-
= help: alternatively, create a new `enum` with a variant for each returned type
70
+
= help: you could instead create a new `enum` with a variant for each returned type
59
71
help: you could change the return type to be a boxed trait object
60
72
|
61
73
LL | fn baz() -> Box<dyn std::fmt::Display> {
62
74
| ^^^^^^^ ^
75
+
help: if you change the return type to expect trait objects, box the returned expressions
76
+
|
77
+
LL | return Box::new(0i32);
78
+
LL | } else {
79
+
LL | Box::new(1u32)
80
+
|
63
81
64
82
error[E0308]: `if` and `else` have incompatible types
@@ -77,7 +95,7 @@ help: you could change the return type to be a boxed trait object
77
95
|
78
96
LL | fn qux() -> Box<dyn std::fmt::Display> {
79
97
| ^^^^^^^ ^
80
-
help: if you change the return type to expect trait objects box the returned expressions
98
+
help: if you change the return type to expect trait objects, box the returned expressions
81
99
|
82
100
LL | Box::new(0i32)
83
101
LL | } else {
@@ -98,11 +116,16 @@ LL | _ => 1u32,
98
116
= note: to return `impl Trait`, all returned values must be of the same type
99
117
= note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
100
118
= note: for information on trait objects, see <https://doc.rust-lang.org/book/ch17-02-trait-objects.html#using-trait-objects-that-allow-for-values-of-different-types>
101
-
= help: alternatively, create a new `enum` with a variant for each returned type
119
+
= help: you could instead create a new `enum` with a variant for each returned type
102
120
help: you could change the return type to be a boxed trait object
103
121
|
104
122
LL | fn bat() -> Box<dyn std::fmt::Display> {
105
123
| ^^^^^^^ ^
124
+
help: if you change the return type to expect trait objects, box the returned expressions
= note: to return `impl Trait`, all returned values must be of the same type
121
144
= note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
122
145
= note: for information on trait objects, see <https://doc.rust-lang.org/book/ch17-02-trait-objects.html#using-trait-objects-that-allow-for-values-of-different-types>
123
-
= help: alternatively, create a new `enum` with a variant for each returned type
146
+
= help: you could instead create a new `enum` with a variant for each returned type
124
147
help: you could change the return type to be a boxed trait object
125
148
|
126
149
LL | fn can() -> Box<dyn std::fmt::Display> {
127
150
| ^^^^^^^ ^
151
+
help: if you change the return type to expect trait objects, box the returned expressions
= note: to return `impl Trait`, all returned values must be of the same type
142
173
= note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
143
174
= note: for information on trait objects, see <https://doc.rust-lang.org/book/ch17-02-trait-objects.html#using-trait-objects-that-allow-for-values-of-different-types>
144
-
= help: alternatively, create a new `enum` with a variant for each returned type
175
+
= help: you could instead create a new `enum` with a variant for each returned type
145
176
help: you could change the return type to be a boxed trait object
146
177
|
147
178
LL | fn cat() -> Box<dyn std::fmt::Display> {
148
179
| ^^^^^^^ ^
180
+
help: if you change the return type to expect trait objects, box the returned expressions
181
+
|
182
+
LL | return Box::new(0i32);
183
+
LL | }
184
+
LL | _ => {
185
+
LL | Box::new(1u32)
186
+
|
149
187
150
188
error[E0308]: `match` arms have incompatible types
0 commit comments