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

Lines changed: 3 additions & 3 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 5 additions & 3 deletions
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

Lines changed: 4 additions & 4 deletions
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

Lines changed: 7 additions & 3 deletions
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

Lines changed: 9 additions & 6 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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() {

0 commit comments

Comments
 (0)