Skip to content

Commit 8f89b23

Browse files
authored
Unrolled build for #158518
Rollup merge of #158518 - ElectrifyPro:20777-thing, r=JonathanBrouwer Fix mixed use of "a" / "an" article in E0277 This PR fixes a tiny little annoyance typo in error E0277. Currently, this code fails to compile (correctly) with the following error: ```rs struct A<F: Fn()>(F); impl<F> A<F> {} fn main() {} ``` ```rs error[E0277]: expected a `Fn()` closure, found `F` --> src/main.rs:3:9 | 3 | impl<F> A<F> {} | ^^^^ expected an `Fn()` closure, found `F` | = note: wrap the `F` in a closure with no arguments: `|| { /* code */ }` ... truncated ``` Unfortunately, the first line of the error message uses the article "a", when it should be "an" for the `Fn` trait and friends. The help label does use the correct article, "an". Unless if I have been pronouncing `Fn` incorrectly...
2 parents b4486ca + fd67621 commit 8f89b23

73 files changed

Lines changed: 126 additions & 126 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

library/core/src/ops/function.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ use crate::marker::Tuple;
6767
// SAFETY: tidy is not smart enough to tell that the below unsafe block is a string
6868
label = "call the function in a closure: `|| unsafe {{ /* code */ }}`"
6969
),
70-
message = "expected a `{This:resolved}` closure, found `{Self}`",
70+
message = "expected an `{This:resolved}` closure, found `{Self}`",
7171
label = "expected an `{This:resolved}` closure, found `{Self}`"
7272
)]
7373
#[fundamental] // so that regex can rely that `&str: !FnMut`
@@ -154,7 +154,7 @@ pub const trait Fn<Args: Tuple>: [const] FnMut<Args> {
154154
// SAFETY: tidy is not smart enough to tell that the below unsafe block is a string
155155
label = "call the function in a closure: `|| unsafe {{ /* code */ }}`"
156156
),
157-
message = "expected a `{This:resolved}` closure, found `{Self}`",
157+
message = "expected an `{This:resolved}` closure, found `{Self}`",
158158
label = "expected an `{This:resolved}` closure, found `{Self}`"
159159
)]
160160
#[fundamental] // so that regex can rely that `&str: !FnMut`
@@ -233,7 +233,7 @@ pub const trait FnMut<Args: Tuple>: FnOnce<Args> {
233233
// SAFETY: tidy is not smart enough to tell that the below unsafe block is a string
234234
label = "call the function in a closure: `|| unsafe {{ /* code */ }}`"
235235
),
236-
message = "expected a `{This:resolved}` closure, found `{Self}`",
236+
message = "expected an `{This:resolved}` closure, found `{Self}`",
237237
label = "expected an `{This:resolved}` closure, found `{Self}`"
238238
)]
239239
#[fundamental] // so that regex can rely that `&str: !FnMut`

tests/ui/abi/bad-custom.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ async unsafe extern "custom" fn no_async_fn() {
100100
}
101101

102102
fn no_promotion_to_fn_trait(f: unsafe extern "custom" fn()) -> impl Fn() {
103-
//~^ ERROR expected a `Fn()` closure, found `unsafe extern "custom" fn()`
103+
//~^ ERROR expected an `Fn()` closure, found `unsafe extern "custom" fn()`
104104
f
105105
}
106106

tests/ui/abi/bad-custom.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ LL + #[unsafe(naked)]
184184
LL | async unsafe extern "custom" fn no_async_fn() {
185185
|
186186

187-
error[E0277]: expected a `Fn()` closure, found `unsafe extern "custom" fn()`
187+
error[E0277]: expected an `Fn()` closure, found `unsafe extern "custom" fn()`
188188
--> $DIR/bad-custom.rs:102:64
189189
|
190190
LL | fn no_promotion_to_fn_trait(f: unsafe extern "custom" fn()) -> impl Fn() {

tests/ui/associated-types/normalization-ice-issue-149746.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ trait Owner { type Ty<T: FnMut()>; }
44
impl Owner for () { type Ty<T: FnMut()> = T; }
55
pub struct Warns<T> {
66
_significant_drop: <() as Owner>::Ty<T>,
7-
//~^ ERROR expected a `FnMut()` closure, found `T`
7+
//~^ ERROR expected an `FnMut()` closure, found `T`
88
field: String,
99
}
1010
pub fn test<T>(w: Warns<T>) {
11-
//~^ ERROR expected a `FnMut()` closure, found `T`
11+
//~^ ERROR expected an `FnMut()` closure, found `T`
1212
_ = || w.field
13-
//~^ ERROR expected a `FnMut()` closure, found `T`
14-
//~| ERROR expected a `FnMut()` closure, found `T`
13+
//~^ ERROR expected an `FnMut()` closure, found `T`
14+
//~| ERROR expected an `FnMut()` closure, found `T`
1515
//~| WARN: changes to closure capture in Rust 2021 will affect drop order
1616
}
1717
fn main() {}

tests/ui/associated-types/normalization-ice-issue-149746.stderr

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0277]: expected a `FnMut()` closure, found `T`
1+
error[E0277]: expected an `FnMut()` closure, found `T`
22
--> $DIR/normalization-ice-issue-149746.rs:6:24
33
|
44
LL | _significant_drop: <() as Owner>::Ty<T>,
@@ -35,7 +35,7 @@ help: add a dummy let to cause `w` to be fully captured
3535
LL | _ = || { let _ = &w; w.field }
3636
| +++++++++++++ +
3737

38-
error[E0277]: expected a `FnMut()` closure, found `T`
38+
error[E0277]: expected an `FnMut()` closure, found `T`
3939
--> $DIR/normalization-ice-issue-149746.rs:12:9
4040
|
4141
LL | _ = || w.field
@@ -48,7 +48,7 @@ note: required by a bound in `Owner::Ty`
4848
LL | trait Owner { type Ty<T: FnMut()>; }
4949
| ^^^^^^^ required by this bound in `Owner::Ty`
5050

51-
error[E0277]: expected a `FnMut()` closure, found `T`
51+
error[E0277]: expected an `FnMut()` closure, found `T`
5252
--> $DIR/normalization-ice-issue-149746.rs:10:16
5353
|
5454
LL | pub fn test<T>(w: Warns<T>) {
@@ -61,7 +61,7 @@ note: required by a bound in `Owner::Ty`
6161
LL | trait Owner { type Ty<T: FnMut()>; }
6262
| ^^^^^^^ required by this bound in `Owner::Ty`
6363

64-
error[E0277]: expected a `FnMut()` closure, found `T`
64+
error[E0277]: expected an `FnMut()` closure, found `T`
6565
--> $DIR/normalization-ice-issue-149746.rs:12:9
6666
|
6767
LL | _ = || w.field

tests/ui/async-await/async-fn/impl-header.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ impl async Fn<()> for F {}
66
//~^ ERROR `async` trait implementations are unsupported
77
//~| ERROR the precise format of `Fn`-family traits' type parameters is subject to change
88
//~| ERROR manual implementations of `Fn` are experimental
9-
//~| ERROR expected a `FnMut()` closure, found `F`
9+
//~| ERROR expected an `FnMut()` closure, found `F`
1010
//~| ERROR not all trait items implemented, missing: `call`
1111

1212
fn main() {}

tests/ui/async-await/async-fn/impl-header.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ LL | impl async Fn<()> for F {}
3030
|
3131
= help: implement the missing item: `fn call(&self, _: ()) -> <Self as FnOnce<()>>::Output { todo!() }`
3232

33-
error[E0277]: expected a `FnMut()` closure, found `F`
33+
error[E0277]: expected an `FnMut()` closure, found `F`
3434
--> $DIR/impl-header.rs:5:23
3535
|
3636
LL | impl async Fn<()> for F {}

tests/ui/cast/raw-ptr-to-dyn-fn-raw-ptr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ fn main() {
44
let ptr: *mut () = core::ptr::null_mut();
55
let _: &mut dyn Fn() = unsafe {
66
&mut *(ptr as *mut dyn Fn())
7-
//~^ ERROR expected a `Fn()` closure, found `()`
7+
//~^ ERROR expected an `Fn()` closure, found `()`
88
};
99
}

tests/ui/cast/raw-ptr-to-dyn-fn-raw-ptr.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0277]: expected a `Fn()` closure, found `()`
1+
error[E0277]: expected an `Fn()` closure, found `()`
22
--> $DIR/raw-ptr-to-dyn-fn-raw-ptr.rs:6:16
33
|
44
LL | &mut *(ptr as *mut dyn Fn())
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
fn main() {
22
let x = Some(1);
33
let y = x.or_else(4);
4-
//~^ ERROR expected a `FnOnce()` closure, found `{integer}`
4+
//~^ ERROR expected an `FnOnce()` closure, found `{integer}`
55
}

0 commit comments

Comments
 (0)