Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions library/core/src/ops/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ use crate::marker::Tuple;
// SAFETY: tidy is not smart enough to tell that the below unsafe block is a string
label = "call the function in a closure: `|| unsafe {{ /* code */ }}`"
),
message = "expected a `{This:resolved}` closure, found `{Self}`",
message = "expected an `{This:resolved}` closure, found `{Self}`",
label = "expected an `{This:resolved}` closure, found `{Self}`"
)]
#[fundamental] // so that regex can rely that `&str: !FnMut`
Expand Down Expand Up @@ -154,7 +154,7 @@ pub const trait Fn<Args: Tuple>: [const] FnMut<Args> {
// SAFETY: tidy is not smart enough to tell that the below unsafe block is a string
label = "call the function in a closure: `|| unsafe {{ /* code */ }}`"
),
message = "expected a `{This:resolved}` closure, found `{Self}`",
message = "expected an `{This:resolved}` closure, found `{Self}`",
label = "expected an `{This:resolved}` closure, found `{Self}`"
)]
#[fundamental] // so that regex can rely that `&str: !FnMut`
Expand Down Expand Up @@ -233,7 +233,7 @@ pub const trait FnMut<Args: Tuple>: FnOnce<Args> {
// SAFETY: tidy is not smart enough to tell that the below unsafe block is a string
label = "call the function in a closure: `|| unsafe {{ /* code */ }}`"
),
message = "expected a `{This:resolved}` closure, found `{Self}`",
message = "expected an `{This:resolved}` closure, found `{Self}`",
label = "expected an `{This:resolved}` closure, found `{Self}`"
)]
#[fundamental] // so that regex can rely that `&str: !FnMut`
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/abi/bad-custom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ async unsafe extern "custom" fn no_async_fn() {
}

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

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/abi/bad-custom.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ LL + #[unsafe(naked)]
LL | async unsafe extern "custom" fn no_async_fn() {
|

error[E0277]: expected a `Fn()` closure, found `unsafe extern "custom" fn()`
error[E0277]: expected an `Fn()` closure, found `unsafe extern "custom" fn()`
--> $DIR/bad-custom.rs:102:64
|
LL | fn no_promotion_to_fn_trait(f: unsafe extern "custom" fn()) -> impl Fn() {
Expand Down
8 changes: 4 additions & 4 deletions tests/ui/associated-types/normalization-ice-issue-149746.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ trait Owner { type Ty<T: FnMut()>; }
impl Owner for () { type Ty<T: FnMut()> = T; }
pub struct Warns<T> {
_significant_drop: <() as Owner>::Ty<T>,
//~^ ERROR expected a `FnMut()` closure, found `T`
//~^ ERROR expected an `FnMut()` closure, found `T`
field: String,
}
pub fn test<T>(w: Warns<T>) {
//~^ ERROR expected a `FnMut()` closure, found `T`
//~^ ERROR expected an `FnMut()` closure, found `T`
_ = || w.field
//~^ ERROR expected a `FnMut()` closure, found `T`
//~| ERROR expected a `FnMut()` closure, found `T`
//~^ ERROR expected an `FnMut()` closure, found `T`
//~| ERROR expected an `FnMut()` closure, found `T`
//~| WARN: changes to closure capture in Rust 2021 will affect drop order
}
fn main() {}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0277]: expected a `FnMut()` closure, found `T`
error[E0277]: expected an `FnMut()` closure, found `T`
--> $DIR/normalization-ice-issue-149746.rs:6:24
|
LL | _significant_drop: <() as Owner>::Ty<T>,
Expand Down Expand Up @@ -35,7 +35,7 @@ help: add a dummy let to cause `w` to be fully captured
LL | _ = || { let _ = &w; w.field }
| +++++++++++++ +

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

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

error[E0277]: expected a `FnMut()` closure, found `T`
error[E0277]: expected an `FnMut()` closure, found `T`
--> $DIR/normalization-ice-issue-149746.rs:12:9
|
LL | _ = || w.field
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/async-await/async-fn/impl-header.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ impl async Fn<()> for F {}
//~^ ERROR `async` trait implementations are unsupported
//~| ERROR the precise format of `Fn`-family traits' type parameters is subject to change
//~| ERROR manual implementations of `Fn` are experimental
//~| ERROR expected a `FnMut()` closure, found `F`
//~| ERROR expected an `FnMut()` closure, found `F`
//~| ERROR not all trait items implemented, missing: `call`

fn main() {}
2 changes: 1 addition & 1 deletion tests/ui/async-await/async-fn/impl-header.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ LL | impl async Fn<()> for F {}
|
= help: implement the missing item: `fn call(&self, _: ()) -> <Self as FnOnce<()>>::Output { todo!() }`

error[E0277]: expected a `FnMut()` closure, found `F`
error[E0277]: expected an `FnMut()` closure, found `F`
--> $DIR/impl-header.rs:5:23
|
LL | impl async Fn<()> for F {}
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/cast/raw-ptr-to-dyn-fn-raw-ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ fn main() {
let ptr: *mut () = core::ptr::null_mut();
let _: &mut dyn Fn() = unsafe {
&mut *(ptr as *mut dyn Fn())
//~^ ERROR expected a `Fn()` closure, found `()`
//~^ ERROR expected an `Fn()` closure, found `()`
};
}
2 changes: 1 addition & 1 deletion tests/ui/cast/raw-ptr-to-dyn-fn-raw-ptr.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0277]: expected a `Fn()` closure, found `()`
error[E0277]: expected an `Fn()` closure, found `()`
--> $DIR/raw-ptr-to-dyn-fn-raw-ptr.rs:6:16
|
LL | &mut *(ptr as *mut dyn Fn())
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/closures/closure-expected.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fn main() {
let x = Some(1);
let y = x.or_else(4);
//~^ ERROR expected a `FnOnce()` closure, found `{integer}`
//~^ ERROR expected an `FnOnce()` closure, found `{integer}`
}
2 changes: 1 addition & 1 deletion tests/ui/closures/closure-expected.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0277]: expected a `FnOnce()` closure, found `{integer}`
error[E0277]: expected an `FnOnce()` closure, found `{integer}`
--> $DIR/closure-expected.rs:3:23
|
LL | let y = x.or_else(4);
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/closures/coerce-unsafe-to-closure.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0277]: expected a `FnOnce(&str)` closure, found `unsafe fn(_) -> _ {std::intrinsics::transmute::<_, _>}`
error[E0277]: expected an `FnOnce(&str)` closure, found `unsafe fn(_) -> _ {std::intrinsics::transmute::<_, _>}`
--> $DIR/coerce-unsafe-to-closure.rs:2:44
|
LL | let x: Option<&[u8]> = Some("foo").map(std::mem::transmute);
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/contracts/empty-ensures.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ extern crate core;
use core::contracts::ensures;

#[ensures()]
//~^ ERROR expected a `Fn(&_)` closure, found `()` [E0277]
//~^ ERROR expected an `Fn(&_)` closure, found `()` [E0277]
fn foo(x: u32) -> u32 {
x * 2
}
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/contracts/empty-ensures.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0277]: expected a `Fn(&_)` closure, found `()`
error[E0277]: expected an `Fn(&_)` closure, found `()`
--> $DIR/empty-ensures.rs:8:1
|
LL | #[ensures()]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
fn main() {
let number = 2;
Some(true).filter({ //~ ERROR expected a `FnOnce(&bool)` closure, found `bool`
Some(true).filter({ //~ ERROR expected an `FnOnce(&bool)` closure, found `bool`
if number % 2 == 0 {
number == 0
} else {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0277]: expected a `FnOnce(&bool)` closure, found `bool`
error[E0277]: expected an `FnOnce(&bool)` closure, found `bool`
--> $DIR/block_instead_of_closure_in_arg.rs:3:23
|
LL | Some(true).filter({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const x: usize =42;
fn main() {
let p = Some(45).and_then({|x| //~ ERROR expected a `FnOnce({integer})` closure, found `Option<usize>`
let p = Some(45).and_then({|x| //~ ERROR expected an `FnOnce({integer})` closure, found `Option<usize>`
1 + 1;
Some(x * 2)
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0277]: expected a `FnOnce({integer})` closure, found `Option<usize>`
error[E0277]: expected an `FnOnce({integer})` closure, found `Option<usize>`
--> $DIR/ruby_style_closure_successful_parse.rs:3:31
|
LL | let p = Some(45).and_then({|x|
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/extern/extern-wrong-value-type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ fn main() {
// extern functions are extern "C" fn
let _x: extern "C" fn() = f; // OK
is_fn(f);
//~^ ERROR expected a `Fn()` closure, found `extern "C" fn() {f}`
//~^ ERROR expected an `Fn()` closure, found `extern "C" fn() {f}`
}
2 changes: 1 addition & 1 deletion tests/ui/extern/extern-wrong-value-type.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0277]: expected a `Fn()` closure, found `extern "C" fn() {f}`
error[E0277]: expected an `Fn()` closure, found `extern "C" fn() {f}`
--> $DIR/extern-wrong-value-type.rs:9:11
|
LL | is_fn(f);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ struct Foo;
impl Fn<()> for Foo {
//~^ ERROR the precise format of `Fn`-family traits' type parameters is subject to change
//~| ERROR manual implementations of `Fn` are experimental
//~| ERROR expected a `FnMut()` closure, found `Foo`
//~| ERROR expected an `FnMut()` closure, found `Foo`
extern "rust-call" fn call(self, args: ()) -> () {}
//~^ ERROR "rust-call" ABI is experimental and subject to change
//~| ERROR `call` has an incompatible type for trait
Expand All @@ -26,7 +26,7 @@ struct Bar;
impl FnMut<()> for Bar {
//~^ ERROR the precise format of `Fn`-family traits' type parameters is subject to change
//~| ERROR manual implementations of `FnMut` are experimental
//~| ERROR expected a `FnOnce()` closure, found `Bar`
//~| ERROR expected an `FnOnce()` closure, found `Bar`
extern "rust-call" fn call_mut(&self, args: ()) -> () {}
//~^ ERROR "rust-call" ABI is experimental and subject to change
//~| ERROR incompatible type for trait
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ LL | impl FnMut<()> for Bar {
|
= help: add `#![feature(unboxed_closures)]` to the crate attributes to enable

error[E0277]: expected a `FnMut()` closure, found `Foo`
error[E0277]: expected an `FnMut()` closure, found `Foo`
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:9:17
|
LL | impl Fn<()> for Foo {
Expand Down Expand Up @@ -161,7 +161,7 @@ help: change the self-receiver type to match the trait
LL | extern "rust-call" fn call_mut(&mut self, args: ()) -> () {}
| +++

error[E0277]: expected a `FnOnce()` closure, found `Bar`
error[E0277]: expected an `FnOnce()` closure, found `Bar`
--> $DIR/feature-gate-unboxed-closures-manual-impls.rs:26:20
|
LL | impl FnMut<()> for Bar {
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/fn/fn-trait-formatting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ fn main() {
//~| NOTE found struct `Box<dyn FnMut() -> isize>`

needs_fn(1);
//~^ ERROR expected a `Fn(isize)` closure, found `{integer}`
//~^ ERROR expected an `Fn(isize)` closure, found `{integer}`
}
2 changes: 1 addition & 1 deletion tests/ui/fn/fn-trait-formatting.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ LL | let _: () = Box::new(|| -> isize { unimplemented!() }) as Box<dyn FnMut
= note: expected unit type `()`
found struct `Box<dyn FnMut() -> isize>`

error[E0277]: expected a `Fn(isize)` closure, found `{integer}`
error[E0277]: expected an `Fn(isize)` closure, found `{integer}`
--> $DIR/fn-trait-formatting.rs:19:14
|
LL | needs_fn(1);
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/fn/issue-39259.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ struct S;

impl Fn(u32) -> u32 for S {
//~^ ERROR associated item constraints are not allowed here [E0229]
//~| ERROR expected a `FnMut(u32)` closure, found `S`
//~| ERROR expected an `FnMut(u32)` closure, found `S`
fn call(&self) -> u32 {
//~^ ERROR method `call` has 1 parameter but the declaration in trait `call` has 2
5
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/fn/issue-39259.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ help: add the missing parameter from the trait
LL | fn call(&self, args: Args) -> u32 {
| ++++++++++++

error[E0277]: expected a `FnMut(u32)` closure, found `S`
error[E0277]: expected an `FnMut(u32)` closure, found `S`
--> $DIR/issue-39259.rs:6:25
|
LL | impl Fn(u32) -> u32 for S {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ trait Fun {

impl<T> Fun for T {
type F<'a> = Self;
//~^ ERROR expected a `Fn()` closure, found `T`
//~^ ERROR expected an `Fn()` closure, found `T`
}

fn main() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0277]: expected a `Fn()` closure, found `T`
error[E0277]: expected an `Fn()` closure, found `T`
--> $DIR/issue-68642-broken-llvm-ir.rs:12:18
|
LL | type F<'a> = Self;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ trait Fun {

impl<T> Fun for T {
type F<'a> = Self;
//~^ ERROR expected a `Fn()` closure, found `T`
//~^ ERROR expected an `Fn()` closure, found `T`
}

pub fn main() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0277]: expected a `Fn()` closure, found `T`
error[E0277]: expected an `Fn()` closure, found `T`
--> $DIR/issue-68643-broken-mir.rs:12:18
|
LL | type F<'a> = Self;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ trait Fun {

impl<T> Fun for T {
type F<'a> = Self;
//~^ ERROR expected a `Fn()` closure, found `T`
//~^ ERROR expected an `Fn()` closure, found `T`
}

fn main() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0277]: expected a `Fn()` closure, found `T`
error[E0277]: expected an `Fn()` closure, found `T`
--> $DIR/issue-68644-codegen-selection.rs:12:18
|
LL | type F<'a> = Self;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ trait Fun {

impl<T> Fun for T {
type F<'a> = Self;
//~^ ERROR expected a `Fn()` closure, found `T`
//~^ ERROR expected an `Fn()` closure, found `T`
}

fn main() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0277]: expected a `Fn()` closure, found `T`
error[E0277]: expected an `Fn()` closure, found `T`
--> $DIR/issue-68645-codegen-fulfillment.rs:12:18
|
LL | type F<'a> = Self;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0277]: expected a `Fn(<_ as ATC<'a>>::Type)` closure, found `F`
error[E0277]: expected an `Fn(<_ as ATC<'a>>::Type)` closure, found `F`
--> $DIR/issue-62529-3.rs:25:14
|
LL | call(f, ());
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/implied-bounds/issue-100690.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl<'a, T: 'a> Handle<'a, T, UIView<'a, T>, Result<(), io::Error>> for TUIHandl
F: FnOnce(&mut UIView<'a, T>) -> Result<(), io::Error> + Send + 'static,
{
real_dispatch(f)
//~^ ERROR expected a `FnOnce(&mut UIView<'_, T>)` closure, found `F`
//~^ ERROR expected an `FnOnce(&mut UIView<'_, T>)` closure, found `F`
}
}

Expand Down
2 changes: 1 addition & 1 deletion tests/ui/implied-bounds/issue-100690.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0277]: expected a `FnOnce(&mut UIView<'_, T>)` closure, found `F`
error[E0277]: expected an `FnOnce(&mut UIView<'_, T>)` closure, found `F`
--> $DIR/issue-100690.rs:34:23
|
LL | real_dispatch(f)
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/intrinsics/const-eval-select-bad.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ const fn not_fn_items() {
const_eval_select((), || {}, || {});
//~^ ERROR const FnOnce()` is not satisfied
const_eval_select((), 42, 0xDEADBEEF);
//~^ ERROR expected a `FnOnce()` closure
//~| ERROR expected a `FnOnce()` closure
//~^ ERROR expected an `FnOnce()` closure
//~| ERROR expected an `FnOnce()` closure
}

const fn foo(n: i32) -> i32 {
Expand Down
4 changes: 2 additions & 2 deletions tests/ui/intrinsics/const-eval-select-bad.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ LL | const_eval_select((), || {}, || {});
note: required by a bound in `const_eval_select`
--> $SRC_DIR/core/src/intrinsics/mod.rs:LL:COL

error[E0277]: expected a `FnOnce()` closure, found `{integer}`
error[E0277]: expected an `FnOnce()` closure, found `{integer}`
--> $DIR/const-eval-select-bad.rs:9:27
|
LL | const_eval_select((), 42, 0xDEADBEEF);
Expand All @@ -22,7 +22,7 @@ LL | const_eval_select((), 42, 0xDEADBEEF);
note: required by a bound in `const_eval_select`
--> $SRC_DIR/core/src/intrinsics/mod.rs:LL:COL

error[E0277]: expected a `FnOnce()` closure, found `{integer}`
error[E0277]: expected an `FnOnce()` closure, found `{integer}`
--> $DIR/const-eval-select-bad.rs:9:31
|
LL | const_eval_select((), 42, 0xDEADBEEF);
Expand Down
2 changes: 1 addition & 1 deletion tests/ui/iterators/fold-iterator-error-23966.stderr
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
error[E0277]: expected a `FnMut(_, char)` closure, found `()`
error[E0277]: expected an `FnMut(_, char)` closure, found `()`
--> $DIR/fold-iterator-error-23966.rs:3:32
|
LL | "".chars().fold(|_, _| (), ());
Expand Down
Loading
Loading