authorbors <bors@rust-lang.org> 2026-06-28 15:52:45 UTC
committerbors <bors@rust-lang.org> 2026-06-28 15:52:45 UTC
log2574810b228d53518cc2a13f2ee473195932a999
treebbc79ce2af951a45bba0dbd2ae12b732e7994b19
parentb4486cacf58926f02e451d96e71e20882faf5453
parent412fd6b75bf1b15209af52a5ae865f91081ce4a4

Auto merge of #158524 - JonathanBrouwer:rollup-75ZlceV, r=JonathanBrouwer

Rollup of 4 pull requests Successful merges: - rust-lang/rust#158486 (std: treat ENFILE as transient in the pidfd support probe) - rust-lang/rust#158454 (regression test for `Trait<A><B>` in "consider further restricting this bound" suggestion) - rust-lang/rust#158518 (Fix mixed use of "a" / "an" article in E0277) - rust-lang/rust#158519 (add crashtests [2/N])

88 files changed, 330 insertions(+), 128 deletions(-)

library/core/src/ops/function.rs+3-3
......@@ -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`
library/std/src/sys/process/unix/unix.rs+2-2
......@@ -510,8 +510,8 @@ impl Command {
510510 support = SPAWN;
511511 }
512512 }
513 Err(e) if e.raw_os_error() == Some(libc::EMFILE) => {
514 // We're temporarily(?) out of file descriptors. In this case pidfd_spawnp would also fail
513 Err(e) if matches!(e.raw_os_error(), Some(libc::EMFILE | libc::ENFILE | libc::ENOMEM)) => {
514 // We're temporarily(?) out of file descriptors or memory. In this case pidfd_spawnp would also fail
515515 // Don't update the support flag so we can probe again later.
516516 return Err(e)
517517 }
tests/crashes/149748.rs created+13
......@@ -0,0 +1,13 @@
1//@ known-bug: #149748
2//@ edition: 2024
3//@ compile-flags: -Zmir-enable-passes=+Inline -Zmir-enable-passes=+ReferencePropagation -Zlint-mir
4
5#![feature(gen_blocks)]
6gen fn foo(z: i32) -> i32 {
7 yield z;
8 z;
9}
10pub fn main() {
11 let mut iter = foo(3);
12 assert_eq!(iter.next(), Some(3))
13}
tests/crashes/150040.rs created+7
......@@ -0,0 +1,7 @@
1//@ known-bug: #150040
2
3fn main() {
4 let [(ref a, b), x];
5 a = "";
6 b = 5;
7}
tests/crashes/150049.rs created+12
......@@ -0,0 +1,12 @@
1//@ known-bug: #150049
2#![feature(min_generic_const_args)]
3#![feature(inherent_associated_types)]
4struct Foo<'a> {
5 x: &'a (),
6}
7
8impl<'a> Foo<'a> {
9 fn foo(_: [u8; Foo::X]) { std::mem::transmute([4]) }
10}
11
12fn main() {}
tests/crashes/150128.rs created+8
......@@ -0,0 +1,8 @@
1//@ known-bug: #150128
2fn main() {
3 match 0 {
4 _ => || (),
5 _ => || (),
6 _ => (|| ()) as unsafe fn,
7 };
8}
tests/crashes/150296.rs created+14
......@@ -0,0 +1,14 @@
1//@ known-bug: #150296
2#[derive(PartialEq)]
3pub struct Thing<const N: usize>;
4
5impl<const N: usize> Thing<N> {
6 const A: Self = Thing;
7}
8
9fn broken<const N: usize>(x: Thing<N>) {
10 match x {
11 <Thing<N>>::A => {}
12 _ => {}
13 }
14}
tests/crashes/150387.rs created+13
......@@ -0,0 +1,13 @@
1//@ known-bug: #150387
2#![feature(min_specialization)]
3#![allow(dead_code)]
4
5struct Thing<T>(T) where [T]: Sized;
6
7impl<T> Drop for Thing<T> where [T]: Sized {
8 default fn drop(&mut self) {}
9}
10impl<T> Drop for Thing<T> where [T]: Sized {
11 fn drop(&mut self) {}
12}
13fn main() {}
tests/crashes/150403.rs created+26
......@@ -0,0 +1,26 @@
1//@ known-bug: #150403
2#![feature(non_lifetime_binders)]
3
4trait A {
5 type GAT<T>: A;
6 fn foo<T>(self, t: T) -> Self::GAT<T>
7 where
8 Self: Sized;
9}
10
11trait B: A where
12 for<T> Self::GAT<T>: B,
13{
14 fn bar<T>(self) -> Self::GAT<T>
15 where
16 Self: Sized;
17
18 fn baz<T>(self, t: T) -> Self::GAT<T>
19 where
20 Self: Sized,
21 {
22 self.foo(t).bar()
23 }
24}
25
26fn main() {}
tests/crashes/150517.rs created+15
......@@ -0,0 +1,15 @@
1//@ known-bug: #150517
2trait Stream {
3 type Item;
4 fn next(self) -> ();
5}
6impl Stream for &'a () {}
7impl<'a, A> Stream for <&A as Stream>::Item {}
8trait StreamExt {
9 fn f(self) -> ()
10 where
11 for<'b> &'b A: Stream,
12 {
13 self.next()
14 }
15}
tests/crashes/150545.rs created+8
......@@ -0,0 +1,8 @@
1//@ known-bug: #150545
2#![feature(non_lifetime_binders)]
3trait Foo: for<T> Bar<T> {
4 type Item;
5 fn next(self) -> Self::Item;
6}
7trait Bar<T> {}
8fn main() {}
tests/crashes/150749.rs created+12
......@@ -0,0 +1,12 @@
1//@ known-bug: #150749
2#![feature(min_generic_const_args)]
3
4trait CollectArray {
5 fn inner_array();
6}
7impl CollectArray for () {
8 fn inner_array() {
9 let temp_ptr: [(); Self];
10 }
11}
12fn main() {}
tests/crashes/150969.rs created+7
......@@ -0,0 +1,7 @@
1//@ known-bug: #150969
2#![feature(generic_const_exprs)]
3#![feature(min_generic_const_args)]
4
5fn pass_enum<const N : usize, const M : usize = const {N}> {
6 pass_enum::<{None}>
7}
tests/crashes/151069.rs created+16
......@@ -0,0 +1,16 @@
1//@ known-bug: #151069
2trait Trait {
3 type Assoc2;
4}
5struct Bar;
6impl Trait for Bar
7where
8 <Bar as Trait>::Assoc2: Trait,
9{
10 type Assoc2 = ();
11}
12struct Foo {
13 field: <Bar as Trait>::Assoc2,
14}
15static FOO2: &Foo = 0;
16fn main() {}
tests/ui/abi/bad-custom.rs+1-1
......@@ -100,7 +100,7 @@ async unsafe extern "custom" fn no_async_fn() {
100100}
101101
102102fn 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+1-1
......@@ -184,7 +184,7 @@ LL + #[unsafe(naked)]
184184LL | async unsafe extern "custom" fn no_async_fn() {
185185 |
186186
187error[E0277]: expected a `Fn()` closure, found `unsafe extern "custom" fn()`
187error[E0277]: expected an `Fn()` closure, found `unsafe extern "custom" fn()`
188188 --> $DIR/bad-custom.rs:102:64
189189 |
190190LL | fn no_promotion_to_fn_trait(f: unsafe extern "custom" fn()) -> impl Fn() {
tests/ui/associated-types/normalization-ice-issue-149746.rs+4-4
......@@ -4,14 +4,14 @@ trait Owner { type Ty<T: FnMut()>; }
44impl Owner for () { type Ty<T: FnMut()> = T; }
55pub 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}
1010pub 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}
1717fn main() {}
tests/ui/associated-types/normalization-ice-issue-149746.stderr+4-4
......@@ -1,4 +1,4 @@
1error[E0277]: expected a `FnMut()` closure, found `T`
1error[E0277]: expected an `FnMut()` closure, found `T`
22 --> $DIR/normalization-ice-issue-149746.rs:6:24
33 |
44LL | _significant_drop: <() as Owner>::Ty<T>,
......@@ -35,7 +35,7 @@ help: add a dummy let to cause `w` to be fully captured
3535LL | _ = || { let _ = &w; w.field }
3636 | +++++++++++++ +
3737
38error[E0277]: expected a `FnMut()` closure, found `T`
38error[E0277]: expected an `FnMut()` closure, found `T`
3939 --> $DIR/normalization-ice-issue-149746.rs:12:9
4040 |
4141LL | _ = || w.field
......@@ -48,7 +48,7 @@ note: required by a bound in `Owner::Ty`
4848LL | trait Owner { type Ty<T: FnMut()>; }
4949 | ^^^^^^^ required by this bound in `Owner::Ty`
5050
51error[E0277]: expected a `FnMut()` closure, found `T`
51error[E0277]: expected an `FnMut()` closure, found `T`
5252 --> $DIR/normalization-ice-issue-149746.rs:10:16
5353 |
5454LL | pub fn test<T>(w: Warns<T>) {
......@@ -61,7 +61,7 @@ note: required by a bound in `Owner::Ty`
6161LL | trait Owner { type Ty<T: FnMut()>; }
6262 | ^^^^^^^ required by this bound in `Owner::Ty`
6363
64error[E0277]: expected a `FnMut()` closure, found `T`
64error[E0277]: expected an `FnMut()` closure, found `T`
6565 --> $DIR/normalization-ice-issue-149746.rs:12:9
6666 |
6767LL | _ = || w.field
tests/ui/async-await/async-fn/impl-header.rs+1-1
......@@ -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
1212fn main() {}
tests/ui/async-await/async-fn/impl-header.stderr+1-1
......@@ -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
33error[E0277]: expected a `FnMut()` closure, found `F`
33error[E0277]: expected an `FnMut()` closure, found `F`
3434 --> $DIR/impl-header.rs:5:23
3535 |
3636LL | impl async Fn<()> for F {}
tests/ui/cast/raw-ptr-to-dyn-fn-raw-ptr.rs+1-1
......@@ -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+1-1
......@@ -1,4 +1,4 @@
1error[E0277]: expected a `Fn()` closure, found `()`
1error[E0277]: expected an `Fn()` closure, found `()`
22 --> $DIR/raw-ptr-to-dyn-fn-raw-ptr.rs:6:16
33 |
44LL | &mut *(ptr as *mut dyn Fn())
tests/ui/closures/closure-expected.rs+1-1
......@@ -1,5 +1,5 @@
11fn 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}
tests/ui/closures/closure-expected.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0277]: expected a `FnOnce()` closure, found `{integer}`
1error[E0277]: expected an `FnOnce()` closure, found `{integer}`
22 --> $DIR/closure-expected.rs:3:23
33 |
44LL | let y = x.or_else(4);
tests/ui/closures/coerce-unsafe-to-closure.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0277]: expected a `FnOnce(&str)` closure, found `unsafe fn(_) -> _ {std::intrinsics::transmute::<_, _>}`
1error[E0277]: expected an `FnOnce(&str)` closure, found `unsafe fn(_) -> _ {std::intrinsics::transmute::<_, _>}`
22 --> $DIR/coerce-unsafe-to-closure.rs:2:44
33 |
44LL | let x: Option<&[u8]> = Some("foo").map(std::mem::transmute);
tests/ui/contracts/empty-ensures.rs+1-1
......@@ -6,7 +6,7 @@ extern crate core;
66use core::contracts::ensures;
77
88#[ensures()]
9//~^ ERROR expected a `Fn(&_)` closure, found `()` [E0277]
9//~^ ERROR expected an `Fn(&_)` closure, found `()` [E0277]
1010fn foo(x: u32) -> u32 {
1111 x * 2
1212}
tests/ui/contracts/empty-ensures.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0277]: expected a `Fn(&_)` closure, found `()`
1error[E0277]: expected an `Fn(&_)` closure, found `()`
22 --> $DIR/empty-ensures.rs:8:1
33 |
44LL | #[ensures()]
tests/ui/expr/malformed_closure/block_instead_of_closure_in_arg.rs+1-1
......@@ -1,6 +1,6 @@
11fn main() {
22 let number = 2;
3 Some(true).filter({ //~ ERROR expected a `FnOnce(&bool)` closure, found `bool`
3 Some(true).filter({ //~ ERROR expected an `FnOnce(&bool)` closure, found `bool`
44 if number % 2 == 0 {
55 number == 0
66 } else {
tests/ui/expr/malformed_closure/block_instead_of_closure_in_arg.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0277]: expected a `FnOnce(&bool)` closure, found `bool`
1error[E0277]: expected an `FnOnce(&bool)` closure, found `bool`
22 --> $DIR/block_instead_of_closure_in_arg.rs:3:23
33 |
44LL | Some(true).filter({
tests/ui/expr/malformed_closure/ruby_style_closure_successful_parse.rs+1-1
......@@ -1,6 +1,6 @@
11const x: usize =42;
22fn main() {
3 let p = Some(45).and_then({|x| //~ ERROR expected a `FnOnce({integer})` closure, found `Option<usize>`
3 let p = Some(45).and_then({|x| //~ ERROR expected an `FnOnce({integer})` closure, found `Option<usize>`
44 1 + 1;
55 Some(x * 2)
66 });
tests/ui/expr/malformed_closure/ruby_style_closure_successful_parse.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0277]: expected a `FnOnce({integer})` closure, found `Option<usize>`
1error[E0277]: expected an `FnOnce({integer})` closure, found `Option<usize>`
22 --> $DIR/ruby_style_closure_successful_parse.rs:3:31
33 |
44LL | let p = Some(45).and_then({|x|
tests/ui/extern/extern-wrong-value-type.rs+1-1
......@@ -7,5 +7,5 @@ fn main() {
77 // extern functions are extern "C" fn
88 let _x: extern "C" fn() = f; // OK
99 is_fn(f);
10 //~^ ERROR expected a `Fn()` closure, found `extern "C" fn() {f}`
10 //~^ ERROR expected an `Fn()` closure, found `extern "C" fn() {f}`
1111}
tests/ui/extern/extern-wrong-value-type.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0277]: expected a `Fn()` closure, found `extern "C" fn() {f}`
1error[E0277]: expected an `Fn()` closure, found `extern "C" fn() {f}`
22 --> $DIR/extern-wrong-value-type.rs:9:11
33 |
44LL | is_fn(f);
tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.rs+2-2
......@@ -9,7 +9,7 @@ struct Foo;
99impl Fn<()> for Foo {
1010 //~^ ERROR the precise format of `Fn`-family traits' type parameters is subject to change
1111 //~| ERROR manual implementations of `Fn` are experimental
12 //~| ERROR expected a `FnMut()` closure, found `Foo`
12 //~| ERROR expected an `FnMut()` closure, found `Foo`
1313 extern "rust-call" fn call(self, args: ()) -> () {}
1414 //~^ ERROR "rust-call" ABI is experimental and subject to change
1515 //~| ERROR `call` has an incompatible type for trait
......@@ -26,7 +26,7 @@ struct Bar;
2626impl FnMut<()> for Bar {
2727 //~^ ERROR the precise format of `Fn`-family traits' type parameters is subject to change
2828 //~| ERROR manual implementations of `FnMut` are experimental
29 //~| ERROR expected a `FnOnce()` closure, found `Bar`
29 //~| ERROR expected an `FnOnce()` closure, found `Bar`
3030 extern "rust-call" fn call_mut(&self, args: ()) -> () {}
3131 //~^ ERROR "rust-call" ABI is experimental and subject to change
3232 //~| ERROR incompatible type for trait
tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr+2-2
......@@ -87,7 +87,7 @@ LL | impl FnMut<()> for Bar {
8787 |
8888 = help: add `#![feature(unboxed_closures)]` to the crate attributes to enable
8989
90error[E0277]: expected a `FnMut()` closure, found `Foo`
90error[E0277]: expected an `FnMut()` closure, found `Foo`
9191 --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:9:17
9292 |
9393LL | impl Fn<()> for Foo {
......@@ -161,7 +161,7 @@ help: change the self-receiver type to match the trait
161161LL | extern "rust-call" fn call_mut(&mut self, args: ()) -> () {}
162162 | +++
163163
164error[E0277]: expected a `FnOnce()` closure, found `Bar`
164error[E0277]: expected an `FnOnce()` closure, found `Bar`
165165 --> $DIR/feature-gate-unboxed-closures-manual-impls.rs:26:20
166166 |
167167LL | impl FnMut<()> for Bar {
tests/ui/fn/fn-trait-formatting.rs+1-1
......@@ -17,5 +17,5 @@ fn main() {
1717 //~| NOTE found struct `Box<dyn FnMut() -> isize>`
1818
1919 needs_fn(1);
20 //~^ ERROR expected a `Fn(isize)` closure, found `{integer}`
20 //~^ ERROR expected an `Fn(isize)` closure, found `{integer}`
2121}
tests/ui/fn/fn-trait-formatting.stderr+1-1
......@@ -39,7 +39,7 @@ LL | let _: () = Box::new(|| -> isize { unimplemented!() }) as Box<dyn FnMut
3939 = note: expected unit type `()`
4040 found struct `Box<dyn FnMut() -> isize>`
4141
42error[E0277]: expected a `Fn(isize)` closure, found `{integer}`
42error[E0277]: expected an `Fn(isize)` closure, found `{integer}`
4343 --> $DIR/fn-trait-formatting.rs:19:14
4444 |
4545LL | needs_fn(1);
tests/ui/fn/issue-39259.rs+1-1
......@@ -5,7 +5,7 @@ struct S;
55
66impl Fn(u32) -> u32 for S {
77 //~^ ERROR associated item constraints are not allowed here [E0229]
8 //~| ERROR expected a `FnMut(u32)` closure, found `S`
8 //~| ERROR expected an `FnMut(u32)` closure, found `S`
99 fn call(&self) -> u32 {
1010 //~^ ERROR method `call` has 1 parameter but the declaration in trait `call` has 2
1111 5
tests/ui/fn/issue-39259.stderr+1-1
......@@ -22,7 +22,7 @@ help: add the missing parameter from the trait
2222LL | fn call(&self, args: Args) -> u32 {
2323 | ++++++++++++
2424
25error[E0277]: expected a `FnMut(u32)` closure, found `S`
25error[E0277]: expected an `FnMut(u32)` closure, found `S`
2626 --> $DIR/issue-39259.rs:6:25
2727 |
2828LL | impl Fn(u32) -> u32 for S {
tests/ui/generic-associated-types/issue-68642-broken-llvm-ir.rs+1-1
......@@ -10,7 +10,7 @@ trait Fun {
1010
1111impl<T> Fun for T {
1212 type F<'a> = Self;
13 //~^ ERROR expected a `Fn()` closure, found `T`
13 //~^ ERROR expected an `Fn()` closure, found `T`
1414}
1515
1616fn main() {
tests/ui/generic-associated-types/issue-68642-broken-llvm-ir.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0277]: expected a `Fn()` closure, found `T`
1error[E0277]: expected an `Fn()` closure, found `T`
22 --> $DIR/issue-68642-broken-llvm-ir.rs:12:18
33 |
44LL | type F<'a> = Self;
tests/ui/generic-associated-types/issue-68643-broken-mir.rs+1-1
......@@ -10,7 +10,7 @@ trait Fun {
1010
1111impl<T> Fun for T {
1212 type F<'a> = Self;
13 //~^ ERROR expected a `Fn()` closure, found `T`
13 //~^ ERROR expected an `Fn()` closure, found `T`
1414}
1515
1616pub fn main() {
tests/ui/generic-associated-types/issue-68643-broken-mir.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0277]: expected a `Fn()` closure, found `T`
1error[E0277]: expected an `Fn()` closure, found `T`
22 --> $DIR/issue-68643-broken-mir.rs:12:18
33 |
44LL | type F<'a> = Self;
tests/ui/generic-associated-types/issue-68644-codegen-selection.rs+1-1
......@@ -10,7 +10,7 @@ trait Fun {
1010
1111impl<T> Fun for T {
1212 type F<'a> = Self;
13 //~^ ERROR expected a `Fn()` closure, found `T`
13 //~^ ERROR expected an `Fn()` closure, found `T`
1414}
1515
1616fn main() {
tests/ui/generic-associated-types/issue-68644-codegen-selection.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0277]: expected a `Fn()` closure, found `T`
1error[E0277]: expected an `Fn()` closure, found `T`
22 --> $DIR/issue-68644-codegen-selection.rs:12:18
33 |
44LL | type F<'a> = Self;
tests/ui/generic-associated-types/issue-68645-codegen-fulfillment.rs+1-1
......@@ -10,7 +10,7 @@ trait Fun {
1010
1111impl<T> Fun for T {
1212 type F<'a> = Self;
13 //~^ ERROR expected a `Fn()` closure, found `T`
13 //~^ ERROR expected an `Fn()` closure, found `T`
1414}
1515
1616fn main() {
tests/ui/generic-associated-types/issue-68645-codegen-fulfillment.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0277]: expected a `Fn()` closure, found `T`
1error[E0277]: expected an `Fn()` closure, found `T`
22 --> $DIR/issue-68645-codegen-fulfillment.rs:12:18
33 |
44LL | type F<'a> = Self;
tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-62529-3.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0277]: expected a `Fn(<_ as ATC<'a>>::Type)` closure, found `F`
1error[E0277]: expected an `Fn(<_ as ATC<'a>>::Type)` closure, found `F`
22 --> $DIR/issue-62529-3.rs:25:14
33 |
44LL | call(f, ());
tests/ui/implied-bounds/issue-100690.rs+1-1
......@@ -32,7 +32,7 @@ impl<'a, T: 'a> Handle<'a, T, UIView<'a, T>, Result<(), io::Error>> for TUIHandl
3232 F: FnOnce(&mut UIView<'a, T>) -> Result<(), io::Error> + Send + 'static,
3333 {
3434 real_dispatch(f)
35 //~^ ERROR expected a `FnOnce(&mut UIView<'_, T>)` closure, found `F`
35 //~^ ERROR expected an `FnOnce(&mut UIView<'_, T>)` closure, found `F`
3636 }
3737}
3838
tests/ui/implied-bounds/issue-100690.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0277]: expected a `FnOnce(&mut UIView<'_, T>)` closure, found `F`
1error[E0277]: expected an `FnOnce(&mut UIView<'_, T>)` closure, found `F`
22 --> $DIR/issue-100690.rs:34:23
33 |
44LL | real_dispatch(f)
tests/ui/intrinsics/const-eval-select-bad.rs+2-2
......@@ -7,8 +7,8 @@ const fn not_fn_items() {
77 const_eval_select((), || {}, || {});
88 //~^ ERROR const FnOnce()` is not satisfied
99 const_eval_select((), 42, 0xDEADBEEF);
10 //~^ ERROR expected a `FnOnce()` closure
11 //~| ERROR expected a `FnOnce()` closure
10 //~^ ERROR expected an `FnOnce()` closure
11 //~| ERROR expected an `FnOnce()` closure
1212}
1313
1414const fn foo(n: i32) -> i32 {
tests/ui/intrinsics/const-eval-select-bad.stderr+2-2
......@@ -9,7 +9,7 @@ LL | const_eval_select((), || {}, || {});
99note: required by a bound in `const_eval_select`
1010 --> $SRC_DIR/core/src/intrinsics/mod.rs:LL:COL
1111
12error[E0277]: expected a `FnOnce()` closure, found `{integer}`
12error[E0277]: expected an `FnOnce()` closure, found `{integer}`
1313 --> $DIR/const-eval-select-bad.rs:9:27
1414 |
1515LL | const_eval_select((), 42, 0xDEADBEEF);
......@@ -22,7 +22,7 @@ LL | const_eval_select((), 42, 0xDEADBEEF);
2222note: required by a bound in `const_eval_select`
2323 --> $SRC_DIR/core/src/intrinsics/mod.rs:LL:COL
2424
25error[E0277]: expected a `FnOnce()` closure, found `{integer}`
25error[E0277]: expected an `FnOnce()` closure, found `{integer}`
2626 --> $DIR/const-eval-select-bad.rs:9:31
2727 |
2828LL | const_eval_select((), 42, 0xDEADBEEF);
tests/ui/iterators/fold-iterator-error-23966.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0277]: expected a `FnMut(_, char)` closure, found `()`
1error[E0277]: expected an `FnMut(_, char)` closure, found `()`
22 --> $DIR/fold-iterator-error-23966.rs:3:32
33 |
44LL | "".chars().fold(|_, _| (), ());
tests/ui/lifetimes/issue-76168-hr-outlives-3.rs+3-3
......@@ -4,9 +4,9 @@
44use std::future::Future;
55
66async fn wrapper<F>(f: F)
7//~^ ERROR: expected a `FnOnce(&'a mut i32)` closure, found `i32`
8//~| ERROR: expected a `FnOnce(&'a mut i32)` closure, found `i32`
9//~| ERROR: expected a `FnOnce(&'a mut i32)` closure, found `i32`
7//~^ ERROR: expected an `FnOnce(&'a mut i32)` closure, found `i32`
8//~| ERROR: expected an `FnOnce(&'a mut i32)` closure, found `i32`
9//~| ERROR: expected an `FnOnce(&'a mut i32)` closure, found `i32`
1010where
1111 F:,
1212 for<'a> <i32 as FnOnce<(&'a mut i32,)>>::Output: Future<Output = ()> + 'a,
tests/ui/lifetimes/issue-76168-hr-outlives-3.stderr+3-3
......@@ -1,4 +1,4 @@
1error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `i32`
1error[E0277]: expected an `FnOnce(&'a mut i32)` closure, found `i32`
22 --> $DIR/issue-76168-hr-outlives-3.rs:6:1
33 |
44LL | / async fn wrapper<F>(f: F)
......@@ -9,7 +9,7 @@ LL | | for<'a> <i32 as FnOnce<(&'a mut i32,)>>::Output: Future<Output = ()>
99 |
1010 = help: the trait `for<'a> FnOnce(&'a mut i32)` is not implemented for `i32`
1111
12error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `i32`
12error[E0277]: expected an `FnOnce(&'a mut i32)` closure, found `i32`
1313 --> $DIR/issue-76168-hr-outlives-3.rs:6:26
1414 |
1515LL | async fn wrapper<F>(f: F)
......@@ -17,7 +17,7 @@ LL | async fn wrapper<F>(f: F)
1717 |
1818 = help: the trait `for<'a> FnOnce(&'a mut i32)` is not implemented for `i32`
1919
20error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `i32`
20error[E0277]: expected an `FnOnce(&'a mut i32)` closure, found `i32`
2121 --> $DIR/issue-76168-hr-outlives-3.rs:6:26
2222 |
2323LL | async fn wrapper<F>(f: F)
tests/ui/lifetimes/issue-95023.rs+1-1
......@@ -4,7 +4,7 @@ impl Fn(&isize) for Error {
44 //~^ ERROR manual implementations of `Fn` are experimental [E0183]
55 //~| ERROR associated item constraints are not allowed here [E0229]
66 //~| ERROR not all trait items implemented
7 //~| ERROR expected a `FnMut(&isize)` closure, found `Error`
7 //~| ERROR expected an `FnMut(&isize)` closure, found `Error`
88 fn foo<const N: usize>(&self) -> Self::B<{ N }>;
99 //~^ ERROR associated function in `impl` without body
1010 //~| ERROR method `foo` is not a member of trait `Fn` [E0407]
tests/ui/lifetimes/issue-95023.stderr+1-1
......@@ -40,7 +40,7 @@ LL | impl Fn(&isize) for Error {
4040 |
4141 = help: implement the missing item: `fn call(&self, _: (&isize,)) -> <Self as FnOnce<(&isize,)>>::Output { todo!() }`
4242
43error[E0277]: expected a `FnMut(&isize)` closure, found `Error`
43error[E0277]: expected an `FnMut(&isize)` closure, found `Error`
4444 --> $DIR/issue-95023.rs:3:21
4545 |
4646LL | impl Fn(&isize) for Error {
tests/ui/macros/ice-in-tokenstream-for-contracts-issue-140683.rs+1-1
......@@ -4,7 +4,7 @@
44struct T;
55
66impl T {
7 #[core::contracts::ensures] //~ ERROR expected a `Fn(&_)` closure, found `()`
7 #[core::contracts::ensures] //~ ERROR expected an `Fn(&_)` closure, found `()`
88 fn b() {(loop)}
99 //~^ ERROR expected `{`, found `)`
1010 //~| ERROR expected `{`, found `)`
tests/ui/macros/ice-in-tokenstream-for-contracts-issue-140683.stderr+1-1
......@@ -16,7 +16,7 @@ LL | fn b() {(loop)}
1616 |
1717 = note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
1818
19error[E0277]: expected a `Fn(&_)` closure, found `()`
19error[E0277]: expected an `Fn(&_)` closure, found `()`
2020 --> $DIR/ice-in-tokenstream-for-contracts-issue-140683.rs:7:5
2121 |
2222LL | #[core::contracts::ensures]
tests/ui/methods/filter-relevant-fn-bounds.rs+1-1
......@@ -16,5 +16,5 @@ impl Wrapper {
1616fn main() {
1717 let mut wrapper = Wrapper;
1818 wrapper.do_something_wrapper(|value| ());
19 //~^ ERROR expected a `FnOnce
19 //~^ ERROR expected an `FnOnce
2020}
tests/ui/methods/filter-relevant-fn-bounds.stderr+1-1
......@@ -12,7 +12,7 @@ help: consider further restricting type parameter `F` with trait `Output`
1212LL | F: for<'a> FnOnce(<F as Output<'a>>::Type) + for<'a> Output<'a>,
1313 | ++++++++++++++++++++
1414
15error[E0277]: expected a `FnOnce(<{closure@$DIR/filter-relevant-fn-bounds.rs:18:34: 18:41} as Output<'a>>::Type)` closure, found `{closure@$DIR/filter-relevant-fn-bounds.rs:18:34: 18:41}`
15error[E0277]: expected an `FnOnce(<{closure@$DIR/filter-relevant-fn-bounds.rs:18:34: 18:41} as Output<'a>>::Type)` closure, found `{closure@$DIR/filter-relevant-fn-bounds.rs:18:34: 18:41}`
1616 --> $DIR/filter-relevant-fn-bounds.rs:18:34
1717 |
1818LL | wrapper.do_something_wrapper(|value| ());
tests/ui/methods/method-suggestion-trait-with-extra-generics-no-ice.rs+1-1
......@@ -16,7 +16,7 @@ struct Bar;
1616
1717fn main() {
1818 let foo: Box<dyn Fn(bool) -> usize> = Box::new(Bar);
19 //~^ ERROR expected a `Fn(bool)` closure, found `Bar`
19 //~^ ERROR expected an `Fn(bool)` closure, found `Bar`
2020 foo.borrow();
2121 //~^ ERROR no method named `borrow` found
2222 foo.take()
tests/ui/methods/method-suggestion-trait-with-extra-generics-no-ice.stderr+1-1
......@@ -22,7 +22,7 @@ help: there is a method `borrow_mut` with a similar name
2222LL | foo.borrow_mut();
2323 | ++++
2424
25error[E0277]: expected a `Fn(bool)` closure, found `Bar`
25error[E0277]: expected an `Fn(bool)` closure, found `Bar`
2626 --> $DIR/method-suggestion-trait-with-extra-generics-no-ice.rs:18:43
2727 |
2828LL | let foo: Box<dyn Fn(bool) -> usize> = Box::new(Bar);
tests/ui/mismatched_types/closure-arg-type-mismatch-issue-45727.current.fixed+2-2
......@@ -5,10 +5,10 @@
55fn main() {
66 let _ = (-10..=10).find(|x: &i32| x.signum() == 0);
77 //[current]~^ ERROR type mismatch in closure arguments
8 //[next]~^^ ERROR: expected a `FnMut(&{integer})` closure, found
8 //[next]~^^ ERROR: expected an `FnMut(&{integer})` closure, found
99 //[next]~| ERROR: type mismatch resolving `<{closure@closure-arg-type-mismatch-issue-45727.rs:6:29} as FnOnce<(&{integer},)>>::Output == bool`
1010 let _ = (-10..=10).find(|x: &i32| x.signum() == 0);
1111 //[current]~^ ERROR type mismatch in closure arguments
12 //[next]~^^ ERROR: expected a `FnMut(&{integer})` closure, found
12 //[next]~^^ ERROR: expected an `FnMut(&{integer})` closure, found
1313 //[next]~| ERROR: type mismatch resolving `<{closure@closure-arg-type-mismatch-issue-45727.rs:10:29} as FnOnce<(&{integer},)>>::Output == bool`
1414}
tests/ui/mismatched_types/closure-arg-type-mismatch-issue-45727.next.stderr+2-2
......@@ -1,4 +1,4 @@
1error[E0277]: expected a `FnMut(&{integer})` closure, found `{closure@$DIR/closure-arg-type-mismatch-issue-45727.rs:6:29: 6:37}`
1error[E0277]: expected an `FnMut(&{integer})` closure, found `{closure@$DIR/closure-arg-type-mismatch-issue-45727.rs:6:29: 6:37}`
22 --> $DIR/closure-arg-type-mismatch-issue-45727.rs:6:29
33 |
44LL | let _ = (-10..=10).find(|x: i32| x.signum() == 0);
......@@ -23,7 +23,7 @@ LL | let _ = (-10..=10).find(|x: i32| x.signum() == 0);
2323note: required by a bound in `find`
2424 --> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
2525
26error[E0277]: expected a `FnMut(&{integer})` closure, found `{closure@$DIR/closure-arg-type-mismatch-issue-45727.rs:10:29: 10:40}`
26error[E0277]: expected an `FnMut(&{integer})` closure, found `{closure@$DIR/closure-arg-type-mismatch-issue-45727.rs:10:29: 10:40}`
2727 --> $DIR/closure-arg-type-mismatch-issue-45727.rs:10:29
2828 |
2929LL | let _ = (-10..=10).find(|x: &&&i32| x.signum() == 0);
tests/ui/mismatched_types/closure-arg-type-mismatch-issue-45727.rs+2-2
......@@ -5,10 +5,10 @@
55fn main() {
66 let _ = (-10..=10).find(|x: i32| x.signum() == 0);
77 //[current]~^ ERROR type mismatch in closure arguments
8 //[next]~^^ ERROR: expected a `FnMut(&{integer})` closure, found
8 //[next]~^^ ERROR: expected an `FnMut(&{integer})` closure, found
99 //[next]~| ERROR: type mismatch resolving `<{closure@closure-arg-type-mismatch-issue-45727.rs:6:29} as FnOnce<(&{integer},)>>::Output == bool`
1010 let _ = (-10..=10).find(|x: &&&i32| x.signum() == 0);
1111 //[current]~^ ERROR type mismatch in closure arguments
12 //[next]~^^ ERROR: expected a `FnMut(&{integer})` closure, found
12 //[next]~^^ ERROR: expected an `FnMut(&{integer})` closure, found
1313 //[next]~| ERROR: type mismatch resolving `<{closure@closure-arg-type-mismatch-issue-45727.rs:10:29} as FnOnce<(&{integer},)>>::Output == bool`
1414}
tests/ui/mismatched_types/suggest-option-asderef-unfixable.rs+2-2
......@@ -24,9 +24,9 @@ fn main() {
2424 let _ = produces_string().and_then(takes_str_but_too_many_refs);
2525 //~^ ERROR type mismatch in function arguments
2626 let _ = produces_string().and_then(takes_str_but_wrong_abi);
27 //~^ ERROR expected a `FnOnce(String)` closure, found `for<'a> extern "C" fn(&'a str) -> Option<()> {takes_str_but_wrong_abi}`
27 //~^ ERROR expected an `FnOnce(String)` closure, found `for<'a> extern "C" fn(&'a str) -> Option<()> {takes_str_but_wrong_abi}`
2828 let _ = produces_string().and_then(takes_str_but_unsafe);
29 //~^ ERROR expected a `FnOnce(String)` closure, found `for<'a> unsafe fn(&'a str) -> Option<()> {takes_str_but_unsafe}`
29 //~^ ERROR expected an `FnOnce(String)` closure, found `for<'a> unsafe fn(&'a str) -> Option<()> {takes_str_but_unsafe}`
3030 let _ = produces_string().and_then(no_args);
3131 //~^ ERROR function is expected to take 1 argument, but it takes 0 arguments
3232 let _ = Some(TypeWithoutDeref).and_then(takes_str_but_too_many_refs);
tests/ui/mismatched_types/suggest-option-asderef-unfixable.stderr+2-2
......@@ -18,7 +18,7 @@ help: consider wrapping the function in a closure
1818LL | let _ = produces_string().and_then(|arg0: String| takes_str_but_too_many_refs(/* &&str */));
1919 | ++++++++++++++ +++++++++++++
2020
21error[E0277]: expected a `FnOnce(String)` closure, found `for<'a> extern "C" fn(&'a str) -> Option<()> {takes_str_but_wrong_abi}`
21error[E0277]: expected an `FnOnce(String)` closure, found `for<'a> extern "C" fn(&'a str) -> Option<()> {takes_str_but_wrong_abi}`
2222 --> $DIR/suggest-option-asderef-unfixable.rs:26:40
2323 |
2424LL | let _ = produces_string().and_then(takes_str_but_wrong_abi);
......@@ -30,7 +30,7 @@ LL | let _ = produces_string().and_then(takes_str_but_wrong_abi);
3030note: required by a bound in `Option::<T>::and_then`
3131 --> $SRC_DIR/core/src/option.rs:LL:COL
3232
33error[E0277]: expected a `FnOnce(String)` closure, found `for<'a> unsafe fn(&'a str) -> Option<()> {takes_str_but_unsafe}`
33error[E0277]: expected an `FnOnce(String)` closure, found `for<'a> unsafe fn(&'a str) -> Option<()> {takes_str_but_unsafe}`
3434 --> $DIR/suggest-option-asderef-unfixable.rs:28:40
3535 |
3636LL | let _ = produces_string().and_then(takes_str_but_unsafe);
tests/ui/rfcs/rfc-2396-target_feature-11/fn-traits.rs+7-7
......@@ -26,15 +26,15 @@ fn call_once_i32(f: impl FnOnce(i32)) {
2626}
2727
2828fn main() {
29 call(foo); //~ ERROR expected a `Fn()` closure, found `#[target_features] fn() {foo}`
30 call_mut(foo); //~ ERROR expected a `FnMut()` closure, found `#[target_features] fn() {foo}`
31 call_once(foo); //~ ERROR expected a `FnOnce()` closure, found `#[target_features] fn() {foo}`
32 call_once_i32(bar); //~ ERROR expected a `FnOnce(i32)` closure, found `#[target_features] fn(i32) {bar}`
29 call(foo); //~ ERROR expected an `Fn()` closure, found `#[target_features] fn() {foo}`
30 call_mut(foo); //~ ERROR expected an `FnMut()` closure, found `#[target_features] fn() {foo}`
31 call_once(foo); //~ ERROR expected an `FnOnce()` closure, found `#[target_features] fn() {foo}`
32 call_once_i32(bar); //~ ERROR expected an `FnOnce(i32)` closure, found `#[target_features] fn(i32) {bar}`
3333
3434 call(foo_unsafe);
35 //~^ ERROR expected a `Fn()` closure, found `unsafe fn() {foo_unsafe}`
35 //~^ ERROR expected an `Fn()` closure, found `unsafe fn() {foo_unsafe}`
3636 call_mut(foo_unsafe);
37 //~^ ERROR expected a `FnMut()` closure, found `unsafe fn() {foo_unsafe}`
37 //~^ ERROR expected an `FnMut()` closure, found `unsafe fn() {foo_unsafe}`
3838 call_once(foo_unsafe);
39 //~^ ERROR expected a `FnOnce()` closure, found `unsafe fn() {foo_unsafe}`
39 //~^ ERROR expected an `FnOnce()` closure, found `unsafe fn() {foo_unsafe}`
4040}
tests/ui/rfcs/rfc-2396-target_feature-11/fn-traits.stderr+7-7
......@@ -1,4 +1,4 @@
1error[E0277]: expected a `Fn()` closure, found `#[target_features] fn() {foo}`
1error[E0277]: expected an `Fn()` closure, found `#[target_features] fn() {foo}`
22 --> $DIR/fn-traits.rs:29:10
33 |
44LL | call(foo);
......@@ -16,7 +16,7 @@ note: required by a bound in `call`
1616LL | fn call(f: impl Fn()) {
1717 | ^^^^ required by this bound in `call`
1818
19error[E0277]: expected a `FnMut()` closure, found `#[target_features] fn() {foo}`
19error[E0277]: expected an `FnMut()` closure, found `#[target_features] fn() {foo}`
2020 --> $DIR/fn-traits.rs:30:14
2121 |
2222LL | call_mut(foo);
......@@ -34,7 +34,7 @@ note: required by a bound in `call_mut`
3434LL | fn call_mut(mut f: impl FnMut()) {
3535 | ^^^^^^^ required by this bound in `call_mut`
3636
37error[E0277]: expected a `FnOnce()` closure, found `#[target_features] fn() {foo}`
37error[E0277]: expected an `FnOnce()` closure, found `#[target_features] fn() {foo}`
3838 --> $DIR/fn-traits.rs:31:15
3939 |
4040LL | call_once(foo);
......@@ -52,7 +52,7 @@ note: required by a bound in `call_once`
5252LL | fn call_once(f: impl FnOnce()) {
5353 | ^^^^^^^^ required by this bound in `call_once`
5454
55error[E0277]: expected a `FnOnce(i32)` closure, found `#[target_features] fn(i32) {bar}`
55error[E0277]: expected an `FnOnce(i32)` closure, found `#[target_features] fn(i32) {bar}`
5656 --> $DIR/fn-traits.rs:32:19
5757 |
5858LL | call_once_i32(bar);
......@@ -69,7 +69,7 @@ note: required by a bound in `call_once_i32`
6969LL | fn call_once_i32(f: impl FnOnce(i32)) {
7070 | ^^^^^^^^^^^ required by this bound in `call_once_i32`
7171
72error[E0277]: expected a `Fn()` closure, found `unsafe fn() {foo_unsafe}`
72error[E0277]: expected an `Fn()` closure, found `unsafe fn() {foo_unsafe}`
7373 --> $DIR/fn-traits.rs:34:10
7474 |
7575LL | call(foo_unsafe);
......@@ -88,7 +88,7 @@ note: required by a bound in `call`
8888LL | fn call(f: impl Fn()) {
8989 | ^^^^ required by this bound in `call`
9090
91error[E0277]: expected a `FnMut()` closure, found `unsafe fn() {foo_unsafe}`
91error[E0277]: expected an `FnMut()` closure, found `unsafe fn() {foo_unsafe}`
9292 --> $DIR/fn-traits.rs:36:14
9393 |
9494LL | call_mut(foo_unsafe);
......@@ -107,7 +107,7 @@ note: required by a bound in `call_mut`
107107LL | fn call_mut(mut f: impl FnMut()) {
108108 | ^^^^^^^ required by this bound in `call_mut`
109109
110error[E0277]: expected a `FnOnce()` closure, found `unsafe fn() {foo_unsafe}`
110error[E0277]: expected an `FnOnce()` closure, found `unsafe fn() {foo_unsafe}`
111111 --> $DIR/fn-traits.rs:38:15
112112 |
113113LL | call_once(foo_unsafe);
tests/ui/suggestions/restrict-bound-already-has-generic-args.rs created+27
......@@ -0,0 +1,27 @@
1// Regression test for https://github.com/rust-lang/rust/issues/142803.
2
3trait Pair {
4 type Left;
5 type Right;
6
7 fn split(self) -> (Self::Left, Self::Right);
8}
9
10impl<A, B> Pair for (A, B) {
11 type Left = A;
12 type Right = B;
13
14 fn split(self) -> (Self::Left, Self::Right) {
15 self
16 }
17}
18
19fn frob<A, B>(pair: impl Pair<Left = A>) -> impl Pair<Left = A, Right = B> {
20 //~^ ERROR type mismatch
21 //~| HELP consider further restricting this bound
22 //~| SUGGESTION , Right = B
23 let (left, right) = pair.split();
24 (left, right)
25}
26
27fn main() {}
tests/ui/suggestions/restrict-bound-already-has-generic-args.stderr created+24
......@@ -0,0 +1,24 @@
1error[E0271]: type mismatch resolving `<(A, <impl Pair<Left = A> as Pair>::Right) as Pair>::Right == B`
2 --> $DIR/restrict-bound-already-has-generic-args.rs:19:45
3 |
4LL | fn frob<A, B>(pair: impl Pair<Left = A>) -> impl Pair<Left = A, Right = B> {
5 | - expected this type parameter ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ type mismatch resolving `<(A, <impl Pair<Left = A> as Pair>::Right) as Pair>::Right == B`
6...
7LL | (left, right)
8 | ------------- return type was inferred to be `(A, <impl Pair<Left = A> as Pair>::Right)` here
9 |
10note: expected this to be `B`
11 --> $DIR/restrict-bound-already-has-generic-args.rs:12:18
12 |
13LL | type Right = B;
14 | ^
15 = note: expected type parameter `B`
16 found associated type `<impl Pair<Left = A> as Pair>::Right`
17help: consider further restricting this bound
18 |
19LL | fn frob<A, B>(pair: impl Pair<Left = A, Right = B>) -> impl Pair<Left = A, Right = B> {
20 | +++++++++++
21
22error: aborting due to 1 previous error
23
24For more information about this error, try `rustc --explain E0271`.
tests/ui/trait-bounds/mismatch-fn-trait.stderr+5-5
......@@ -1,4 +1,4 @@
1error[E0277]: expected a `FnMut(i32)` closure, found `impl FnMut(u32)`
1error[E0277]: expected an `FnMut(i32)` closure, found `impl FnMut(u32)`
22 --> $DIR/mismatch-fn-trait.rs:4:10
33 |
44LL | take(f)
......@@ -14,7 +14,7 @@ note: required by a bound in `take`
1414LL | fn take(_f: impl FnMut(i32)) {}
1515 | ^^^^^^^^^^ required by this bound in `take`
1616
17error[E0277]: expected a `FnMut(i32)` closure, found `impl FnMut(i32, i32)`
17error[E0277]: expected an `FnMut(i32)` closure, found `impl FnMut(i32, i32)`
1818 --> $DIR/mismatch-fn-trait.rs:9:10
1919 |
2020LL | take(f)
......@@ -29,7 +29,7 @@ note: required by a bound in `take`
2929LL | fn take(_f: impl FnMut(i32)) {}
3030 | ^^^^^^^^^^ required by this bound in `take`
3131
32error[E0277]: expected a `FnMut(i32)` closure, found `impl FnMut()`
32error[E0277]: expected an `FnMut(i32)` closure, found `impl FnMut()`
3333 --> $DIR/mismatch-fn-trait.rs:14:10
3434 |
3535LL | take(f)
......@@ -44,7 +44,7 @@ note: required by a bound in `take`
4444LL | fn take(_f: impl FnMut(i32)) {}
4545 | ^^^^^^^^^^ required by this bound in `take`
4646
47error[E0277]: expected a `FnMut(i32)` closure, found `impl FnOnce(i32)`
47error[E0277]: expected an `FnMut(i32)` closure, found `impl FnOnce(i32)`
4848 --> $DIR/mismatch-fn-trait.rs:19:10
4949 |
5050LL | take(f)
......@@ -59,7 +59,7 @@ note: required by a bound in `take`
5959LL | fn take(_f: impl FnMut(i32)) {}
6060 | ^^^^^^^^^^ required by this bound in `take`
6161
62error[E0277]: expected a `FnMut(i32)` closure, found `impl FnOnce(u32)`
62error[E0277]: expected an `FnMut(i32)` closure, found `impl FnOnce(u32)`
6363 --> $DIR/mismatch-fn-trait.rs:24:10
6464 |
6565LL | take(f)
tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.rs+1-1
......@@ -11,5 +11,5 @@ fn f<T: for<'r> X<'r> + ?Sized>() {
1111
1212fn main() {
1313 f::<dyn for<'x> X<'x, F = i32>>();
14 //~^ ERROR expected a `FnOnce(&i32)` closure, found `i32`
14 //~^ ERROR expected an `FnOnce(&i32)` closure, found `i32`
1515}
tests/ui/traits/associated_type_bound/check-trait-object-bounds-2.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0277]: expected a `FnOnce(&i32)` closure, found `i32`
1error[E0277]: expected an `FnOnce(&i32)` closure, found `i32`
22 --> $DIR/check-trait-object-bounds-2.rs:13:9
33 |
44LL | f::<dyn for<'x> X<'x, F = i32>>();
tests/ui/traits/issue-87558.stderr+1-1
......@@ -32,7 +32,7 @@ LL | impl Fn(&isize) for Error {
3232 |
3333 = help: implement the missing item: `fn call(&self, _: (&isize,)) -> <Self as FnOnce<(&isize,)>>::Output { todo!() }`
3434
35error[E0277]: expected a `FnMut(&isize)` closure, found `Error`
35error[E0277]: expected an `FnMut(&isize)` closure, found `Error`
3636 --> $DIR/issue-87558.rs:3:21
3737 |
3838LL | impl Fn(&isize) for Error {
tests/ui/traits/next-solver/diagnostics/const-host-effect-hrtb-no-ice.rs+1-1
......@@ -7,7 +7,7 @@ const fn with_positive<F: for<'a> [const] Fn(&'a ())>() {}
77
88const _: () = {
99 with_positive::<()>();
10 //~^ ERROR expected a `Fn(&'a ())` closure, found `()`
10 //~^ ERROR expected an `Fn(&'a ())` closure, found `()`
1111 //~| ERROR type mismatch resolving `<() as FnOnce<(&(),)>>::Output == ()`
1212};
1313
tests/ui/traits/next-solver/diagnostics/const-host-effect-hrtb-no-ice.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0277]: expected a `Fn(&'a ())` closure, found `()`
1error[E0277]: expected an `Fn(&'a ())` closure, found `()`
22 --> $DIR/const-host-effect-hrtb-no-ice.rs:9:21
33 |
44LL | with_positive::<()>();
tests/ui/traits/next-solver/fn-trait.rs+4-4
......@@ -18,11 +18,11 @@ fn main() {
1818 require_fn(f);
1919 require_fn(f as fn() -> i32);
2020 require_fn(f as unsafe fn() -> i32);
21 //~^ ERROR: expected a `Fn()` closure, found `unsafe fn() -> i32`
21 //~^ ERROR: expected an `Fn()` closure, found `unsafe fn() -> i32`
2222 require_fn(g);
23 //~^ ERROR: expected a `Fn()` closure, found `extern "C" fn() -> i32 {g}`
23 //~^ ERROR: expected an `Fn()` closure, found `extern "C" fn() -> i32 {g}`
2424 require_fn(g as extern "C" fn() -> i32);
25 //~^ ERROR: expected a `Fn()` closure, found `extern "C" fn() -> i32`
25 //~^ ERROR: expected an `Fn()` closure, found `extern "C" fn() -> i32`
2626 require_fn(h);
27 //~^ ERROR: expected a `Fn()` closure, found `unsafe fn() -> i32 {h}`
27 //~^ ERROR: expected an `Fn()` closure, found `unsafe fn() -> i32 {h}`
2828}
tests/ui/traits/next-solver/fn-trait.stderr+4-4
......@@ -1,4 +1,4 @@
1error[E0277]: expected a `Fn()` closure, found `unsafe fn() -> i32`
1error[E0277]: expected an `Fn()` closure, found `unsafe fn() -> i32`
22 --> $DIR/fn-trait.rs:20:16
33 |
44LL | require_fn(f as unsafe fn() -> i32);
......@@ -15,7 +15,7 @@ note: required by a bound in `require_fn`
1515LL | fn require_fn(_: impl Fn() -> i32) {}
1616 | ^^^^^^^^^^^ required by this bound in `require_fn`
1717
18error[E0277]: expected a `Fn()` closure, found `extern "C" fn() -> i32 {g}`
18error[E0277]: expected an `Fn()` closure, found `extern "C" fn() -> i32 {g}`
1919 --> $DIR/fn-trait.rs:22:16
2020 |
2121LL | require_fn(g);
......@@ -31,7 +31,7 @@ note: required by a bound in `require_fn`
3131LL | fn require_fn(_: impl Fn() -> i32) {}
3232 | ^^^^^^^^^^^ required by this bound in `require_fn`
3333
34error[E0277]: expected a `Fn()` closure, found `extern "C" fn() -> i32`
34error[E0277]: expected an `Fn()` closure, found `extern "C" fn() -> i32`
3535 --> $DIR/fn-trait.rs:24:16
3636 |
3737LL | require_fn(g as extern "C" fn() -> i32);
......@@ -47,7 +47,7 @@ note: required by a bound in `require_fn`
4747LL | fn require_fn(_: impl Fn() -> i32) {}
4848 | ^^^^^^^^^^^ required by this bound in `require_fn`
4949
50error[E0277]: expected a `Fn()` closure, found `unsafe fn() -> i32 {h}`
50error[E0277]: expected an `Fn()` closure, found `unsafe fn() -> i32 {h}`
5151 --> $DIR/fn-trait.rs:26:16
5252 |
5353LL | require_fn(h);
tests/ui/type-alias-impl-trait/issue-63279.rs+2-2
......@@ -4,11 +4,11 @@ type Closure = impl FnOnce();
44
55#[define_opaque(Closure)]
66fn c() -> Closure {
7 //~^ ERROR: expected a `FnOnce()` closure, found `()`
7 //~^ ERROR: expected an `FnOnce()` closure, found `()`
88 || -> Closure { || () }
99 //~^ ERROR: mismatched types
1010 //~| ERROR: mismatched types
11 //~| ERROR: expected a `FnOnce()` closure, found `()`
11 //~| ERROR: expected an `FnOnce()` closure, found `()`
1212}
1313
1414fn main() {}
tests/ui/type-alias-impl-trait/issue-63279.stderr+2-2
......@@ -1,4 +1,4 @@
1error[E0277]: expected a `FnOnce()` closure, found `()`
1error[E0277]: expected an `FnOnce()` closure, found `()`
22 --> $DIR/issue-63279.rs:6:11
33 |
44LL | fn c() -> Closure {
......@@ -7,7 +7,7 @@ LL | fn c() -> Closure {
77 = help: the trait `FnOnce()` is not implemented for `()`
88 = note: wrap the `()` in a closure with no arguments: `|| { /* code */ }`
99
10error[E0277]: expected a `FnOnce()` closure, found `()`
10error[E0277]: expected an `FnOnce()` closure, found `()`
1111 --> $DIR/issue-63279.rs:8:11
1212 |
1313LL | || -> Closure { || () }
tests/ui/type-alias-impl-trait/lazy_subtyping_of_opaques.rs+2-2
......@@ -8,10 +8,10 @@ type Tait = impl FnOnce() -> ();
88
99#[define_opaque(Tait)]
1010fn reify_as_tait() -> Thunk<Tait> {
11 //~^ ERROR: expected a `FnOnce()` closure, found `()`
11 //~^ ERROR: expected an `FnOnce()` closure, found `()`
1212 Thunk::new(|cont| cont)
1313 //~^ ERROR: mismatched types
14 //~| ERROR: expected a `FnOnce()` closure, found `()`
14 //~| ERROR: expected an `FnOnce()` closure, found `()`
1515}
1616
1717struct Thunk<F>(F);
tests/ui/type-alias-impl-trait/lazy_subtyping_of_opaques.stderr+2-2
......@@ -10,7 +10,7 @@ LL | Thunk::new(|cont| cont)
1010 = note: expected struct `Thunk<_>`
1111 found unit type `()`
1212
13error[E0277]: expected a `FnOnce()` closure, found `()`
13error[E0277]: expected an `FnOnce()` closure, found `()`
1414 --> $DIR/lazy_subtyping_of_opaques.rs:12:23
1515 |
1616LL | Thunk::new(|cont| cont)
......@@ -19,7 +19,7 @@ LL | Thunk::new(|cont| cont)
1919 = help: the trait `FnOnce()` is not implemented for `()`
2020 = note: wrap the `()` in a closure with no arguments: `|| { /* code */ }`
2121
22error[E0277]: expected a `FnOnce()` closure, found `()`
22error[E0277]: expected an `FnOnce()` closure, found `()`
2323 --> $DIR/lazy_subtyping_of_opaques.rs:10:23
2424 |
2525LL | fn reify_as_tait() -> Thunk<Tait> {
tests/ui/unboxed-closures/unboxed-closures-fnmut-as-fn.stderr+1-1
......@@ -1,4 +1,4 @@
1error[E0277]: expected a `Fn(isize)` closure, found `S`
1error[E0277]: expected an `Fn(isize)` closure, found `S`
22 --> $DIR/unboxed-closures-fnmut-as-fn.rs:27:21
33 |
44LL | let x = call_it(&S, 22);
tests/ui/unboxed-closures/unboxed-closures-unsafe-extern-fn.stderr+3-3
......@@ -1,4 +1,4 @@
1error[E0277]: expected a `Fn(&isize)` closure, found `for<'a> unsafe fn(&'a isize) -> isize {square}`
1error[E0277]: expected an `Fn(&isize)` closure, found `for<'a> unsafe fn(&'a isize) -> isize {square}`
22 --> $DIR/unboxed-closures-unsafe-extern-fn.rs:20:21
33 |
44LL | let x = call_it(&square, 22);
......@@ -14,7 +14,7 @@ note: required by a bound in `call_it`
1414LL | fn call_it<F: Fn(&isize) -> isize>(_: &F, _: isize) -> isize {
1515 | ^^^^^^^^^^^^^^^^^^^ required by this bound in `call_it`
1616
17error[E0277]: expected a `FnMut(&isize)` closure, found `for<'a> unsafe fn(&'a isize) -> isize {square}`
17error[E0277]: expected an `FnMut(&isize)` closure, found `for<'a> unsafe fn(&'a isize) -> isize {square}`
1818 --> $DIR/unboxed-closures-unsafe-extern-fn.rs:25:25
1919 |
2020LL | let y = call_it_mut(&mut square, 22);
......@@ -30,7 +30,7 @@ note: required by a bound in `call_it_mut`
3030LL | fn call_it_mut<F: FnMut(&isize) -> isize>(_: &mut F, _: isize) -> isize {
3131 | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `call_it_mut`
3232
33error[E0277]: expected a `FnOnce(&isize)` closure, found `for<'a> unsafe fn(&'a isize) -> isize {square}`
33error[E0277]: expected an `FnOnce(&isize)` closure, found `for<'a> unsafe fn(&'a isize) -> isize {square}`
3434 --> $DIR/unboxed-closures-unsafe-extern-fn.rs:30:26
3535 |
3636LL | let z = call_it_once(square, 22);
tests/ui/unboxed-closures/unboxed-closures-wrong-abi.stderr+3-3
......@@ -1,4 +1,4 @@
1error[E0277]: expected a `Fn(&isize)` closure, found `for<'a> extern "C" fn(&'a isize) -> isize {square}`
1error[E0277]: expected an `Fn(&isize)` closure, found `for<'a> extern "C" fn(&'a isize) -> isize {square}`
22 --> $DIR/unboxed-closures-wrong-abi.rs:20:21
33 |
44LL | let x = call_it(&square, 22);
......@@ -13,7 +13,7 @@ note: required by a bound in `call_it`
1313LL | fn call_it<F: Fn(&isize) -> isize>(_: &F, _: isize) -> isize {
1414 | ^^^^^^^^^^^^^^^^^^^ required by this bound in `call_it`
1515
16error[E0277]: expected a `FnMut(&isize)` closure, found `for<'a> extern "C" fn(&'a isize) -> isize {square}`
16error[E0277]: expected an `FnMut(&isize)` closure, found `for<'a> extern "C" fn(&'a isize) -> isize {square}`
1717 --> $DIR/unboxed-closures-wrong-abi.rs:25:25
1818 |
1919LL | let y = call_it_mut(&mut square, 22);
......@@ -28,7 +28,7 @@ note: required by a bound in `call_it_mut`
2828LL | fn call_it_mut<F: FnMut(&isize) -> isize>(_: &mut F, _: isize) -> isize {
2929 | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `call_it_mut`
3030
31error[E0277]: expected a `FnOnce(&isize)` closure, found `for<'a> extern "C" fn(&'a isize) -> isize {square}`
31error[E0277]: expected an `FnOnce(&isize)` closure, found `for<'a> extern "C" fn(&'a isize) -> isize {square}`
3232 --> $DIR/unboxed-closures-wrong-abi.rs:30:26
3333 |
3434LL | let z = call_it_once(square, 22);
tests/ui/unboxed-closures/unboxed-closures-wrong-arg-type-extern-fn.stderr+3-3
......@@ -1,4 +1,4 @@
1error[E0277]: expected a `Fn(&isize)` closure, found `unsafe fn(isize) -> isize {square}`
1error[E0277]: expected an `Fn(&isize)` closure, found `unsafe fn(isize) -> isize {square}`
22 --> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:21:21
33 |
44LL | let x = call_it(&square, 22);
......@@ -14,7 +14,7 @@ note: required by a bound in `call_it`
1414LL | fn call_it<F: Fn(&isize) -> isize>(_: &F, _: isize) -> isize {
1515 | ^^^^^^^^^^^^^^^^^^^ required by this bound in `call_it`
1616
17error[E0277]: expected a `FnMut(&isize)` closure, found `unsafe fn(isize) -> isize {square}`
17error[E0277]: expected an `FnMut(&isize)` closure, found `unsafe fn(isize) -> isize {square}`
1818 --> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:26:25
1919 |
2020LL | let y = call_it_mut(&mut square, 22);
......@@ -30,7 +30,7 @@ note: required by a bound in `call_it_mut`
3030LL | fn call_it_mut<F: FnMut(&isize) -> isize>(_: &mut F, _: isize) -> isize {
3131 | ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `call_it_mut`
3232
33error[E0277]: expected a `FnOnce(&isize)` closure, found `unsafe fn(isize) -> isize {square}`
33error[E0277]: expected an `FnOnce(&isize)` closure, found `unsafe fn(isize) -> isize {square}`
3434 --> $DIR/unboxed-closures-wrong-arg-type-extern-fn.rs:31:26
3535 |
3636LL | let z = call_it_once(square, 22);