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
4 changes: 2 additions & 2 deletions library/std/src/sys/process/unix/unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -510,8 +510,8 @@ impl Command {
support = SPAWN;
}
}
Err(e) if e.raw_os_error() == Some(libc::EMFILE) => {
// We're temporarily(?) out of file descriptors. In this case pidfd_spawnp would also fail
Err(e) if matches!(e.raw_os_error(), Some(libc::EMFILE | libc::ENFILE | libc::ENOMEM)) => {
// We're temporarily(?) out of file descriptors or memory. In this case pidfd_spawnp would also fail
// Don't update the support flag so we can probe again later.
return Err(e)
}
Expand Down
13 changes: 13 additions & 0 deletions tests/crashes/149748.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//@ known-bug: #149748
//@ edition: 2024
//@ compile-flags: -Zmir-enable-passes=+Inline -Zmir-enable-passes=+ReferencePropagation -Zlint-mir

#![feature(gen_blocks)]
gen fn foo(z: i32) -> i32 {
yield z;
z;
}
pub fn main() {
let mut iter = foo(3);
assert_eq!(iter.next(), Some(3))
}
7 changes: 7 additions & 0 deletions tests/crashes/150040.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//@ known-bug: #150040

fn main() {
let [(ref a, b), x];
a = "";
b = 5;
}
12 changes: 12 additions & 0 deletions tests/crashes/150049.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//@ known-bug: #150049
#![feature(min_generic_const_args)]
#![feature(inherent_associated_types)]
struct Foo<'a> {
x: &'a (),
}

impl<'a> Foo<'a> {
fn foo(_: [u8; Foo::X]) { std::mem::transmute([4]) }
}

fn main() {}
8 changes: 8 additions & 0 deletions tests/crashes/150128.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//@ known-bug: #150128
fn main() {
match 0 {
_ => || (),
_ => || (),
_ => (|| ()) as unsafe fn,
};
}
14 changes: 14 additions & 0 deletions tests/crashes/150296.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
//@ known-bug: #150296
#[derive(PartialEq)]
pub struct Thing<const N: usize>;

impl<const N: usize> Thing<N> {
const A: Self = Thing;
}

fn broken<const N: usize>(x: Thing<N>) {
match x {
<Thing<N>>::A => {}
_ => {}
}
}
13 changes: 13 additions & 0 deletions tests/crashes/150387.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
//@ known-bug: #150387
#![feature(min_specialization)]
#![allow(dead_code)]

struct Thing<T>(T) where [T]: Sized;

impl<T> Drop for Thing<T> where [T]: Sized {
default fn drop(&mut self) {}
}
impl<T> Drop for Thing<T> where [T]: Sized {
fn drop(&mut self) {}
}
fn main() {}
26 changes: 26 additions & 0 deletions tests/crashes/150403.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
//@ known-bug: #150403
#![feature(non_lifetime_binders)]

trait A {
type GAT<T>: A;
fn foo<T>(self, t: T) -> Self::GAT<T>
where
Self: Sized;
}

trait B: A where
for<T> Self::GAT<T>: B,
{
fn bar<T>(self) -> Self::GAT<T>
where
Self: Sized;

fn baz<T>(self, t: T) -> Self::GAT<T>
where
Self: Sized,
{
self.foo(t).bar()
}
}

fn main() {}
15 changes: 15 additions & 0 deletions tests/crashes/150517.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//@ known-bug: #150517
trait Stream {
type Item;
fn next(self) -> ();
}
impl Stream for &'a () {}
impl<'a, A> Stream for <&A as Stream>::Item {}
trait StreamExt {
fn f(self) -> ()
where
for<'b> &'b A: Stream,
{
self.next()
}
}
8 changes: 8 additions & 0 deletions tests/crashes/150545.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
//@ known-bug: #150545
#![feature(non_lifetime_binders)]
trait Foo: for<T> Bar<T> {
type Item;
fn next(self) -> Self::Item;
}
trait Bar<T> {}
fn main() {}
12 changes: 12 additions & 0 deletions tests/crashes/150749.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//@ known-bug: #150749
#![feature(min_generic_const_args)]

trait CollectArray {
fn inner_array();
}
impl CollectArray for () {
fn inner_array() {
let temp_ptr: [(); Self];
}
}
fn main() {}
7 changes: 7 additions & 0 deletions tests/crashes/150969.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//@ known-bug: #150969
#![feature(generic_const_exprs)]
#![feature(min_generic_const_args)]

fn pass_enum<const N : usize, const M : usize = const {N}> {
pass_enum::<{None}>
}
16 changes: 16 additions & 0 deletions tests/crashes/151069.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
//@ known-bug: #151069
trait Trait {
type Assoc2;
}
struct Bar;
impl Trait for Bar
where
<Bar as Trait>::Assoc2: Trait,
{
type Assoc2 = ();
}
struct Foo {
field: <Bar as Trait>::Assoc2,
}
static FOO2: &Foo = 0;
fn main() {}
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
Loading
Loading