Skip to content

Commit e6bd6c2

Browse files
committed
Use parenthetical notation for Fn traits
Always use the `Fn(T) -> R` format when printing closure traits instead of `Fn<(T,), Output = R>`. Fix #67100: ``` error[E0277]: expected a `Fn()` closure, found `F` --> file.rs:6:13 | 6 | call_fn(f) | ------- ^ expected an `Fn()` closure, found `F` | | | required by a bound introduced by this call | = note: wrap the `F` in a closure with no arguments: `|| { /* code */ }` note: required by a bound in `call_fn` --> file.rs:1:15 | 1 | fn call_fn<F: Fn() -> ()>(f: &F) { | ^^^^^^^^^^ required by this bound in `call_fn` help: consider further restricting this bound | 5 | fn call_any<F: std::any::Any + Fn()>(f: &F) { | ++++++ ```
1 parent 8c4db85 commit e6bd6c2

File tree

43 files changed

+89
-88
lines changed

Some content is hidden

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

43 files changed

+89
-88
lines changed

compiler/rustc_borrowck/src/diagnostics/conflict_errors.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1362,7 +1362,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
13621362
match *predicate.self_ty().kind() {
13631363
ty::Param(param_ty) => Ok((
13641364
generics.type_param(param_ty, tcx),
1365-
predicate.trait_ref.print_only_trait_path().to_string(),
1365+
predicate.trait_ref.print_trait_sugared().to_string(),
13661366
)),
13671367
_ => Err(()),
13681368
}

compiler/rustc_const_eval/src/check_consts/ops.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ impl<'tcx> NonConstOp<'tcx> for FnCallNonConst<'tcx> {
113113
if let Some(generics) = tcx.hir_node_by_def_id(caller).generics() {
114114
let constraint = with_no_trimmed_paths!(format!(
115115
"~const {}",
116-
trait_ref.print_only_trait_path()
116+
trait_ref.print_trait_sugared(),
117117
));
118118
suggest_constraining_type_param(
119119
tcx,

compiler/rustc_hir_analysis/src/coherence/builtin.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ fn infringing_fields_error(
554554
if let ty::Param(_) = ty.kind() {
555555
bounds.push((
556556
format!("{ty}"),
557-
trait_ref.print_only_trait_path().to_string(),
557+
trait_ref.print_trait_sugared().to_string(),
558558
Some(trait_ref.def_id),
559559
));
560560
}

compiler/rustc_middle/src/ty/print/pretty.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -3197,7 +3197,7 @@ define_print_and_forward_display! {
31973197
if let ty::PredicatePolarity::Negative = self.0.polarity {
31983198
p!("!")
31993199
}
3200-
p!(print(self.0.trait_ref.print_only_trait_path()));
3200+
p!(print(self.0.trait_ref.print_trait_sugared()));
32013201
}
32023202

32033203
PrintClosureAsImpl<'tcx> {

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

+6-5
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,11 @@ use rustc_macros::extension;
2929
use rustc_middle::hir::map;
3030
use rustc_middle::traits::IsConstable;
3131
use rustc_middle::ty::error::TypeError::{self, Sorts};
32+
use rustc_middle::ty::print::PrintPolyTraitRefExt;
3233
use rustc_middle::ty::{
3334
self, suggest_arbitrary_trait_bound, suggest_constraining_type_param, AdtKind, GenericArgs,
34-
InferTy, IsSuggestable, Ty, TyCtxt, TypeFoldable, TypeFolder, TypeSuperFoldable,
35-
TypeVisitableExt, TypeckResults, Upcast,
35+
InferTy, IsSuggestable, ToPolyTraitRef, Ty, TyCtxt, TypeFoldable, TypeFolder,
36+
TypeSuperFoldable, TypeVisitableExt, TypeckResults, Upcast,
3637
};
3738
use rustc_middle::{bug, span_bug};
3839
use rustc_span::def_id::LocalDefId;
@@ -219,15 +220,15 @@ pub fn suggest_restriction<'tcx, G: EmissionGuarantee>(
219220
(_, None) => predicate_constraint(hir_generics, trait_pred.upcast(tcx)),
220221
(None, Some((ident, []))) => (
221222
ident.span.shrink_to_hi(),
222-
format!(": {}", trait_pred.print_modifiers_and_trait_path()),
223+
format!(": {}", trait_pred.to_poly_trait_ref().print_trait_sugared()),
223224
),
224225
(_, Some((_, [.., bounds]))) => (
225226
bounds.span().shrink_to_hi(),
226-
format!(" + {}", trait_pred.print_modifiers_and_trait_path()),
227+
format!(" + {}", trait_pred.to_poly_trait_ref().print_trait_sugared()),
227228
),
228229
(Some(_), Some((_, []))) => (
229230
hir_generics.span.shrink_to_hi(),
230-
format!(": {}", trait_pred.print_modifiers_and_trait_path()),
231+
format!(": {}", trait_pred.to_poly_trait_ref().print_trait_sugared()),
231232
),
232233
};
233234

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ error[E0277]: expected a `FnMut()` closure, found `F`
2828
LL | impl async Fn<()> for F {}
2929
| ^ expected an `FnMut()` closure, found `F`
3030
|
31-
= help: the trait `FnMut<()>` is not implemented for `F`
31+
= help: the trait `FnMut()` is not implemented for `F`
3232
= note: wrap the `F` in a closure with no arguments: `|| { /* code */ }`
3333
note: required by a bound in `Fn`
3434
--> $SRC_DIR/core/src/ops/function.rs:LL:COL

tests/ui/closures/closure-expected.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | let y = x.or_else(4);
66
| |
77
| required by a bound introduced by this call
88
|
9-
= help: the trait `FnOnce<()>` is not implemented for `{integer}`
9+
= help: the trait `FnOnce()` is not implemented for `{integer}`
1010
= note: wrap the `{integer}` in a closure with no arguments: `|| { /* code */ }`
1111
note: required by a bound in `Option::<T>::or_else`
1212
--> $SRC_DIR/core/src/option.rs:LL:COL

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | let x: Option<&[u8]> = Some("foo").map(std::mem::transmute);
66
| |
77
| required by a bound introduced by this call
88
|
9-
= help: the trait `FnOnce<(&str,)>` is not implemented for fn item `unsafe extern "rust-intrinsic" fn(_) -> _ {transmute::<_, _>}`
9+
= help: the trait `FnOnce(&str)` is not implemented for fn item `unsafe extern "rust-intrinsic" fn(_) -> _ {transmute::<_, _>}`
1010
= note: unsafe function cannot be called generically without an unsafe block
1111
note: required by a bound in `Option::<T>::map`
1212
--> $SRC_DIR/core/src/option.rs:LL:COL

tests/ui/consts/fn_trait_refs.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ LL | f()
107107
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
108108
help: consider further restricting this bound
109109
|
110-
LL | T: ~const Fn<()> + ~const Destruct + ~const std::ops::Fn<()>,
111-
| +++++++++++++++++++++++++
110+
LL | T: ~const Fn<()> + ~const Destruct + ~const Fn(),
111+
| +++++++++++++
112112
help: add `#![feature(effects)]` to the crate attributes to enable
113113
|
114114
LL + #![feature(effects)]
@@ -132,8 +132,8 @@ LL | f()
132132
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
133133
help: consider further restricting this bound
134134
|
135-
LL | T: ~const FnMut<()> + ~const Destruct + ~const std::ops::FnMut<()>,
136-
| ++++++++++++++++++++++++++++
135+
LL | T: ~const FnMut<()> + ~const Destruct + ~const FnMut(),
136+
| ++++++++++++++++
137137
help: add `#![feature(effects)]` to the crate attributes to enable
138138
|
139139
LL + #![feature(effects)]
@@ -157,8 +157,8 @@ LL | f()
157157
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
158158
help: consider further restricting this bound
159159
|
160-
LL | T: ~const FnOnce<()> + ~const std::ops::FnOnce<()>,
161-
| +++++++++++++++++++++++++++++
160+
LL | T: ~const FnOnce<()> + ~const FnOnce(),
161+
| +++++++++++++++++
162162
help: add `#![feature(effects)]` to the crate attributes to enable
163163
|
164164
LL + #![feature(effects)]

tests/ui/consts/unstable-const-fn-in-libcore.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ LL | Opt::None => f(),
1313
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
1414
help: consider further restricting this bound
1515
|
16-
LL | const fn unwrap_or_else<F: ~const FnOnce() -> T + ~const std::ops::FnOnce<()>>(self, f: F) -> T {
17-
| +++++++++++++++++++++++++++++
16+
LL | const fn unwrap_or_else<F: ~const FnOnce() -> T + ~const FnOnce()>(self, f: F) -> T {
17+
| +++++++++++++++++
1818
help: add `#![feature(effects)]` to the crate attributes to enable
1919
|
2020
LL + #![feature(effects)]

tests/ui/expr/malformed_closure/block_instead_of_closure_in_arg.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ LL | || }
1414
LL | | });
1515
| |______^ expected an `FnOnce(&bool)` closure, found `bool`
1616
|
17-
= help: the trait `for<'a> FnOnce<(&'a bool,)>` is not implemented for `bool`
17+
= help: the trait `for<'a> FnOnce(&'a bool)` is not implemented for `bool`
1818
note: required by a bound in `Option::<T>::filter`
1919
--> $SRC_DIR/core/src/option.rs:LL:COL
2020
help: you might have meant to create the closure instead of a block

tests/ui/expr/malformed_closure/ruby_style_closure_successful_parse.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ LL | | Some(x * 2)
1111
LL | | });
1212
| |_____^ expected an `FnOnce({integer})` closure, found `Option<usize>`
1313
|
14-
= help: the trait `FnOnce<({integer},)>` is not implemented for `Option<usize>`
14+
= help: the trait `FnOnce({integer})` is not implemented for `Option<usize>`
1515
note: required by a bound in `Option::<T>::and_then`
1616
--> $SRC_DIR/core/src/option.rs:LL:COL
1717
help: you might have meant to open the closure body instead of placing a closure within a block

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | is_fn(f);
66
| |
77
| required by a bound introduced by this call
88
|
9-
= help: the trait `Fn<()>` is not implemented for fn item `extern "C" fn() {f}`
9+
= help: the trait `Fn()` is not implemented for fn item `extern "C" fn() {f}`
1010
= note: wrap the `extern "C" fn() {f}` in a closure with no arguments: `|| { /* code */ }`
1111
note: required by a bound in `is_fn`
1212
--> $DIR/extern-wrong-value-type.rs:4:28

tests/ui/feature-gates/feature-gate-unboxed-closures-manual-impls.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ error[E0277]: expected a `FnMut()` closure, found `Foo`
8080
LL | impl Fn<()> for Foo {
8181
| ^^^ expected an `FnMut()` closure, found `Foo`
8282
|
83-
= help: the trait `FnMut<()>` is not implemented for `Foo`
83+
= help: the trait `FnMut()` is not implemented for `Foo`
8484
= note: wrap the `Foo` in a closure with no arguments: `|| { /* code */ }`
8585
note: required by a bound in `Fn`
8686
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
@@ -149,7 +149,7 @@ error[E0277]: expected a `FnOnce()` closure, found `Bar`
149149
LL | impl FnMut<()> for Bar {
150150
| ^^^ expected an `FnOnce()` closure, found `Bar`
151151
|
152-
= help: the trait `FnOnce<()>` is not implemented for `Bar`
152+
= help: the trait `FnOnce()` is not implemented for `Bar`
153153
= note: wrap the `Bar` in a closure with no arguments: `|| { /* code */ }`
154154
note: required by a bound in `FnMut`
155155
--> $SRC_DIR/core/src/ops/function.rs:LL:COL

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ LL | needs_fn(1);
4747
| |
4848
| required by a bound introduced by this call
4949
|
50-
= help: the trait `Fn<(isize,)>` is not implemented for `{integer}`
50+
= help: the trait `Fn(isize)` is not implemented for `{integer}`
5151
note: required by a bound in `needs_fn`
5252
--> $DIR/fn-trait-formatting.rs:1:31
5353
|

tests/ui/fn/issue-39259.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ error[E0277]: expected a `FnMut(u32)` closure, found `S`
1616
LL | impl Fn(u32) -> u32 for S {
1717
| ^ expected an `FnMut(u32)` closure, found `S`
1818
|
19-
= help: the trait `FnMut<(u32,)>` is not implemented for `S`
19+
= help: the trait `FnMut(u32)` is not implemented for `S`
2020
note: required by a bound in `Fn`
2121
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
2222

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ LL | type F<'a>: Fn() -> u32;
1212
| ^^^^^^^^^^^ required by this bound in `Fun::F`
1313
help: consider restricting type parameter `T`
1414
|
15-
LL | impl<T: std::ops::Fn<()>> Fun for T {
16-
| ++++++++++++++++++
15+
LL | impl<T: Fn()> Fun for T {
16+
| ++++++
1717

1818
error: aborting due to 1 previous error
1919

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ LL | type F<'a>: Fn() -> u32;
1212
| ^^^^^^^^^^^ required by this bound in `Fun::F`
1313
help: consider restricting type parameter `T`
1414
|
15-
LL | impl<T: std::ops::Fn<()>> Fun for T {
16-
| ++++++++++++++++++
15+
LL | impl<T: Fn()> Fun for T {
16+
| ++++++
1717

1818
error: aborting due to 1 previous error
1919

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ LL | type F<'a>: Fn() -> u32;
1212
| ^^^^^^^^^^^ required by this bound in `Fun::F`
1313
help: consider restricting type parameter `T`
1414
|
15-
LL | impl<T: std::ops::Fn<()>> Fun for T {
16-
| ++++++++++++++++++
15+
LL | impl<T: Fn()> Fun for T {
16+
| ++++++
1717

1818
error: aborting due to 1 previous error
1919

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ LL | type F<'a>: Fn() -> u32;
1212
| ^^^^^^^^^^^ required by this bound in `Fun::F`
1313
help: consider restricting type parameter `T`
1414
|
15-
LL | impl<T: std::ops::Fn<()>> Fun for T {
16-
| ++++++++++++++++++
15+
LL | impl<T: Fn()> Fun for T {
16+
| ++++++
1717

1818
error: aborting due to 1 previous error
1919

tests/ui/impl-trait/normalize-tait-in-const.stderr

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ LL | fun(filter_positive());
1313
= note: calls in constant functions are limited to constant functions, tuple structs and tuple variants
1414
help: consider further restricting this bound
1515
|
16-
LL | const fn with_positive<F: ~const for<'a> Fn(&'a Alias<'a>) + ~const Destruct + ~const std::ops::Fn<(&Alias<'_>,)>>(fun: F) {
17-
| ++++++++++++++++++++++++++++++++++++
16+
LL | const fn with_positive<F: ~const for<'a> Fn(&'a Alias<'a>) + ~const Destruct + ~const Fn(&Alias<'_>)>(fun: F) {
17+
| +++++++++++++++++++++++
1818
help: add `#![feature(effects)]` to the crate attributes to enable
1919
|
2020
LL + #![feature(effects)]

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ LL | const_eval_select((), 42, 0xDEADBEEF);
2424
| |
2525
| required by a bound introduced by this call
2626
|
27-
= help: the trait `FnOnce<()>` is not implemented for `{integer}`
27+
= help: the trait `FnOnce()` is not implemented for `{integer}`
2828
= note: wrap the `{integer}` in a closure with no arguments: `|| { /* code */ }`
2929
note: required by a bound in `const_eval_select`
3030
--> $SRC_DIR/core/src/intrinsics.rs:LL:COL
@@ -37,7 +37,7 @@ LL | const_eval_select((), 42, 0xDEADBEEF);
3737
| |
3838
| required by a bound introduced by this call
3939
|
40-
= help: the trait `FnOnce<()>` is not implemented for `{integer}`
40+
= help: the trait `FnOnce()` is not implemented for `{integer}`
4141
= note: wrap the `{integer}` in a closure with no arguments: `|| { /* code */ }`
4242
note: required by a bound in `const_eval_select`
4343
--> $SRC_DIR/core/src/intrinsics.rs:LL:COL

tests/ui/issues/issue-22034.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ error[E0277]: expected a `Fn()` closure, found `()`
44
LL | &mut *(ptr as *mut dyn Fn())
55
| ^^^ expected an `Fn()` closure, found `()`
66
|
7-
= help: the trait `Fn<()>` is not implemented for `()`
7+
= help: the trait `Fn()` is not implemented for `()`
88
= note: wrap the `()` in a closure with no arguments: `|| { /* code */ }`
99
= note: required for the cast from `*mut ()` to `*mut dyn Fn()`
1010

tests/ui/issues/issue-23966.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ LL | "".chars().fold(|_, _| (), ());
66
| |
77
| required by a bound introduced by this call
88
|
9-
= help: the trait `FnMut<(_, char)>` is not implemented for `()`
9+
= help: the trait `FnMut(_, char)` is not implemented for `()`
1010
note: required by a bound in `fold`
1111
--> $SRC_DIR/core/src/iter/traits/iterator.rs:LL:COL
1212

tests/ui/lifetimes/issue-76168-hr-outlives-3.stderr

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ LL | | F:,
1010
LL | | for<'a> <i32 as FnOnce<(&'a mut i32,)>>::Output: Future<Output = ()> + 'a,
1111
| |__________________________________________________________________________^ expected an `FnOnce(&'a mut i32)` closure, found `i32`
1212
|
13-
= help: the trait `for<'a> FnOnce<(&'a mut i32,)>` is not implemented for `i32`
13+
= help: the trait `for<'a> FnOnce(&'a mut i32)` is not implemented for `i32`
1414

1515
error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `i32`
1616
--> $DIR/issue-76168-hr-outlives-3.rs:6:10
1717
|
1818
LL | async fn wrapper<F>(f: F)
1919
| ^^^^^^^ expected an `FnOnce(&'a mut i32)` closure, found `i32`
2020
|
21-
= help: the trait `for<'a> FnOnce<(&'a mut i32,)>` is not implemented for `i32`
21+
= help: the trait `for<'a> FnOnce(&'a mut i32)` is not implemented for `i32`
2222

2323
error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `i32`
2424
--> $DIR/issue-76168-hr-outlives-3.rs:6:1
@@ -32,7 +32,7 @@ LL | | F:,
3232
LL | | for<'a> <i32 as FnOnce<(&'a mut i32,)>>::Output: Future<Output = ()> + 'a,
3333
| |__________________________________________________________________________^ expected an `FnOnce(&'a mut i32)` closure, found `i32`
3434
|
35-
= help: the trait `for<'a> FnOnce<(&'a mut i32,)>` is not implemented for `i32`
35+
= help: the trait `for<'a> FnOnce(&'a mut i32)` is not implemented for `i32`
3636

3737
error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `i32`
3838
--> $DIR/issue-76168-hr-outlives-3.rs:6:1
@@ -46,7 +46,7 @@ LL | | F:,
4646
LL | | for<'a> <i32 as FnOnce<(&'a mut i32,)>>::Output: Future<Output = ()> + 'a,
4747
| |__________________________________________________________________________^ expected an `FnOnce(&'a mut i32)` closure, found `i32`
4848
|
49-
= help: the trait `for<'a> FnOnce<(&'a mut i32,)>` is not implemented for `i32`
49+
= help: the trait `for<'a> FnOnce(&'a mut i32)` is not implemented for `i32`
5050
= note: duplicate diagnostic emitted due to `-Z deduplicate-diagnostics=no`
5151

5252
error[E0277]: expected a `FnOnce(&'a mut i32)` closure, found `i32`
@@ -59,7 +59,7 @@ LL | | &mut i;
5959
LL | | }
6060
| |_^ expected an `FnOnce(&'a mut i32)` closure, found `i32`
6161
|
62-
= help: the trait `for<'a> FnOnce<(&'a mut i32,)>` is not implemented for `i32`
62+
= help: the trait `for<'a> FnOnce(&'a mut i32)` is not implemented for `i32`
6363

6464
error: aborting due to 5 previous errors
6565

tests/ui/lifetimes/issue-95023.stderr

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ error[E0277]: expected a `FnMut(&isize)` closure, found `Error`
3838
LL | impl Fn(&isize) for Error {
3939
| ^^^^^ expected an `FnMut(&isize)` closure, found `Error`
4040
|
41-
= help: the trait `FnMut<(&isize,)>` is not implemented for `Error`
41+
= help: the trait `FnMut(&isize)` is not implemented for `Error`
4242
note: required by a bound in `Fn`
4343
--> $SRC_DIR/core/src/ops/function.rs:LL:COL
4444

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ LL | let _ = produces_string().and_then(takes_str_but_wrong_abi);
2626
| |
2727
| required by a bound introduced by this call
2828
|
29-
= help: the trait `FnOnce<(String,)>` is not implemented for fn item `for<'a> extern "C" fn(&'a str) -> Option<()> {takes_str_but_wrong_abi}`
29+
= help: the trait `FnOnce(String)` is not implemented for fn item `for<'a> extern "C" fn(&'a str) -> Option<()> {takes_str_but_wrong_abi}`
3030
note: required by a bound in `Option::<T>::and_then`
3131
--> $SRC_DIR/core/src/option.rs:LL:COL
3232

@@ -38,7 +38,7 @@ LL | let _ = produces_string().and_then(takes_str_but_unsafe);
3838
| |
3939
| required by a bound introduced by this call
4040
|
41-
= help: the trait `FnOnce<(String,)>` is not implemented for fn item `for<'a> unsafe fn(&'a str) -> Option<()> {takes_str_but_unsafe}`
41+
= help: the trait `FnOnce(String)` is not implemented for fn item `for<'a> unsafe fn(&'a str) -> Option<()> {takes_str_but_unsafe}`
4242
= note: unsafe function cannot be called generically without an unsafe block
4343
note: required by a bound in `Option::<T>::and_then`
4444
--> $SRC_DIR/core/src/option.rs:LL:COL

0 commit comments

Comments
 (0)