fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #69854 - pietroalbini:stable-next, r=Centrilb8cedc00407

1.42.0
1.3 KiB30 linesraw
1error[E0308]: mismatched types
2  --> $DIR/equality.rs:15:5
3   |
4LL | fn two(x: bool) -> impl Foo {
5   |                    -------- expected because this return type...
6LL |     if x {
7LL |         return 1_i32;
8   |                ----- ...is found to be `i32` here
9LL |     }
10LL |     0_u32
11   |     ^^^^^ expected `i32`, found `u32`
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 `Foo` 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
18
19error[E0277]: cannot add `impl Foo` to `u32`
20  --> $DIR/equality.rs:24:11
21   |
22LL |         n + sum_to(n - 1)
23   |           ^ no implementation for `u32 + impl Foo`
24   |
25   = help: the trait `std::ops::Add<impl Foo>` is not implemented for `u32`
26
27error: aborting due to 2 previous errors
28
29Some errors have detailed explanations: E0277, E0308.
30For more information about an error, try `rustc --explain E0277`.