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
+5Lines changed: 5 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,11 @@ LL | return 1_i32;
9
9
LL | }
10
10
LL | 0_u32
11
11
| ^^^^^ expected `i32`, found `u32`
12
+
|
13
+
= note: `impl Trait` as a return type requires that all the returned values must have the same type
14
+
= help: you can instead return a trait object using `Box<dyn Foo>`
15
+
= note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
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>
Copy file name to clipboardExpand all lines: src/test/ui/point-to-type-err-cause-on-impl-trait-return.stderr
+30Lines changed: 30 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,11 @@ LL | return 0i32;
9
9
LL | }
10
10
LL | 1u32
11
11
| ^^^^ expected `i32`, found `u32`
12
+
|
13
+
= note: `impl Trait` as a return type requires that all the returned values must have the same type
14
+
= help: you can instead return a trait object using `Box<dyn std::fmt::Display>`
15
+
= note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
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>
= note: `impl Trait` as a return type requires that all the returned values must have the same type
31
+
= help: you can instead return a trait object using `Box<dyn std::fmt::Display>`
32
+
= note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
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>
= note: `impl Trait` as a return type requires that all the returned values must have the same type
48
+
= help: you can instead return a trait object using `Box<dyn std::fmt::Display>`
49
+
= note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
50
+
= 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>
36
51
37
52
error[E0308]: `if` and `else` have incompatible types
= note: `impl Trait` as a return type requires that all the returned values must have the same type
77
+
= help: you can instead return a trait object using `Box<dyn std::fmt::Display>`
78
+
= note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
79
+
= 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>
= note: `impl Trait` as a return type requires that all the returned values must have the same type
96
+
= help: you can instead return a trait object using `Box<dyn std::fmt::Display>`
97
+
= note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
98
+
= 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>
= note: `impl Trait` as a return type requires that all the returned values must have the same type
113
+
= help: you can instead return a trait object using `Box<dyn std::fmt::Display>`
114
+
= note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
115
+
= 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>
0 commit comments