Skip to content

Commit 3fdf3cb

Browse files
Adjust wording
1 parent 750f04d commit 3fdf3cb

25 files changed

+77
-68
lines changed

compiler/rustc_trait_selection/src/traits/error_reporting/mod.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1626,16 +1626,16 @@ impl<'a, 'tcx> InferCtxtPrivExt<'a, 'tcx> for InferCtxt<'a, 'tcx> {
16261626

16271627
if Some(pred.projection_ty.item_def_id) == self.tcx.lang_items().fn_once_output() {
16281628
Some(format!(
1629-
"expected `{self_ty}` to be a {fn_kind} that returns `{expected_ty}`, but it actually returns `{normalized_ty}`",
1629+
"expected `{self_ty}` to be a {fn_kind} that returns `{expected_ty}`, but it returns `{normalized_ty}`",
16301630
fn_kind = self_ty.prefix_string(self.tcx)
16311631
))
16321632
} else if Some(trait_def_id) == self.tcx.lang_items().future_trait() {
16331633
Some(format!(
1634-
"expected `{self_ty}` to be a future that yields `{expected_ty}`, but it actually yields `{normalized_ty}`"
1634+
"expected `{self_ty}` to be a future that resolves to `{expected_ty}`, but it resolves to `{normalized_ty}`"
16351635
))
16361636
} else if Some(trait_def_id) == self.tcx.get_diagnostic_item(sym::Iterator) {
16371637
Some(format!(
1638-
"expected `{self_ty}` to be an iterator of `{expected_ty}`, but it actually returns items of `{normalized_ty}`"
1638+
"expected `{self_ty}` to be an iterator that yields `{expected_ty}`, but it yields `{normalized_ty}`"
16391639
))
16401640
} else {
16411641
None

src/test/ui/associated-types/associated-types-overridden-binding-2.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ trait I32Iterator = Iterator<Item = i32>;
44

55
fn main() {
66
let _: &dyn I32Iterator<Item = u32> = &vec![42].into_iter();
7-
//~^ ERROR expected `std::vec::IntoIter<u32>` to be an iterator of `i32`, but it actually returns items of `u32`
7+
//~^ ERROR expected `std::vec::IntoIter<u32>` to be an iterator that yields `i32`, but it yields `u32`
88
}

src/test/ui/associated-types/associated-types-overridden-binding-2.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0271]: expected `std::vec::IntoIter<u32>` to be an iterator of `i32`, but it actually returns items of `u32`
1+
error[E0271]: expected `std::vec::IntoIter<u32>` to be an iterator that yields `i32`, but it yields `u32`
22
--> $DIR/associated-types-overridden-binding-2.rs:6:43
33
|
44
LL | let _: &dyn I32Iterator<Item = u32> = &vec![42].into_iter();

src/test/ui/async-await/async-block-control-flow-static-semantics.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ fn return_targets_async_block_not_fn() -> u8 {
1515
return 0u8;
1616
};
1717
let _: &dyn Future<Output = ()> = &block;
18-
//~^ ERROR expected `impl Future<Output = u8>` to be a future that yields `()`, but it actually yields `u8`
18+
//~^ ERROR expected `impl Future<Output = u8>` to be a future that resolves to `()`, but it resolves to `u8`
1919
}
2020

2121
async fn return_targets_async_block_not_async_fn() -> u8 {
@@ -24,7 +24,7 @@ async fn return_targets_async_block_not_async_fn() -> u8 {
2424
return 0u8;
2525
};
2626
let _: &dyn Future<Output = ()> = &block;
27-
//~^ ERROR expected `impl Future<Output = u8>` to be a future that yields `()`, but it actually yields `u8`
27+
//~^ ERROR expected `impl Future<Output = u8>` to be a future that resolves to `()`, but it resolves to `u8`
2828
}
2929

3030
fn no_break_in_async_block() {
@@ -42,7 +42,9 @@ fn no_break_in_async_block_even_with_outer_loop() {
4242
}
4343

4444
struct MyErr;
45-
fn err() -> Result<u8, MyErr> { Err(MyErr) }
45+
fn err() -> Result<u8, MyErr> {
46+
Err(MyErr)
47+
}
4648

4749
fn rethrow_targets_async_block_not_fn() -> Result<u8, MyErr> {
4850
//~^ ERROR mismatched types

src/test/ui/async-await/async-block-control-flow-static-semantics.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ LL | |
3131
LL | | }
3232
| |_^ expected `u8`, found `()`
3333

34-
error[E0271]: expected `impl Future<Output = u8>` to be a future that yields `()`, but it actually yields `u8`
34+
error[E0271]: expected `impl Future<Output = u8>` to be a future that resolves to `()`, but it resolves to `u8`
3535
--> $DIR/async-block-control-flow-static-semantics.rs:26:39
3636
|
3737
LL | let _: &dyn Future<Output = ()> = &block;
@@ -47,7 +47,7 @@ LL | fn return_targets_async_block_not_fn() -> u8 {
4747
| |
4848
| implicitly returns `()` as its body has no tail or `return` expression
4949

50-
error[E0271]: expected `impl Future<Output = u8>` to be a future that yields `()`, but it actually yields `u8`
50+
error[E0271]: expected `impl Future<Output = u8>` to be a future that resolves to `()`, but it resolves to `u8`
5151
--> $DIR/async-block-control-flow-static-semantics.rs:17:39
5252
|
5353
LL | let _: &dyn Future<Output = ()> = &block;
@@ -56,7 +56,7 @@ LL | let _: &dyn Future<Output = ()> = &block;
5656
= note: required for the cast from `impl Future<Output = u8>` to the object type `dyn Future<Output = ()>`
5757

5858
error[E0308]: mismatched types
59-
--> $DIR/async-block-control-flow-static-semantics.rs:47:44
59+
--> $DIR/async-block-control-flow-static-semantics.rs:49:44
6060
|
6161
LL | fn rethrow_targets_async_block_not_fn() -> Result<u8, MyErr> {
6262
| ---------------------------------- ^^^^^^^^^^^^^^^^^ expected enum `Result`, found `()`
@@ -67,7 +67,7 @@ LL | fn rethrow_targets_async_block_not_fn() -> Result<u8, MyErr> {
6767
found unit type `()`
6868

6969
error[E0308]: mismatched types
70-
--> $DIR/async-block-control-flow-static-semantics.rs:56:50
70+
--> $DIR/async-block-control-flow-static-semantics.rs:58:50
7171
|
7272
LL | fn rethrow_targets_async_block_not_async_fn() -> Result<u8, MyErr> {
7373
| ---------------------------------------- ^^^^^^^^^^^^^^^^^ expected enum `Result`, found `()`

src/test/ui/hrtb/issue-62203-hrtb-ice.rs

+7-3
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,13 @@ fn main() {
3838
let v = Unit2.m(
3939
//~^ ERROR type mismatch
4040
L {
41-
//~^ ERROR to be a closure that returns `Unit3`, but it actually returns `Unit4`
42-
f : |x| { drop(x); Unit4 }
43-
});
41+
//~^ ERROR to be a closure that returns `Unit3`, but it returns `Unit4`
42+
f: |x| {
43+
drop(x);
44+
Unit4
45+
},
46+
},
47+
);
4448
}
4549

4650
impl<'a> Ty<'a> for Unit2 {

src/test/ui/hrtb/issue-62203-hrtb-ice.stderr

+9-6
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error[E0271]: type mismatch resolving `for<'r> <L<[closure@$DIR/issue-62203-hrtb-ice.rs:42:17: 42:20]> as T0<'r, (&'r u8,)>>::O == <_ as Ty<'r>>::V`
1+
error[E0271]: type mismatch resolving `for<'r> <L<[closure@$DIR/issue-62203-hrtb-ice.rs:42:16: 42:19]> as T0<'r, (&'r u8,)>>::O == <_ as Ty<'r>>::V`
22
--> $DIR/issue-62203-hrtb-ice.rs:38:19
33
|
44
LL | let v = Unit2.m(
5-
| ^ type mismatch resolving `for<'r> <L<[closure@$DIR/issue-62203-hrtb-ice.rs:42:17: 42:20]> as T0<'r, (&'r u8,)>>::O == <_ as Ty<'r>>::V`
5+
| ^ type mismatch resolving `for<'r> <L<[closure@$DIR/issue-62203-hrtb-ice.rs:42:16: 42:19]> as T0<'r, (&'r u8,)>>::O == <_ as Ty<'r>>::V`
66
|
77
note: expected this to be `<_ as Ty<'_>>::V`
88
--> $DIR/issue-62203-hrtb-ice.rs:21:14
@@ -22,19 +22,22 @@ LL | where
2222
LL | F: for<'r> T0<'r, (<Self as Ty<'r>>::V,), O = <B as Ty<'r>>::V>,
2323
| ^^^^^^^^^^^^^^^^^^^^ required by this bound in `T1::m`
2424

25-
error[E0271]: expected `[closure@$DIR/issue-62203-hrtb-ice.rs:42:17: 42:20]` to be a closure that returns `Unit3`, but it actually returns `Unit4`
25+
error[E0271]: expected `[closure@$DIR/issue-62203-hrtb-ice.rs:42:16: 42:19]` to be a closure that returns `Unit3`, but it returns `Unit4`
2626
--> $DIR/issue-62203-hrtb-ice.rs:40:9
2727
|
2828
LL | let v = Unit2.m(
2929
| - required by a bound introduced by this call
3030
LL |
3131
LL | / L {
3232
LL | |
33-
LL | | f : |x| { drop(x); Unit4 }
34-
LL | | });
33+
LL | | f: |x| {
34+
LL | | drop(x);
35+
LL | | Unit4
36+
LL | | },
37+
LL | | },
3538
| |_________^ expected struct `Unit3`, found struct `Unit4`
3639
|
37-
note: required because of the requirements on the impl of `for<'r> T0<'r, (&'r u8,)>` for `L<[closure@$DIR/issue-62203-hrtb-ice.rs:42:17: 42:20]>`
40+
note: required because of the requirements on the impl of `for<'r> T0<'r, (&'r u8,)>` for `L<[closure@$DIR/issue-62203-hrtb-ice.rs:42:16: 42:19]>`
3841
--> $DIR/issue-62203-hrtb-ice.rs:17:16
3942
|
4043
LL | impl<'a, A, T> T0<'a, A> for L<T>

src/test/ui/impl-trait/issues/issue-78722.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ type F = impl core::future::Future<Output = u8>;
77
struct Bug {
88
V1: [(); {
99
fn concrete_use() -> F {
10-
//~^ ERROR expected `impl Future<Output = ()>` to be a future that yields `u8`, but it actually yields `()`
10+
//~^ ERROR expected `impl Future<Output = ()>` to be a future that resolves to `u8`, but it resolves to `()`
1111
async {}
1212
}
1313
let f: F = async { 1 };

src/test/ui/impl-trait/issues/issue-78722.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ LL | let f: F = async { 1 };
1616
LL | }],
1717
| - value is dropped here
1818

19-
error[E0271]: expected `impl Future<Output = ()>` to be a future that yields `u8`, but it actually yields `()`
19+
error[E0271]: expected `impl Future<Output = ()>` to be a future that resolves to `u8`, but it resolves to `()`
2020
--> $DIR/issue-78722.rs:9:30
2121
|
2222
LL | fn concrete_use() -> F {

src/test/ui/intrinsics/const-eval-select-bad.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ fn baz(n: bool) -> i32 {
2727

2828
const fn return_ty_mismatch() {
2929
const_eval_select((1,), foo, bar);
30-
//~^ ERROR expected `fn(i32) -> bool {bar}` to be a fn item that returns `i32`, but it actually returns `bool`
30+
//~^ ERROR expected `fn(i32) -> bool {bar}` to be a fn item that returns `i32`, but it returns `bool`
3131
}
3232

3333
const fn args_ty_mismatch() {

src/test/ui/intrinsics/const-eval-select-bad.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ note: required by a bound in `const_eval_select`
5151
LL | G: FnOnce<ARG, Output = RET> + ~const Destruct,
5252
| ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `const_eval_select`
5353

54-
error[E0271]: expected `fn(i32) -> bool {bar}` to be a fn item that returns `i32`, but it actually returns `bool`
54+
error[E0271]: expected `fn(i32) -> bool {bar}` to be a fn item that returns `i32`, but it returns `bool`
5555
--> $DIR/const-eval-select-bad.rs:29:5
5656
|
5757
LL | const_eval_select((1,), foo, bar);

src/test/ui/issues/issue-31173.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ use std::vec::IntoIter;
33
pub fn get_tok(it: &mut IntoIter<u8>) {
44
let mut found_e = false;
55

6-
let temp: Vec<u8> = it.take_while(|&x| {
7-
found_e = true;
8-
false
9-
})
6+
let temp: Vec<u8> = it
7+
.take_while(|&x| {
8+
found_e = true;
9+
false
10+
})
1011
.cloned()
11-
//~^ ERROR to be an iterator of `&_`, but it actually returns items of `u8`
12+
//~^ ERROR to be an iterator that yields `&_`, but it yields `u8`
1213
.collect(); //~ ERROR the method
1314
}
1415

src/test/ui/issues/issue-31173.stderr

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
error[E0271]: expected `TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 6:43]>` to be an iterator of `&_`, but it actually returns items of `u8`
2-
--> $DIR/issue-31173.rs:10:10
1+
error[E0271]: expected `TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:7:21: 7:25]>` to be an iterator that yields `&_`, but it yields `u8`
2+
--> $DIR/issue-31173.rs:11:10
33
|
44
LL | .cloned()
55
| ^^^^^^ expected reference, found `u8`
@@ -12,11 +12,11 @@ note: required by a bound in `cloned`
1212
LL | Self: Sized + Iterator<Item = &'a T>,
1313
| ^^^^^^^^^^^^ required by this bound in `cloned`
1414

15-
error[E0599]: the method `collect` exists for struct `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 6:43]>>`, but its trait bounds were not satisfied
16-
--> $DIR/issue-31173.rs:12:10
15+
error[E0599]: the method `collect` exists for struct `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:7:21: 7:25]>>`, but its trait bounds were not satisfied
16+
--> $DIR/issue-31173.rs:13:10
1717
|
1818
LL | .collect();
19-
| ^^^^^^^ method cannot be called on `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 6:43]>>` due to unsatisfied trait bounds
19+
| ^^^^^^^ method cannot be called on `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:7:21: 7:25]>>` due to unsatisfied trait bounds
2020
|
2121
::: $SRC_DIR/core/src/iter/adapters/cloned.rs:LL:COL
2222
|
@@ -29,10 +29,10 @@ LL | pub struct TakeWhile<I, P> {
2929
| -------------------------- doesn't satisfy `<_ as Iterator>::Item = &_`
3030
|
3131
= note: the following trait bounds were not satisfied:
32-
`<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 6:43]> as Iterator>::Item = &_`
33-
which is required by `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 6:43]>>: Iterator`
34-
`Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 6:43]>>: Iterator`
35-
which is required by `&mut Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:6:39: 6:43]>>: Iterator`
32+
`<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:7:21: 7:25]> as Iterator>::Item = &_`
33+
which is required by `Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:7:21: 7:25]>>: Iterator`
34+
`Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:7:21: 7:25]>>: Iterator`
35+
which is required by `&mut Cloned<TakeWhile<&mut std::vec::IntoIter<u8>, [closure@$DIR/issue-31173.rs:7:21: 7:25]>>: Iterator`
3636

3737
error: aborting due to 2 previous errors
3838

src/test/ui/issues/issue-33941.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
use std::collections::HashMap;
44

55
fn main() {
6-
for _ in HashMap::new().iter().cloned() {} //~ ERROR expected `std::collections::hash_map::Iter<'_, _, _>` to be an iterator of `&_`, but it actually returns items of `(&_, &_)`
7-
//~^ ERROR expected `std::collections::hash_map::Iter<'_, _, _>` to be an iterator of `&_`, but it actually returns items of `(&_, &_)`
8-
//~| ERROR expected `std::collections::hash_map::Iter<'_, _, _>` to be an iterator of `&_`, but it actually returns items of `(&_, &_)`
6+
for _ in HashMap::new().iter().cloned() {} //~ ERROR expected `std::collections::hash_map::Iter<'_, _, _>` to be an iterator that yields `&_`, but it yields `(&_, &_)`
7+
//~^ ERROR expected `std::collections::hash_map::Iter<'_, _, _>` to be an iterator that yields `&_`, but it yields `(&_, &_)`
8+
//~| ERROR expected `std::collections::hash_map::Iter<'_, _, _>` to be an iterator that yields `&_`, but it yields `(&_, &_)`
99
}

src/test/ui/issues/issue-33941.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0271]: expected `std::collections::hash_map::Iter<'_, _, _>` to be an iterator of `&_`, but it actually returns items of `(&_, &_)`
1+
error[E0271]: expected `std::collections::hash_map::Iter<'_, _, _>` to be an iterator that yields `&_`, but it yields `(&_, &_)`
22
--> $DIR/issue-33941.rs:6:36
33
|
44
LL | for _ in HashMap::new().iter().cloned() {}
@@ -12,7 +12,7 @@ note: required by a bound in `cloned`
1212
LL | Self: Sized + Iterator<Item = &'a T>,
1313
| ^^^^^^^^^^^^ required by this bound in `cloned`
1414

15-
error[E0271]: expected `std::collections::hash_map::Iter<'_, _, _>` to be an iterator of `&_`, but it actually returns items of `(&_, &_)`
15+
error[E0271]: expected `std::collections::hash_map::Iter<'_, _, _>` to be an iterator that yields `&_`, but it yields `(&_, &_)`
1616
--> $DIR/issue-33941.rs:6:14
1717
|
1818
LL | for _ in HashMap::new().iter().cloned() {}
@@ -23,7 +23,7 @@ LL | for _ in HashMap::new().iter().cloned() {}
2323
= note: required because of the requirements on the impl of `Iterator` for `Cloned<std::collections::hash_map::Iter<'_, _, _>>`
2424
= note: required because of the requirements on the impl of `IntoIterator` for `Cloned<std::collections::hash_map::Iter<'_, _, _>>`
2525

26-
error[E0271]: expected `std::collections::hash_map::Iter<'_, _, _>` to be an iterator of `&_`, but it actually returns items of `(&_, &_)`
26+
error[E0271]: expected `std::collections::hash_map::Iter<'_, _, _>` to be an iterator that yields `&_`, but it yields `(&_, &_)`
2727
--> $DIR/issue-33941.rs:6:14
2828
|
2929
LL | for _ in HashMap::new().iter().cloned() {}

src/test/ui/never_type/fallback-closure-wrap.fallback.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0271]: expected `[closure@$DIR/fallback-closure-wrap.rs:18:40: 18:47]` to be a closure that returns `()`, but it actually returns `!`
1+
error[E0271]: expected `[closure@$DIR/fallback-closure-wrap.rs:18:40: 18:47]` to be a closure that returns `()`, but it returns `!`
22
--> $DIR/fallback-closure-wrap.rs:18:31
33
|
44
LL | let error = Closure::wrap(Box::new(move || {

src/test/ui/never_type/fallback-closure-wrap.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ use std::marker::PhantomData;
1616

1717
fn main() {
1818
let error = Closure::wrap(Box::new(move || {
19-
//[fallback]~^ to be a closure that returns `()`, but it actually returns `!`
19+
//[fallback]~^ to be a closure that returns `()`, but it returns `!`
2020
panic!("Can't connect to server.");
2121
}) as Box<dyn FnMut()>);
2222
}

src/test/ui/traits/assoc-type-in-superbad.rs

+3-4
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@
44

55
use std::vec::IntoIter;
66

7-
pub trait Foo: Iterator<Item=<Self as Foo>::Key> {
7+
pub trait Foo: Iterator<Item = <Self as Foo>::Key> {
88
type Key;
99
}
1010

1111
impl Foo for IntoIter<i32> {
1212
type Key = u32;
13-
//~^ ERROR expected `std::vec::IntoIter<i32>` to be an iterator of `u32`, but it actually returns items of `i32`
13+
//~^ ERROR expected `std::vec::IntoIter<i32>` to be an iterator that yields `u32`, but it yields `i32`
1414
}
1515

16-
fn main() {
17-
}
16+
fn main() {}

src/test/ui/traits/assoc-type-in-superbad.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0271]: expected `std::vec::IntoIter<i32>` to be an iterator of `u32`, but it actually returns items of `i32`
1+
error[E0271]: expected `std::vec::IntoIter<i32>` to be an iterator that yields `u32`, but it yields `i32`
22
--> $DIR/assoc-type-in-superbad.rs:12:16
33
|
44
LL | type Key = u32;
@@ -7,8 +7,8 @@ LL | type Key = u32;
77
note: required by a bound in `Foo`
88
--> $DIR/assoc-type-in-superbad.rs:7:25
99
|
10-
LL | pub trait Foo: Iterator<Item=<Self as Foo>::Key> {
11-
| ^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Foo`
10+
LL | pub trait Foo: Iterator<Item = <Self as Foo>::Key> {
11+
| ^^^^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `Foo`
1212

1313
error: aborting due to previous error
1414

src/test/ui/type-alias-impl-trait/issue-57961.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ trait Foo {
88

99
impl Foo for () {
1010
type Bar = std::vec::IntoIter<u32>;
11-
//~^ ERROR expected `std::vec::IntoIter<u32>` to be an iterator of `X`, but it actually returns items of `u32`
11+
//~^ ERROR expected `std::vec::IntoIter<u32>` to be an iterator that yields `X`, but it yields `u32`
1212
}
1313

1414
fn incoherent() {

src/test/ui/type-alias-impl-trait/issue-57961.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0271]: expected `std::vec::IntoIter<u32>` to be an iterator of `X`, but it actually returns items of `u32`
1+
error[E0271]: expected `std::vec::IntoIter<u32>` to be an iterator that yields `X`, but it yields `u32`
22
--> $DIR/issue-57961.rs:10:16
33
|
44
LL | type X = impl Sized;
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
// edition:2018
22

3-
type AsyncFnPtr = Box<
4-
dyn Fn() -> std::pin::Pin<Box<dyn std::future::Future<Output = ()>>>,
5-
>;
3+
type AsyncFnPtr = Box<dyn Fn() -> std::pin::Pin<Box<dyn std::future::Future<Output = ()>>>>;
64

75
async fn test() {}
86

97
#[allow(unused_must_use)]
108
fn main() {
119
Box::new(test) as AsyncFnPtr;
12-
//~^ ERROR expected `fn() -> impl Future<Output = ()> {test}` to be a fn item that returns `Pin<Box<(dyn Future<Output = ()> + 'static)>>`, but it actually returns `impl Future<Output = ()>`
10+
//~^ ERROR expected `fn() -> impl Future<Output = ()> {test}` to be a fn item that returns `Pin<Box<(dyn Future<Output = ()> + 'static)>>`, but it returns `impl Future<Output = ()>`
1311
}

src/test/ui/type-alias-impl-trait/issue-98604.stderr

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
error[E0271]: expected `fn() -> impl Future<Output = ()> {test}` to be a fn item that returns `Pin<Box<(dyn Future<Output = ()> + 'static)>>`, but it actually returns `impl Future<Output = ()>`
2-
--> $DIR/issue-98604.rs:11:5
1+
error[E0271]: expected `fn() -> impl Future<Output = ()> {test}` to be a fn item that returns `Pin<Box<(dyn Future<Output = ()> + 'static)>>`, but it returns `impl Future<Output = ()>`
2+
--> $DIR/issue-98604.rs:9:5
33
|
44
LL | Box::new(test) as AsyncFnPtr;
55
| ^^^^^^^^^^^^^^ expected struct `Pin`, found opaque type
66
|
77
note: while checking the return type of the `async fn`
8-
--> $DIR/issue-98604.rs:7:17
8+
--> $DIR/issue-98604.rs:5:17
99
|
1010
LL | async fn test() {}
1111
| ^ checked the `Output` of this `async fn`, found opaque type

src/test/ui/type-alias-impl-trait/issue-98608.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
fn hi() -> impl Sized { std::ptr::null::<u8>() }
1+
fn hi() -> impl Sized {
2+
std::ptr::null::<u8>()
3+
}
24

35
fn main() {
46
let b: Box<dyn Fn() -> Box<u8>> = Box::new(hi);
5-
//~^ ERROR expected `fn() -> impl Sized {hi}` to be a fn item that returns `Box<u8>`, but it actually returns `impl Sized`
7+
//~^ ERROR expected `fn() -> impl Sized {hi}` to be a fn item that returns `Box<u8>`, but it returns `impl Sized`
68
let boxed = b();
79
let null = *boxed;
810
println!("{null:?}");

0 commit comments

Comments
 (0)