diff options
| author | Esteban Küber <esteban@kuber.com.ar> | 2020-01-14 13:18:06 -0800 |
|---|---|---|
| committer | Esteban Küber <esteban@kuber.com.ar> | 2020-01-16 09:49:13 -0800 |
| commit | 5b36c187dcbb8a4b6555fe046194f2b6deb74230 (patch) | |
| tree | 7f6e24d8dbe27ad654a5cf669e6c9d56f8c10cb2 /src/test/ui | |
| parent | 4a75ef91f37dd0bd5267a852fa05ee0a5547a62b (diff) | |
| download | rust-5b36c187dcbb8a4b6555fe046194f2b6deb74230.tar.gz rust-5b36c187dcbb8a4b6555fe046194f2b6deb74230.zip | |
review comments
Diffstat (limited to 'src/test/ui')
| -rw-r--r-- | src/test/ui/coercion/coerce-expect-unsized-ascribed.stderr | 14 | ||||
| -rw-r--r-- | src/test/ui/const-generics/array-impls/into-iter-no-impls-length-33.stderr | 14 | ||||
| -rw-r--r-- | src/test/ui/destructure-trait-ref.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/destructure-trait-ref.stderr | 10 | ||||
| -rw-r--r-- | src/test/ui/dst/dst-bad-assign-3.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/dst/dst-bad-assign-3.stderr | 2 | ||||
| -rw-r--r-- | src/test/ui/dst/dst-bad-assign.rs | 2 | ||||
| -rw-r--r-- | src/test/ui/dst/dst-bad-assign.stderr | 2 | ||||
| -rw-r--r-- | src/test/ui/error-codes/E0746.stderr | 8 | ||||
| -rw-r--r-- | src/test/ui/impl-trait/dyn-trait-return-should-be-impl-trait.stderr | 38 | ||||
| -rw-r--r-- | src/test/ui/impl-trait/equality.stderr | 2 | ||||
| -rw-r--r-- | src/test/ui/issues/issue-58344.stderr | 4 | ||||
| -rw-r--r-- | src/test/ui/lifetimes/lifetime-elision-return-type-trait.stderr | 2 | ||||
| -rw-r--r-- | src/test/ui/never_type/feature-gate-never_type_fallback.stderr | 2 | ||||
| -rw-r--r-- | src/test/ui/point-to-type-err-cause-on-impl-trait-return.stderr | 12 | ||||
| -rw-r--r-- | src/test/ui/typeck/issue-57673-ice-on-deref-of-boxed-trait.stderr | 2 |
16 files changed, 51 insertions, 67 deletions
diff --git a/src/test/ui/coercion/coerce-expect-unsized-ascribed.stderr b/src/test/ui/coercion/coerce-expect-unsized-ascribed.stderr index 303d83d3426..44e5c6a99f7 100644 --- a/src/test/ui/coercion/coerce-expect-unsized-ascribed.stderr +++ b/src/test/ui/coercion/coerce-expect-unsized-ascribed.stderr @@ -29,7 +29,7 @@ error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:13:13 | LL | let _ = box { |x| (x as u8) }: Box<dyn Fn(i32) -> _>; - | ^^^^^^^^^^^^^^^^^^^^^ expected trait `std::ops::Fn`, found closure + | ^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn std::ops::Fn`, found closure | = note: expected struct `std::boxed::Box<dyn std::ops::Fn(i32) -> u8>` found struct `std::boxed::Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:13:19: 13:32]>` @@ -38,7 +38,7 @@ error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:14:13 | LL | let _ = box if true { false } else { true }: Box<dyn Debug>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait `std::fmt::Debug`, found `bool` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn std::fmt::Debug`, found `bool` | = note: expected struct `std::boxed::Box<dyn std::fmt::Debug>` found struct `std::boxed::Box<bool>` @@ -47,7 +47,7 @@ error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:15:13 | LL | let _ = box match true { true => 'a', false => 'b' }: Box<dyn Debug>; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait `std::fmt::Debug`, found `char` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn std::fmt::Debug`, found `char` | = note: expected struct `std::boxed::Box<dyn std::fmt::Debug>` found struct `std::boxed::Box<char>` @@ -83,7 +83,7 @@ error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:21:13 | LL | let _ = &{ |x| (x as u8) }: &dyn Fn(i32) -> _; - | ^^^^^^^^^^^^^^^^^^ expected trait `std::ops::Fn`, found closure + | ^^^^^^^^^^^^^^^^^^ expected trait object `dyn std::ops::Fn`, found closure | = note: expected reference `&dyn std::ops::Fn(i32) -> u8` found reference `&[closure@$DIR/coerce-expect-unsized-ascribed.rs:21:16: 21:29]` @@ -92,7 +92,7 @@ error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:22:13 | LL | let _ = &if true { false } else { true }: &dyn Debug; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait `std::fmt::Debug`, found `bool` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn std::fmt::Debug`, found `bool` | = note: expected reference `&dyn std::fmt::Debug` found reference `&bool` @@ -101,7 +101,7 @@ error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:23:13 | LL | let _ = &match true { true => 'a', false => 'b' }: &dyn Debug; - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait `std::fmt::Debug`, found `char` + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn std::fmt::Debug`, found `char` | = note: expected reference `&dyn std::fmt::Debug` found reference `&char` @@ -119,7 +119,7 @@ error[E0308]: mismatched types --> $DIR/coerce-expect-unsized-ascribed.rs:26:13 | LL | let _ = Box::new(|x| (x as u8)): Box<dyn Fn(i32) -> _>; - | ^^^^^^^^^^^^^^^^^^^^^^^ expected trait `std::ops::Fn`, found closure + | ^^^^^^^^^^^^^^^^^^^^^^^ expected trait object `dyn std::ops::Fn`, found closure | = note: expected struct `std::boxed::Box<dyn std::ops::Fn(i32) -> _>` found struct `std::boxed::Box<[closure@$DIR/coerce-expect-unsized-ascribed.rs:26:22: 26:35]>` diff --git a/src/test/ui/const-generics/array-impls/into-iter-no-impls-length-33.stderr b/src/test/ui/const-generics/array-impls/into-iter-no-impls-length-33.stderr index e615e10bd5f..4869f483634 100644 --- a/src/test/ui/const-generics/array-impls/into-iter-no-impls-length-33.stderr +++ b/src/test/ui/const-generics/array-impls/into-iter-no-impls-length-33.stderr @@ -13,7 +13,7 @@ LL | pub fn no_iterator() -> impl Iterator<Item = i32> { | ^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[i32; 33]` LL | LL | IntoIter::new([0i32; 33]) - | ------------------------- this returned value is of type `std::array::IntoIter<_, _: usize>` + | ------------------------- this returned value is of type `std::array::IntoIter<i32, 33usize>` | = note: required because of the requirements on the impl of `std::iter::Iterator` for `std::array::IntoIter<i32, 33usize>` = note: the return type of a function must have a statically known size @@ -33,7 +33,7 @@ LL | pub fn no_double_ended_iterator() -> impl DoubleEndedIterator { | ^^^^^^^^^^^^^^^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[i32; 33]` LL | LL | IntoIter::new([0i32; 33]) - | ------------------------- this returned value is of type `std::array::IntoIter<_, _: usize>` + | ------------------------- this returned value is of type `std::array::IntoIter<i32, 33usize>` | = note: required because of the requirements on the impl of `std::iter::DoubleEndedIterator` for `std::array::IntoIter<i32, 33usize>` = note: the return type of a function must have a statically known size @@ -53,7 +53,7 @@ LL | pub fn no_exact_size_iterator() -> impl ExactSizeIterator { | ^^^^^^^^^^^^^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[i32; 33]` LL | LL | IntoIter::new([0i32; 33]) - | ------------------------- this returned value is of type `std::array::IntoIter<_, _: usize>` + | ------------------------- this returned value is of type `std::array::IntoIter<i32, 33usize>` | = note: required because of the requirements on the impl of `std::iter::ExactSizeIterator` for `std::array::IntoIter<i32, 33usize>` = note: the return type of a function must have a statically known size @@ -73,7 +73,7 @@ LL | pub fn no_fused_iterator() -> impl FusedIterator { | ^^^^^^^^^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[i32; 33]` LL | LL | IntoIter::new([0i32; 33]) - | ------------------------- this returned value is of type `std::array::IntoIter<_, _: usize>` + | ------------------------- this returned value is of type `std::array::IntoIter<i32, 33usize>` | = note: required because of the requirements on the impl of `std::iter::FusedIterator` for `std::array::IntoIter<i32, 33usize>` = note: the return type of a function must have a statically known size @@ -93,7 +93,7 @@ LL | pub fn no_trusted_len() -> impl TrustedLen { | ^^^^^^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[i32; 33]` LL | LL | IntoIter::new([0i32; 33]) - | ------------------------- this returned value is of type `std::array::IntoIter<_, _: usize>` + | ------------------------- this returned value is of type `std::array::IntoIter<i32, 33usize>` | = note: required because of the requirements on the impl of `std::iter::TrustedLen` for `std::array::IntoIter<i32, 33usize>` = note: the return type of a function must have a statically known size @@ -113,7 +113,7 @@ LL | pub fn no_clone() -> impl Clone { | ^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[i32; 33]` LL | LL | IntoIter::new([0i32; 33]) - | ------------------------- this returned value is of type `std::array::IntoIter<_, _: usize>` + | ------------------------- this returned value is of type `std::array::IntoIter<i32, 33usize>` | = note: required because of the requirements on the impl of `std::clone::Clone` for `std::array::IntoIter<i32, 33usize>` = note: the return type of a function must have a statically known size @@ -133,7 +133,7 @@ LL | pub fn no_debug() -> impl Debug { | ^^^^^^^^^^ the trait `std::array::LengthAtMost32` is not implemented for `[i32; 33]` LL | LL | IntoIter::new([0i32; 33]) - | ------------------------- this returned value is of type `std::array::IntoIter<_, _: usize>` + | ------------------------- this returned value is of type `std::array::IntoIter<i32, 33usize>` | = note: required because of the requirements on the impl of `std::fmt::Debug` for `std::array::IntoIter<i32, 33usize>` = note: the return type of a function must have a statically known size diff --git a/src/test/ui/destructure-trait-ref.rs b/src/test/ui/destructure-trait-ref.rs index fb92196b2bd..34e7cad935a 100644 --- a/src/test/ui/destructure-trait-ref.rs +++ b/src/test/ui/destructure-trait-ref.rs @@ -33,12 +33,10 @@ fn main() { //~^ ERROR mismatched types //~| expected trait object `dyn T` //~| found reference `&_` - //~| expected trait `T`, found reference let &&&x = &(&1isize as &dyn T); //~^ ERROR mismatched types //~| expected trait object `dyn T` //~| found reference `&_` - //~| expected trait `T`, found reference let box box x = box 1isize as Box<dyn T>; //~^ ERROR mismatched types //~| expected trait object `dyn T` diff --git a/src/test/ui/destructure-trait-ref.stderr b/src/test/ui/destructure-trait-ref.stderr index c78166f411d..f99bf2ffdc9 100644 --- a/src/test/ui/destructure-trait-ref.stderr +++ b/src/test/ui/destructure-trait-ref.stderr @@ -22,31 +22,31 @@ error[E0308]: mismatched types LL | let &&x = &1isize as &dyn T; | ^^ | | - | expected trait `T`, found reference + | expected trait object `dyn T`, found reference | help: you can probably remove the explicit borrow: `x` | = note: expected trait object `dyn T` found reference `&_` error[E0308]: mismatched types - --> $DIR/destructure-trait-ref.rs:37:11 + --> $DIR/destructure-trait-ref.rs:36:11 | LL | let &&&x = &(&1isize as &dyn T); | ^^ | | - | expected trait `T`, found reference + | expected trait object `dyn T`, found reference | help: you can probably remove the explicit borrow: `x` | = note: expected trait object `dyn T` found reference `&_` error[E0308]: mismatched types - --> $DIR/destructure-trait-ref.rs:42:13 + --> $DIR/destructure-trait-ref.rs:40:13 | LL | let box box x = box 1isize as Box<dyn T>; | ^^^^^ ------------------------ this expression has type `std::boxed::Box<dyn T>` | | - | expected trait `T`, found struct `std::boxed::Box` + | expected trait object `dyn T`, found struct `std::boxed::Box` | = note: expected trait object `dyn T` found struct `std::boxed::Box<_>` diff --git a/src/test/ui/dst/dst-bad-assign-3.rs b/src/test/ui/dst/dst-bad-assign-3.rs index e3b621b909a..d05b3937c99 100644 --- a/src/test/ui/dst/dst-bad-assign-3.rs +++ b/src/test/ui/dst/dst-bad-assign-3.rs @@ -32,7 +32,7 @@ pub fn main() { let z: Box<dyn ToBar> = Box::new(Bar1 {f: 36}); f5.2 = Bar1 {f: 36}; //~^ ERROR mismatched types - //~| expected trait `ToBar`, found struct `Bar1` + //~| expected trait object `dyn ToBar`, found struct `Bar1` //~| expected trait object `dyn ToBar` //~| found struct `Bar1` //~| ERROR the size for values of type diff --git a/src/test/ui/dst/dst-bad-assign-3.stderr b/src/test/ui/dst/dst-bad-assign-3.stderr index dc03f38e103..0b6f9df2d83 100644 --- a/src/test/ui/dst/dst-bad-assign-3.stderr +++ b/src/test/ui/dst/dst-bad-assign-3.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/dst-bad-assign-3.rs:33:12 | LL | f5.2 = Bar1 {f: 36}; - | ^^^^^^^^^^^^ expected trait `ToBar`, found struct `Bar1` + | ^^^^^^^^^^^^ expected trait object `dyn ToBar`, found struct `Bar1` | = note: expected trait object `dyn ToBar` found struct `Bar1` diff --git a/src/test/ui/dst/dst-bad-assign.rs b/src/test/ui/dst/dst-bad-assign.rs index ed94242f5bf..496e01ae005 100644 --- a/src/test/ui/dst/dst-bad-assign.rs +++ b/src/test/ui/dst/dst-bad-assign.rs @@ -34,7 +34,7 @@ pub fn main() { let z: Box<dyn ToBar> = Box::new(Bar1 {f: 36}); f5.ptr = Bar1 {f: 36}; //~^ ERROR mismatched types - //~| expected trait `ToBar`, found struct `Bar1` + //~| expected trait object `dyn ToBar`, found struct `Bar1` //~| expected trait object `dyn ToBar` //~| found struct `Bar1` //~| ERROR the size for values of type diff --git a/src/test/ui/dst/dst-bad-assign.stderr b/src/test/ui/dst/dst-bad-assign.stderr index 8031f162482..434c460759f 100644 --- a/src/test/ui/dst/dst-bad-assign.stderr +++ b/src/test/ui/dst/dst-bad-assign.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/dst-bad-assign.rs:35:14 | LL | f5.ptr = Bar1 {f: 36}; - | ^^^^^^^^^^^^ expected trait `ToBar`, found struct `Bar1` + | ^^^^^^^^^^^^ expected trait object `dyn ToBar`, found struct `Bar1` | = note: expected trait object `dyn ToBar` found struct `Bar1` diff --git a/src/test/ui/error-codes/E0746.stderr b/src/test/ui/error-codes/E0746.stderr index 1c88ce64749..e7a8fd304ca 100644 --- a/src/test/ui/error-codes/E0746.stderr +++ b/src/test/ui/error-codes/E0746.stderr @@ -1,23 +1,23 @@ -error[E0746]: return type cannot have a bare trait because it must be `Sized` +error[E0746]: return type cannot have an unboxed trait object --> $DIR/E0746.rs:8:13 | LL | fn foo() -> dyn Trait { Struct } | ^^^^^^^^^ doesn't have a size known at compile-time | = note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits> -help: you can use the `impl Trait` feature in the return type because all the return paths are of type `Struct`, which implements `dyn Trait` +help: return `impl Trait` instead, as all return paths are of type `Struct`, which implements `Trait` | LL | fn foo() -> impl Trait { Struct } | ^^^^^^^^^^ -error[E0746]: return type cannot have a bare trait because it must be `Sized` +error[E0746]: return type cannot have an unboxed trait object --> $DIR/E0746.rs:11:13 | LL | fn bar() -> dyn Trait { | ^^^^^^^^^ doesn't have a size known at compile-time | = note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits> -help: you can use the `impl Trait` feature in the return type because all the return paths are of type `{integer}`, which implements `dyn Trait` +help: return `impl Trait` instead, as all return paths are of type `{integer}`, which implements `Trait` | LL | fn bar() -> impl Trait { | ^^^^^^^^^^ diff --git a/src/test/ui/impl-trait/dyn-trait-return-should-be-impl-trait.stderr b/src/test/ui/impl-trait/dyn-trait-return-should-be-impl-trait.stderr index ff7438e9aff..3d0707c0916 100644 --- a/src/test/ui/impl-trait/dyn-trait-return-should-be-impl-trait.stderr +++ b/src/test/ui/impl-trait/dyn-trait-return-should-be-impl-trait.stderr @@ -2,7 +2,7 @@ error[E0308]: mismatched types --> $DIR/dyn-trait-return-should-be-impl-trait.rs:7:35 | LL | fn fuz() -> (usize, Trait) { (42, Struct) } - | ^^^^^^ expected trait `Trait`, found struct `Struct` + | ^^^^^^ expected trait object `dyn Trait`, found struct `Struct` | = note: expected trait object `(dyn Trait + 'static)` found struct `Struct` @@ -24,7 +24,7 @@ error[E0308]: mismatched types --> $DIR/dyn-trait-return-should-be-impl-trait.rs:10:39 | LL | fn bar() -> (usize, dyn Trait) { (42, Struct) } - | ^^^^^^ expected trait `Trait`, found struct `Struct` + | ^^^^^^ expected trait object `dyn Trait`, found struct `Struct` | = note: expected trait object `(dyn Trait + 'static)` found struct `Struct` @@ -42,26 +42,26 @@ LL | fn bar() -> (usize, dyn Trait) { (42, Struct) } = note: required because it appears within the type `(usize, (dyn Trait + 'static))` = note: the return type of a function must have a statically known size -error[E0746]: return type cannot have a bare trait because it must be `Sized` +error[E0746]: return type cannot have an unboxed trait object --> $DIR/dyn-trait-return-should-be-impl-trait.rs:13:13 | LL | fn bap() -> Trait { Struct } | ^^^^^ doesn't have a size known at compile-time | = note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits> -help: you can use the `impl Trait` feature in the return type because all the return paths are of type `Struct`, which implements `dyn Trait` +help: return `impl Trait` instead, as all return paths are of type `Struct`, which implements `Trait` | LL | fn bap() -> impl Trait { Struct } | ^^^^^^^^^^ -error[E0746]: return type cannot have a bare trait because it must be `Sized` +error[E0746]: return type cannot have an unboxed trait object --> $DIR/dyn-trait-return-should-be-impl-trait.rs:15:13 | LL | fn ban() -> dyn Trait { Struct } | ^^^^^^^^^ doesn't have a size known at compile-time | = note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits> -help: you can use the `impl Trait` feature in the return type because all the return paths are of type `Struct`, which implements `dyn Trait` +help: return `impl Trait` instead, as all return paths are of type `Struct`, which implements `Trait` | LL | fn ban() -> impl Trait { Struct } | ^^^^^^^^^^ @@ -76,40 +76,26 @@ LL | fn bak() -> dyn Trait { unimplemented!() } = note: to learn more, visit <https://doc.rust-lang.org/book/ch19-04-advanced-types.html#dynamically-sized-types-and-the-sized-trait> = note: the return type of a function must have a statically known size -error[E0746]: return type cannot have a bare trait because it must be `Sized` +error[E0746]: return type cannot have an unboxed trait object --> $DIR/dyn-trait-return-should-be-impl-trait.rs:19:13 | LL | fn bal() -> dyn Trait { | ^^^^^^^^^ doesn't have a size known at compile-time | -help: if all the returned values were of the same type you could use `impl Trait` as the return type - --> $DIR/dyn-trait-return-should-be-impl-trait.rs:23:5 - | -LL | return Struct; - | ^^^^^^ -LL | } -LL | 42 - | ^^ - = help: alternatively, you can always create a new `enum` with a variant for each returned type + = note: if trait `Trait` was object safe, you could return a trait object + = note: if all the returned values were of the same type you could use `impl Trait` as the return type = 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> -help: if the performance implications are acceptable, you can return a trait object - | -LL | fn bal() -> Box<dyn Trait> { -LL | if true { -LL | return Box::new(Struct); -LL | } -LL | Box::new(42) - | + = note: you can create a new `enum` with a variant for each returned type -error[E0746]: return type cannot have a bare trait because it must be `Sized` +error[E0746]: return type cannot have an unboxed trait object --> $DIR/dyn-trait-return-should-be-impl-trait.rs:27:13 | LL | fn bat() -> dyn Trait { | ^^^^^^^^^ doesn't have a size known at compile-time | = note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits> -help: you can use the `impl Trait` feature in the return type because all the return paths are of type `{integer}`, which implements `dyn Trait` +help: return `impl Trait` instead, as all return paths are of type `{integer}`, which implements `Trait` | LL | fn bat() -> impl Trait { | ^^^^^^^^^^ diff --git a/src/test/ui/impl-trait/equality.stderr b/src/test/ui/impl-trait/equality.stderr index 215b6d52918..be8653d1689 100644 --- a/src/test/ui/impl-trait/equality.stderr +++ b/src/test/ui/impl-trait/equality.stderr @@ -10,7 +10,7 @@ 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 + = note: to return `impl Trait`, all returned values must be of 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> diff --git a/src/test/ui/issues/issue-58344.stderr b/src/test/ui/issues/issue-58344.stderr index 9b07dbd7ab6..e0c196e518b 100644 --- a/src/test/ui/issues/issue-58344.stderr +++ b/src/test/ui/issues/issue-58344.stderr @@ -5,7 +5,7 @@ LL | ) -> Either<impl Trait<<u32 as Add<u32>>::Output>, impl Trait<<u32 as Add<u | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait<u32>` is not implemented for `impl Trait<<u32 as std::ops::Add>::Output>` ... LL | add_generic(value, 1u32) - | ------------------------ this returned value is of type `Either<impl Trait<<_ as std::ops::Add<_>>::Output>, impl Trait<<_ as std::ops::Add<_>>::Output>>` + | ------------------------ this returned value is of type `Either<impl Trait<<u32 as std::ops::Add>::Output>, impl Trait<<u32 as std::ops::Add>::Output>>` | = note: the return type of a function must have a statically known size @@ -16,7 +16,7 @@ LL | ) -> Either<impl Trait<<u32 as Add<u32>>::Output>, impl Trait<<u32 as Add<u | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Trait<u32>` is not implemented for `impl Trait<<u32 as std::ops::Add>::Output>` ... LL | add_generic(value, 1u32) - | ------------------------ this returned value is of type `Either<impl Trait<<_ as std::ops::Add<_>>::Output>, impl Trait<<_ as std::ops::Add<_>>::Output>>` + | ------------------------ this returned value is of type `Either<impl Trait<<u32 as std::ops::Add>::Output>, impl Trait<<u32 as std::ops::Add>::Output>>` | = note: the return type of a function must have a statically known size diff --git a/src/test/ui/lifetimes/lifetime-elision-return-type-trait.stderr b/src/test/ui/lifetimes/lifetime-elision-return-type-trait.stderr index 49fa11c35ae..e43fb6d0edf 100644 --- a/src/test/ui/lifetimes/lifetime-elision-return-type-trait.stderr +++ b/src/test/ui/lifetimes/lifetime-elision-return-type-trait.stderr @@ -5,7 +5,7 @@ LL | fn foo() -> impl Future<Item=(), Error=Box<dyn Error>> { | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `Future` is not implemented for `std::result::Result<(), _>` LL | LL | Ok(()) - | ------ this returned value is of type `std::result::Result<_, _>` + | ------ this returned value is of type `std::result::Result<(), _>` | = note: the return type of a function must have a statically known size diff --git a/src/test/ui/never_type/feature-gate-never_type_fallback.stderr b/src/test/ui/never_type/feature-gate-never_type_fallback.stderr index 88bfed2b547..77288f1bada 100644 --- a/src/test/ui/never_type/feature-gate-never_type_fallback.stderr +++ b/src/test/ui/never_type/feature-gate-never_type_fallback.stderr @@ -5,7 +5,7 @@ LL | fn should_ret_unit() -> impl T { | ^^^^^^ the trait `T` is not implemented for `()` LL | LL | panic!() - | -------- this returned value is of type `_` + | -------- this returned value is of type `()` | = note: the return type of a function must have a statically known size = note: this error originates in a macro outside of the current crate (in Nightly builds, run with -Z external-macro-backtrace for more info) diff --git a/src/test/ui/point-to-type-err-cause-on-impl-trait-return.stderr b/src/test/ui/point-to-type-err-cause-on-impl-trait-return.stderr index 9db5250e4d8..2c0425e718a 100644 --- a/src/test/ui/point-to-type-err-cause-on-impl-trait-return.stderr +++ b/src/test/ui/point-to-type-err-cause-on-impl-trait-return.stderr @@ -10,7 +10,7 @@ LL | } LL | 1u32 | ^^^^ expected `i32`, found `u32` | - = note: `impl Trait` as a return type requires that all the returned values must have the same type + = note: to return `impl Trait`, all returned values must be of the same type = help: you can instead return a trait object using `Box<dyn std::fmt::Display>` = 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> @@ -27,7 +27,7 @@ LL | } else { LL | return 1u32; | ^^^^ expected `i32`, found `u32` | - = note: `impl Trait` as a return type requires that all the returned values must have the same type + = note: to return `impl Trait`, all returned values must be of the same type = help: you can instead return a trait object using `Box<dyn std::fmt::Display>` = 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> @@ -44,7 +44,7 @@ LL | } else { LL | 1u32 | ^^^^ expected `i32`, found `u32` | - = note: `impl Trait` as a return type requires that all the returned values must have the same type + = note: to return `impl Trait`, all returned values must be of the same type = help: you can instead return a trait object using `Box<dyn std::fmt::Display>` = 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> @@ -73,7 +73,7 @@ LL | 0 => return 0i32, LL | _ => 1u32, | ^^^^ expected `i32`, found `u32` | - = note: `impl Trait` as a return type requires that all the returned values must have the same type + = note: to return `impl Trait`, all returned values must be of the same type = help: you can instead return a trait object using `Box<dyn std::fmt::Display>` = 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> @@ -92,7 +92,7 @@ LL | | _ => 2u32, LL | | } | |_____^ expected `i32`, found `u32` | - = note: `impl Trait` as a return type requires that all the returned values must have the same type + = note: to return `impl Trait`, all returned values must be of the same type = help: you can instead return a trait object using `Box<dyn std::fmt::Display>` = 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> @@ -109,7 +109,7 @@ LL | return 0i32; LL | 1u32 | ^^^^ expected `i32`, found `u32` | - = note: `impl Trait` as a return type requires that all the returned values must have the same type + = note: to return `impl Trait`, all returned values must be of the same type = help: you can instead return a trait object using `Box<dyn std::fmt::Display>` = 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> diff --git a/src/test/ui/typeck/issue-57673-ice-on-deref-of-boxed-trait.stderr b/src/test/ui/typeck/issue-57673-ice-on-deref-of-boxed-trait.stderr index 14c09ade7dd..a656b20c23e 100644 --- a/src/test/ui/typeck/issue-57673-ice-on-deref-of-boxed-trait.stderr +++ b/src/test/ui/typeck/issue-57673-ice-on-deref-of-boxed-trait.stderr @@ -4,7 +4,7 @@ error[E0308]: mismatched types LL | fn ice(x: Box<dyn Iterator<Item=()>>) { | - possibly return type missing here? LL | *x - | ^^ expected `()`, found trait `std::iter::Iterator` + | ^^ expected `()`, found trait object `dyn std::iter::Iterator` | = note: expected unit type `()` found trait object `(dyn std::iter::Iterator<Item = ()> + 'static)` |
