diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2020-01-13 13:14:11 -0800 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2020-01-16 09:37:24 -0800 |
| commit | 75eabb17aec390fd91b5bf11539012e4fc7307b7 (patch) | |
| tree | de95b689608968a0e6f7172798d6f4b2b9b7527a /src/test/ui/impl-trait | |
| parent | 6fd564112f1ec00f6f8a56e8a3577dd255639131 (diff) | |
| download | rust-75eabb17aec390fd91b5bf11539012e4fc7307b7.tar.gz rust-75eabb17aec390fd91b5bf11539012e4fc7307b7.zip | |
Account for diverging types in return `impl Trait`
Diffstat (limited to 'src/test/ui/impl-trait')
| -rw-r--r-- | src/test/ui/impl-trait/equality.stderr | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/test/ui/impl-trait/equality.stderr b/src/test/ui/impl-trait/equality.stderr index e53524e58d6..215b6d52918 100644 --- a/src/test/ui/impl-trait/equality.stderr +++ b/src/test/ui/impl-trait/equality.stderr @@ -9,6 +9,11 @@ LL | return 1_i32; LL | } LL | 0_u32 | ^^^^^ expected `i32`, found `u32` + | + = note: `impl Trait` as a return type requires that all the returned values must have the same type + = help: you can instead return a trait object using `Box<dyn Foo>` + = note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits> + = 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> error[E0277]: cannot add `impl Foo` to `u32` --> $DIR/equality.rs:24:11 |
