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
@@ -12,7 +12,7 @@ LL | 0_u32
12
12
|
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
-
= help: you can instead return a trait object using `Box<dyn Foo>`
15
+
= help: if the trait `Foo` 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
17
= help: alternatively, create a new `enum` with a variant for each returned type
| ------------------ expected because this return type...
6
+
LL | if true {
7
+
LL | return A;
8
+
| - ...is found to be `A` here
9
+
LL | }
10
+
LL | B
11
+
| ^ expected struct `A`, found struct `B`
12
+
|
13
+
= note: to return `impl Trait`, all returned values must be of the same type
14
+
= note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
15
+
= help: if the trait `NotObjectSafe` were object safe, you could return a boxed trait object
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
| --------------- expected because this return type...
24
+
LL | if true {
25
+
LL | return A;
26
+
| - ...is found to be `A` here
27
+
LL | }
28
+
LL | B
29
+
| ^ expected struct `A`, found struct `B`
30
+
|
31
+
= note: to return `impl Trait`, all returned values must be of the same type
32
+
= note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
33
+
= help: you can instead return a boxed trait object using `Box<dyn ObjectSafe>`
34
+
= 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>
35
+
= help: alternatively, create a new `enum` with a variant for each returned type
36
+
37
+
error: aborting due to 2 previous errors
38
+
39
+
For more information about this error, try `rustc --explain E0308`.
Copy file name to clipboardexpand all lines: src/test/ui/point-to-type-err-cause-on-impl-trait-return.stderr
+6-6
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ LL | 1u32
12
12
|
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
-
= help: you can instead return a trait object using `Box<dyn std::fmt::Display>`
15
+
= help: you can instead return a boxed trait object using `Box<dyn std::fmt::Display>`
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
17
= help: alternatively, create a new `enum` with a variant for each returned type
18
18
@@ -30,7 +30,7 @@ LL | return 1u32;
30
30
|
31
31
= 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
-
= help: you can instead return a trait object using `Box<dyn std::fmt::Display>`
33
+
= help: you can instead return a boxed trait object using `Box<dyn std::fmt::Display>`
34
34
= 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>
35
35
= help: alternatively, create a new `enum` with a variant for each returned type
36
36
@@ -48,7 +48,7 @@ LL | 1u32
48
48
|
49
49
= note: to return `impl Trait`, all returned values must be of the same type
50
50
= note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
51
-
= help: you can instead return a trait object using `Box<dyn std::fmt::Display>`
51
+
= help: you can instead return a boxed trait object using `Box<dyn std::fmt::Display>`
52
52
= 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>
53
53
= help: alternatively, create a new `enum` with a variant for each returned type
54
54
@@ -78,7 +78,7 @@ LL | _ => 1u32,
78
78
|
79
79
= note: to return `impl Trait`, all returned values must be of the same type
80
80
= note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
81
-
= help: you can instead return a trait object using `Box<dyn std::fmt::Display>`
81
+
= help: you can instead return a boxed trait object using `Box<dyn std::fmt::Display>`
82
82
= 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>
83
83
= help: alternatively, create a new `enum` with a variant for each returned type
84
84
@@ -98,7 +98,7 @@ LL | | }
98
98
|
99
99
= note: to return `impl Trait`, all returned values must be of the same type
100
100
= note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
101
-
= help: you can instead return a trait object using `Box<dyn std::fmt::Display>`
101
+
= help: you can instead return a boxed trait object using `Box<dyn std::fmt::Display>`
102
102
= 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>
103
103
= help: alternatively, create a new `enum` with a variant for each returned type
104
104
@@ -116,7 +116,7 @@ LL | 1u32
116
116
|
117
117
= note: to return `impl Trait`, all returned values must be of the same type
118
118
= note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
119
-
= help: you can instead return a trait object using `Box<dyn std::fmt::Display>`
119
+
= help: you can instead return a boxed trait object using `Box<dyn std::fmt::Display>`
120
120
= 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>
121
121
= help: alternatively, create a new `enum` with a variant for each returned type
0 commit comments