Skip to content

Commit 32abbdc

Browse files
Pretty print Fn traits in rustc_on_unimplemented
1 parent 4910642 commit 32abbdc

File tree

55 files changed

+151
-136
lines changed

Some content is hidden

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

55 files changed

+151
-136
lines changed

compiler/rustc_span/src/symbol.rs

+1
Original file line numberDiff line numberDiff line change
@@ -295,6 +295,7 @@ symbols! {
295295
ToOwned,
296296
ToString,
297297
TokenStream,
298+
Trait,
298299
Try,
299300
TryCaptureGeneric,
300301
TryCapturePrintable,

compiler/rustc_trait_selection/src/traits/error_reporting/on_unimplemented.rs

+14
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ static ALLOWED_FORMAT_SYMBOLS: &[Symbol] = &[
5050
sym::float,
5151
sym::_Self,
5252
sym::crate_local,
53+
sym::Trait,
5354
];
5455

5556
impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
@@ -180,6 +181,19 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
180181
flags.push((sym::cause, Some("MainFunctionType".to_string())));
181182
}
182183

184+
if let Some(kind) = self.tcx.fn_trait_kind_from_def_id(trait_ref.def_id)
185+
&& let ty::Tuple(args) = trait_ref.args.type_at(1).kind()
186+
{
187+
let args = args
188+
.iter()
189+
.map(|ty| ty.to_string())
190+
.collect::<Vec<_>>()
191+
.join(", ");
192+
flags.push((sym::Trait, Some(format!("{}({args})", kind.as_str()))));
193+
} else {
194+
flags.push((sym::Trait, Some(trait_ref.print_only_trait_path().to_string())));
195+
}
196+
183197
// Add all types without trimmed paths.
184198
ty::print::with_no_trimmed_paths!({
185199
let generics = self.tcx.generics_of(def_id);

library/core/src/ops/function.rs

+12-12
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ use crate::marker::Tuple;
5656
#[lang = "fn"]
5757
#[stable(feature = "rust1", since = "1.0.0")]
5858
#[rustc_paren_sugar]
59-
#[rustc_on_unimplemented(
59+
#[cfg_attr(not(bootstrap), rustc_on_unimplemented(
6060
on(
6161
Args = "()",
6262
note = "wrap the `{Self}` in a closure with no arguments: `|| {{ /* code */ }}`"
@@ -67,9 +67,9 @@ 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 `{Fn}<{Args}>` closure, found `{Self}`",
71-
label = "expected an `Fn<{Args}>` closure, found `{Self}`"
72-
)]
70+
message = "expected a `{Trait}` closure, found `{Self}`",
71+
label = "expected an `{Trait}` closure, found `{Self}`"
72+
))]
7373
#[fundamental] // so that regex can rely that `&str: !FnMut`
7474
#[must_use = "closures are lazy and do nothing unless called"]
7575
// FIXME(effects) #[const_trait]
@@ -143,7 +143,7 @@ pub trait Fn<Args: Tuple>: FnMut<Args> {
143143
#[lang = "fn_mut"]
144144
#[stable(feature = "rust1", since = "1.0.0")]
145145
#[rustc_paren_sugar]
146-
#[rustc_on_unimplemented(
146+
#[cfg_attr(not(bootstrap), rustc_on_unimplemented(
147147
on(
148148
Args = "()",
149149
note = "wrap the `{Self}` in a closure with no arguments: `|| {{ /* code */ }}`"
@@ -154,9 +154,9 @@ pub trait Fn<Args: Tuple>: 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 `{FnMut}<{Args}>` closure, found `{Self}`",
158-
label = "expected an `FnMut<{Args}>` closure, found `{Self}`"
159-
)]
157+
message = "expected a `{Trait}` closure, found `{Self}`",
158+
label = "expected an `{Trait}` closure, found `{Self}`"
159+
))]
160160
#[fundamental] // so that regex can rely that `&str: !FnMut`
161161
#[must_use = "closures are lazy and do nothing unless called"]
162162
// FIXME(effects) #[const_trait]
@@ -222,7 +222,7 @@ pub trait FnMut<Args: Tuple>: FnOnce<Args> {
222222
#[lang = "fn_once"]
223223
#[stable(feature = "rust1", since = "1.0.0")]
224224
#[rustc_paren_sugar]
225-
#[rustc_on_unimplemented(
225+
#[cfg_attr(not(bootstrap), rustc_on_unimplemented(
226226
on(
227227
Args = "()",
228228
note = "wrap the `{Self}` in a closure with no arguments: `|| {{ /* code */ }}`"
@@ -233,9 +233,9 @@ pub 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 `{FnOnce}<{Args}>` closure, found `{Self}`",
237-
label = "expected an `FnOnce<{Args}>` closure, found `{Self}`"
238-
)]
236+
message = "expected a `{Trait}` closure, found `{Self}`",
237+
label = "expected an `{Trait}` closure, found `{Self}`"
238+
))]
239239
#[fundamental] // so that regex can rely that `&str: !FnMut`
240240
#[must_use = "closures are lazy and do nothing unless called"]
241241
// FIXME(effects) #[const_trait]

tests/ui/closures/closure-expected.rs

+1-1
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 a `FnOnce()` closure, found `{integer}`
55
}

tests/ui/closures/closure-expected.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error[E0277]: expected a `FnOnce<()>` closure, found `{integer}`
1+
error[E0277]: expected a `FnOnce()` closure, found `{integer}`
22
--> $DIR/closure-expected.rs:3:23
33
|
44
LL | let y = x.or_else(4);
5-
| ------- ^ expected an `FnOnce<()>` closure, found `{integer}`
5+
| ------- ^ expected an `FnOnce()` closure, found `{integer}`
66
| |
77
| required by a bound introduced by this call
88
|

tests/ui/closures/coerce-unsafe-to-closure.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error[E0277]: expected a `FnOnce<(&str,)>` closure, found `unsafe extern "rust-intrinsic" fn(_) -> _ {transmute::<_, _>}`
1+
error[E0277]: expected a `FnOnce(&str)` closure, found `unsafe extern "rust-intrinsic" fn(_) -> _ {transmute::<_, _>}`
22
--> $DIR/coerce-unsafe-to-closure.rs:2:44
33
|
44
LL | let x: Option<&[u8]> = Some("foo").map(std::mem::transmute);

tests/ui/extern/extern-wrong-value-type.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -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 a `Fn()` closure, found `extern "C" fn() {f}`
1111
}

tests/ui/extern/extern-wrong-value-type.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error[E0277]: expected a `Fn<()>` closure, found `extern "C" fn() {f}`
1+
error[E0277]: expected a `Fn()` closure, found `extern "C" fn() {f}`
22
--> $DIR/extern-wrong-value-type.rs:9:11
33
|
44
LL | is_fn(f);
5-
| ----- ^ expected an `Fn<()>` closure, found `extern "C" fn() {f}`
5+
| ----- ^ expected an `Fn()` closure, found `extern "C" fn() {f}`
66
| |
77
| required by a bound introduced by this call
88
|

tests/ui/fn/fn-trait-formatting.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ fn main() {
1717
//~| found struct `Box<dyn FnMut() -> isize>`
1818

1919
needs_fn(1);
20-
//~^ ERROR expected a `Fn<(isize,)>` closure, found `{integer}`
20+
//~^ ERROR expected a `Fn(isize)` closure, found `{integer}`
2121
}

tests/ui/fn/fn-trait-formatting.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ LL | let _: () = Box::new(|| -> isize { unimplemented!() }) as Box<dyn FnMut
3939
= note: expected unit type `()`
4040
found struct `Box<dyn FnMut() -> isize>`
4141

42-
error[E0277]: expected a `Fn<(isize,)>` closure, found `{integer}`
42+
error[E0277]: expected a `Fn(isize)` closure, found `{integer}`
4343
--> $DIR/fn-trait-formatting.rs:19:14
4444
|
4545
LL | needs_fn(1);
46-
| -------- ^ expected an `Fn<(isize,)>` closure, found `{integer}`
46+
| -------- ^ expected an `Fn(isize)` closure, found `{integer}`
4747
| |
4848
| required by a bound introduced by this call
4949
|

tests/ui/generic-associated-types/issue-68642-broken-llvm-ir.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ trait Fun {
1010

1111
impl<T> Fun for T {
1212
type F<'a> = Self;
13-
//~^ ERROR expected a `Fn<()>` closure, found `T`
13+
//~^ ERROR expected a `Fn()` closure, found `T`
1414
}
1515

1616
fn main() {

tests/ui/generic-associated-types/issue-68642-broken-llvm-ir.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error[E0277]: expected a `Fn<()>` closure, found `T`
1+
error[E0277]: expected a `Fn()` closure, found `T`
22
--> $DIR/issue-68642-broken-llvm-ir.rs:12:18
33
|
44
LL | type F<'a> = Self;
5-
| ^^^^ expected an `Fn<()>` closure, found `T`
5+
| ^^^^ expected an `Fn()` closure, found `T`
66
|
77
= note: wrap the `T` in a closure with no arguments: `|| { /* code */ }`
88
note: required by a bound in `Fun::F`

tests/ui/generic-associated-types/issue-68643-broken-mir.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ trait Fun {
1010

1111
impl<T> Fun for T {
1212
type F<'a> = Self;
13-
//~^ ERROR expected a `Fn<()>` closure, found `T`
13+
//~^ ERROR expected a `Fn()` closure, found `T`
1414
}
1515

1616
pub fn main() {

tests/ui/generic-associated-types/issue-68643-broken-mir.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error[E0277]: expected a `Fn<()>` closure, found `T`
1+
error[E0277]: expected a `Fn()` closure, found `T`
22
--> $DIR/issue-68643-broken-mir.rs:12:18
33
|
44
LL | type F<'a> = Self;
5-
| ^^^^ expected an `Fn<()>` closure, found `T`
5+
| ^^^^ expected an `Fn()` closure, found `T`
66
|
77
= note: wrap the `T` in a closure with no arguments: `|| { /* code */ }`
88
note: required by a bound in `Fun::F`

tests/ui/generic-associated-types/issue-68644-codegen-selection.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ trait Fun {
1010

1111
impl<T> Fun for T {
1212
type F<'a> = Self;
13-
//~^ ERROR expected a `Fn<()>` closure, found `T`
13+
//~^ ERROR expected a `Fn()` closure, found `T`
1414
}
1515

1616
fn main() {

tests/ui/generic-associated-types/issue-68644-codegen-selection.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error[E0277]: expected a `Fn<()>` closure, found `T`
1+
error[E0277]: expected a `Fn()` closure, found `T`
22
--> $DIR/issue-68644-codegen-selection.rs:12:18
33
|
44
LL | type F<'a> = Self;
5-
| ^^^^ expected an `Fn<()>` closure, found `T`
5+
| ^^^^ expected an `Fn()` closure, found `T`
66
|
77
= note: wrap the `T` in a closure with no arguments: `|| { /* code */ }`
88
note: required by a bound in `Fun::F`

tests/ui/generic-associated-types/issue-68645-codegen-fulfillment.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ trait Fun {
1010

1111
impl<T> Fun for T {
1212
type F<'a> = Self;
13-
//~^ ERROR expected a `Fn<()>` closure, found `T`
13+
//~^ ERROR expected a `Fn()` closure, found `T`
1414
}
1515

1616
fn main() {

tests/ui/generic-associated-types/issue-68645-codegen-fulfillment.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error[E0277]: expected a `Fn<()>` closure, found `T`
1+
error[E0277]: expected a `Fn()` closure, found `T`
22
--> $DIR/issue-68645-codegen-fulfillment.rs:12:18
33
|
44
LL | type F<'a> = Self;
5-
| ^^^^ expected an `Fn<()>` closure, found `T`
5+
| ^^^^ expected an `Fn()` closure, found `T`
66
|
77
= note: wrap the `T` in a closure with no arguments: `|| { /* code */ }`
88
note: required by a bound in `Fun::F`

tests/ui/higher-ranked/trait-bounds/fn-ptr.classic.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error[E0277]: expected a `Fn<(&'w (),)>` closure, found `fn(&'w ())`
1+
error[E0277]: expected a `Fn(&'w ())` closure, found `fn(&'w ())`
22
--> $DIR/fn-ptr.rs:12:5
33
|
44
LL | ice();
5-
| ^^^ expected an `Fn<(&'w (),)>` closure, found `fn(&'w ())`
5+
| ^^^ expected an `Fn(&'w ())` closure, found `fn(&'w ())`
66
|
77
= help: the trait `for<'w> Fn<(&'w (),)>` is not implemented for `fn(&'w ())`
88
note: required by a bound in `ice`

tests/ui/higher-ranked/trait-bounds/fn-ptr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ where
1010

1111
fn main() {
1212
ice();
13-
//[classic]~^ ERROR expected a `Fn<(&'w (),)>` closure, found `fn(&'w ())`
13+
//[classic]~^ ERROR expected a `Fn(&'w ())` closure, found `fn(&'w ())`
1414
}

tests/ui/higher-ranked/trait-bounds/normalize-under-binder/issue-62529-3.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error[E0277]: expected a `Fn<(<_ as ATC<'a>>::Type,)>` closure, found `F`
1+
error[E0277]: expected a `Fn(<_ as ATC<'a>>::Type)` closure, found `F`
22
--> $DIR/issue-62529-3.rs:25:14
33
|
44
LL | call(f, ());
5-
| ---- ^ expected an `Fn<(<_ as ATC<'a>>::Type,)>` closure, found `F`
5+
| ---- ^ expected an `Fn(<_ as ATC<'a>>::Type)` closure, found `F`
66
| |
77
| required by a bound introduced by this call
88
|

tests/ui/implied-bounds/issue-100690.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ impl<'a, T: 'a> Handle<'a, T, UIView<'a, T>, Result<(), io::Error>> for TUIHandl
3535
F: FnOnce(&mut UIView<'a, T>) -> Result<(), io::Error> + Send + 'static,
3636
{
3737
real_dispatch(f)
38-
//~^ ERROR expected a `FnOnce<(&mut UIView<'_, T>,)>` closure, found `F`
39-
//~| NOTE expected an `FnOnce<(&mut UIView<'_, T>,)>` closure, found `F`
38+
//~^ ERROR expected a `FnOnce(&mut UIView<'_, T>)` closure, found `F`
39+
//~| NOTE expected an `FnOnce(&mut UIView<'_, T>)` closure, found `F`
4040
//~| NOTE expected a closure with arguments
4141
//~| NOTE required by a bound introduced by this call
4242
}

tests/ui/implied-bounds/issue-100690.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error[E0277]: expected a `FnOnce<(&mut UIView<'_, T>,)>` closure, found `F`
1+
error[E0277]: expected a `FnOnce(&mut UIView<'_, T>)` closure, found `F`
22
--> $DIR/issue-100690.rs:37:23
33
|
44
LL | real_dispatch(f)
5-
| ------------- ^ expected an `FnOnce<(&mut UIView<'_, T>,)>` closure, found `F`
5+
| ------------- ^ expected an `FnOnce(&mut UIView<'_, T>)` closure, found `F`
66
| |
77
| required by a bound introduced by this call
88
|

tests/ui/intrinsics/const-eval-select-bad.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ const fn not_fn_items() {
88
//~^ ERROR this argument must be a function item
99
//~| ERROR this argument must be a function item
1010
const_eval_select((), 42, 0xDEADBEEF);
11-
//~^ ERROR expected a `FnOnce<()>` closure
12-
//~| ERROR expected a `FnOnce<()>` closure
11+
//~^ ERROR expected a `FnOnce()` closure
12+
//~| ERROR expected a `FnOnce()` closure
1313
//~| ERROR this argument must be a function item
1414
//~| ERROR this argument must be a function item
1515
}

tests/ui/intrinsics/const-eval-select-bad.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ LL | const_eval_select((), 42, 0xDEADBEEF);
2525
= note: expected a function item, found {integer}
2626
= help: consult the documentation on `const_eval_select` for more information
2727

28-
error[E0277]: expected a `FnOnce<()>` closure, found `{integer}`
28+
error[E0277]: expected a `FnOnce()` closure, found `{integer}`
2929
--> $DIR/const-eval-select-bad.rs:10:27
3030
|
3131
LL | const_eval_select((), 42, 0xDEADBEEF);
32-
| ----------------- ^^ expected an `FnOnce<()>` closure, found `{integer}`
32+
| ----------------- ^^ expected an `FnOnce()` closure, found `{integer}`
3333
| |
3434
| required by a bound introduced by this call
3535
|
@@ -47,11 +47,11 @@ LL | const_eval_select((), 42, 0xDEADBEEF);
4747
= note: expected a function item, found {integer}
4848
= help: consult the documentation on `const_eval_select` for more information
4949

50-
error[E0277]: expected a `FnOnce<()>` closure, found `{integer}`
50+
error[E0277]: expected a `FnOnce()` closure, found `{integer}`
5151
--> $DIR/const-eval-select-bad.rs:10:31
5252
|
5353
LL | const_eval_select((), 42, 0xDEADBEEF);
54-
| ----------------- ^^^^^^^^^^ expected an `FnOnce<()>` closure, found `{integer}`
54+
| ----------------- ^^^^^^^^^^ expected an `FnOnce()` closure, found `{integer}`
5555
| |
5656
| required by a bound introduced by this call
5757
|

tests/ui/issues/issue-22034.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ fn main() {
66
let ptr: *mut () = core::ptr::null_mut();
77
let _: &mut dyn Fn() = unsafe {
88
&mut *(ptr as *mut dyn Fn())
9-
//~^ ERROR expected a `Fn<()>` closure, found `()`
9+
//~^ ERROR expected a `Fn()` closure, found `()`
1010
};
1111
}

tests/ui/issues/issue-22034.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error[E0277]: expected a `Fn<()>` closure, found `()`
1+
error[E0277]: expected a `Fn()` closure, found `()`
22
--> $DIR/issue-22034.rs:8:16
33
|
44
LL | &mut *(ptr as *mut dyn Fn())
5-
| ^^^ expected an `Fn<()>` closure, found `()`
5+
| ^^^ expected an `Fn()` closure, found `()`
66
|
77
= help: the trait `Fn<()>` is not implemented for `()`
88
= note: wrap the `()` in a closure with no arguments: `|| { /* code */ }`

tests/ui/issues/issue-23966.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error[E0277]: expected a `FnMut<(_, char)>` closure, found `()`
1+
error[E0277]: expected a `FnMut(_, char)` closure, found `()`
22
--> $DIR/issue-23966.rs:2:32
33
|
44
LL | "".chars().fold(|_, _| (), ());
5-
| ---- ^^ expected an `FnMut<(_, char)>` closure, found `()`
5+
| ---- ^^ expected an `FnMut(_, char)` closure, found `()`
66
| |
77
| required by a bound introduced by this call
88
|

tests/ui/issues/issue-59494.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,5 @@ fn main() {
1919
let g = |(a, _)| a;
2020
let t7 = |env| |a| |b| t7p(f, g)(((env, a), b));
2121
let t8 = t8n(t7, t7p(f, g));
22-
//~^ ERROR: expected a `Fn<(_,)>` closure, found `impl Fn(((_, _), _))` [E0277]
22+
//~^ ERROR: expected a `Fn(_)` closure, found `impl Fn(((_, _), _))` [E0277]
2323
}

tests/ui/issues/issue-59494.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
error[E0277]: expected a `Fn<(_,)>` closure, found `impl Fn(((_, _), _))`
1+
error[E0277]: expected a `Fn(_)` closure, found `impl Fn(((_, _), _))`
22
--> $DIR/issue-59494.rs:21:22
33
|
44
LL | let t8 = t8n(t7, t7p(f, g));
5-
| --- ^^^^^^^^^ expected an `Fn<(_,)>` closure, found `impl Fn(((_, _), _))`
5+
| --- ^^^^^^^^^ expected an `Fn(_)` closure, found `impl Fn(((_, _), _))`
66
| |
77
| required by a bound introduced by this call
88
|

tests/ui/mismatched_types/suggest-option-asderef-unfixable.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -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 a `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 a `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);

0 commit comments

Comments
 (0)