Skip to content

Commit 93298ee

Browse files
Remove ClosureKind predicate kind
1 parent 0ff8610 commit 93298ee

File tree

26 files changed

+76
-191
lines changed

26 files changed

+76
-191
lines changed

compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs

-1
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,6 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
662662
// this closure yet; this is exactly why the other
663663
// code is looking for a self type of an unresolved
664664
// inference variable.
665-
| ty::PredicateKind::ClosureKind(..)
666665
| ty::PredicateKind::Ambiguous
667666
=> None,
668667
},

compiler/rustc_infer/src/traits/util.rs

-3
Original file line numberDiff line numberDiff line change
@@ -308,9 +308,6 @@ impl<'tcx, O: Elaboratable<'tcx>> Elaborator<'tcx, O> {
308308
ty::PredicateKind::Clause(ty::ClauseKind::Projection(..)) => {
309309
// Nothing to elaborate in a projection predicate.
310310
}
311-
ty::PredicateKind::ClosureKind(..) => {
312-
// Nothing to elaborate when waiting for a closure's kind to be inferred.
313-
}
314311
ty::PredicateKind::Clause(ty::ClauseKind::ConstEvaluatable(..)) => {
315312
// Currently, we do not elaborate const-evaluatable
316313
// predicates.

compiler/rustc_middle/src/ty/flags.rs

-3
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,6 @@ impl FlagComputation {
263263
self.add_args(slice::from_ref(&arg));
264264
}
265265
ty::PredicateKind::ObjectSafe(_def_id) => {}
266-
ty::PredicateKind::ClosureKind(_def_id, args, _kind) => {
267-
self.add_args(args);
268-
}
269266
ty::PredicateKind::Clause(ty::ClauseKind::ConstEvaluatable(uv)) => {
270267
self.add_const(uv);
271268
}

compiler/rustc_middle/src/ty/mod.rs

-4
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,6 @@ impl<'tcx> Predicate<'tcx> {
548548
| PredicateKind::Clause(ClauseKind::ConstArgHasType(..))
549549
| PredicateKind::AliasRelate(..)
550550
| PredicateKind::ObjectSafe(_)
551-
| PredicateKind::ClosureKind(_, _, _)
552551
| PredicateKind::Subtype(_)
553552
| PredicateKind::Coerce(_)
554553
| PredicateKind::Clause(ClauseKind::ConstEvaluatable(_))
@@ -1276,7 +1275,6 @@ impl<'tcx> Predicate<'tcx> {
12761275
| PredicateKind::Clause(ClauseKind::RegionOutlives(..))
12771276
| PredicateKind::Clause(ClauseKind::WellFormed(..))
12781277
| PredicateKind::ObjectSafe(..)
1279-
| PredicateKind::ClosureKind(..)
12801278
| PredicateKind::Clause(ClauseKind::TypeOutlives(..))
12811279
| PredicateKind::Clause(ClauseKind::ConstEvaluatable(..))
12821280
| PredicateKind::ConstEquate(..)
@@ -1296,7 +1294,6 @@ impl<'tcx> Predicate<'tcx> {
12961294
| PredicateKind::Clause(ClauseKind::RegionOutlives(..))
12971295
| PredicateKind::Clause(ClauseKind::WellFormed(..))
12981296
| PredicateKind::ObjectSafe(..)
1299-
| PredicateKind::ClosureKind(..)
13001297
| PredicateKind::Clause(ClauseKind::TypeOutlives(..))
13011298
| PredicateKind::Clause(ClauseKind::ConstEvaluatable(..))
13021299
| PredicateKind::ConstEquate(..)
@@ -1317,7 +1314,6 @@ impl<'tcx> Predicate<'tcx> {
13171314
| PredicateKind::Clause(ClauseKind::RegionOutlives(..))
13181315
| PredicateKind::Clause(ClauseKind::WellFormed(..))
13191316
| PredicateKind::ObjectSafe(..)
1320-
| PredicateKind::ClosureKind(..)
13211317
| PredicateKind::Clause(ClauseKind::ConstEvaluatable(..))
13221318
| PredicateKind::ConstEquate(..)
13231319
| PredicateKind::Ambiguous => None,

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

-5
Original file line numberDiff line numberDiff line change
@@ -2781,11 +2781,6 @@ define_print! {
27812781
ty::PredicateKind::ObjectSafe(trait_def_id) => {
27822782
p!("the trait `", print_def_path(trait_def_id, &[]), "` is object-safe")
27832783
}
2784-
ty::PredicateKind::ClosureKind(closure_def_id, _closure_args, kind) => p!(
2785-
"the closure `",
2786-
print_value_path(closure_def_id, &[]),
2787-
write("` implements the trait `{}`", kind)
2788-
),
27892784
ty::PredicateKind::ConstEquate(c1, c2) => {
27902785
p!("the constant `", print(c1), "` equals `", print(c2), "`")
27912786
}

compiler/rustc_smir/src/rustc_smir/mod.rs

-7
Original file line numberDiff line numberDiff line change
@@ -1699,13 +1699,6 @@ impl<'tcx> Stable<'tcx> for ty::PredicateKind<'tcx> {
16991699
PredicateKind::ObjectSafe(did) => {
17001700
stable_mir::ty::PredicateKind::ObjectSafe(tables.trait_def(*did))
17011701
}
1702-
PredicateKind::ClosureKind(did, generic_args, closure_kind) => {
1703-
stable_mir::ty::PredicateKind::ClosureKind(
1704-
tables.closure_def(*did),
1705-
generic_args.stable(tables),
1706-
closure_kind.stable(tables),
1707-
)
1708-
}
17091702
PredicateKind::Subtype(subtype_predicate) => {
17101703
stable_mir::ty::PredicateKind::SubType(subtype_predicate.stable(tables))
17111704
}

compiler/rustc_trait_selection/src/solve/eval_ctxt/mod.rs

-2
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,6 @@ impl<'a, 'tcx> EvalCtxt<'a, 'tcx> {
406406
ty::PredicateKind::Coerce(predicate) => {
407407
self.compute_coerce_goal(Goal { param_env, predicate })
408408
}
409-
ty::PredicateKind::ClosureKind(def_id, args, kind) => self
410-
.compute_closure_kind_goal(Goal { param_env, predicate: (def_id, args, kind) }),
411409
ty::PredicateKind::ObjectSafe(trait_def_id) => {
412410
self.compute_object_safe_goal(trait_def_id)
413411
}

compiler/rustc_trait_selection/src/solve/fulfill.rs

-1
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ impl<'tcx> TraitEngine<'tcx> for FulfillmentCtxt<'tcx> {
135135
}
136136
ty::PredicateKind::Clause(_)
137137
| ty::PredicateKind::ObjectSafe(_)
138-
| ty::PredicateKind::ClosureKind(_, _, _)
139138
| ty::PredicateKind::Ambiguous => {
140139
FulfillmentErrorCode::CodeSelectionError(
141140
SelectionError::Unimplemented,

compiler/rustc_trait_selection/src/traits/auto_trait.rs

-1
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,6 @@ impl<'tcx> AutoTraitFinder<'tcx> {
822822
| ty::PredicateKind::Clause(ty::ClauseKind::ConstArgHasType(..))
823823
| ty::PredicateKind::AliasRelate(..)
824824
| ty::PredicateKind::ObjectSafe(..)
825-
| ty::PredicateKind::ClosureKind(..)
826825
| ty::PredicateKind::Subtype(..)
827826
// FIXME(generic_const_exprs): you can absolutely add this as a where clauses
828827
| ty::PredicateKind::Clause(ty::ClauseKind::ConstEvaluatable(..))

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

-5
Original file line numberDiff line numberDiff line change
@@ -786,11 +786,6 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
786786
report_object_safety_error(self.tcx, span, trait_def_id, violations)
787787
}
788788

789-
ty::PredicateKind::ClosureKind(closure_def_id, closure_args, kind) => {
790-
let found_kind = self.closure_kind(closure_args).unwrap();
791-
self.report_closure_error(&obligation, closure_def_id, found_kind, kind)
792-
}
793-
794789
ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(ty)) => {
795790
let ty = self.resolve_vars_if_possible(ty);
796791
match self.tcx.sess.opts.unstable_opts.trait_solver {

compiler/rustc_trait_selection/src/traits/fulfill.rs

-14
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,6 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
350350
| ty::PredicateKind::Clause(ty::ClauseKind::ConstArgHasType(..))
351351
| ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(_))
352352
| ty::PredicateKind::ObjectSafe(_)
353-
| ty::PredicateKind::ClosureKind(..)
354353
| ty::PredicateKind::Subtype(_)
355354
| ty::PredicateKind::Coerce(_)
356355
| ty::PredicateKind::Clause(ty::ClauseKind::ConstEvaluatable(..))
@@ -411,19 +410,6 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
411410
}
412411
}
413412

414-
ty::PredicateKind::ClosureKind(_, closure_args, kind) => {
415-
match self.selcx.infcx.closure_kind(closure_args) {
416-
Some(closure_kind) => {
417-
if closure_kind.extends(kind) {
418-
ProcessResult::Changed(vec![])
419-
} else {
420-
ProcessResult::Error(CodeSelectionError(Unimplemented))
421-
}
422-
}
423-
None => ProcessResult::Unchanged,
424-
}
425-
}
426-
427413
ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(arg)) => {
428414
match wf::obligations(
429415
self.selcx.infcx,

compiler/rustc_trait_selection/src/traits/query/type_op/implied_outlives_bounds.rs

-1
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,6 @@ pub fn compute_implied_outlives_bounds_inner<'tcx>(
130130
| ty::PredicateKind::Subtype(..)
131131
| ty::PredicateKind::Coerce(..)
132132
| ty::PredicateKind::Clause(ty::ClauseKind::Projection(..))
133-
| ty::PredicateKind::ClosureKind(..)
134133
| ty::PredicateKind::ObjectSafe(..)
135134
| ty::PredicateKind::Clause(ty::ClauseKind::ConstEvaluatable(..))
136135
| ty::PredicateKind::ConstEquate(..)

compiler/rustc_trait_selection/src/traits/select/candidate_assembly.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,11 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
291291
}
292292
}
293293
None => {
294-
debug!("assemble_unboxed_candidates: closure_kind not yet known");
295-
candidates.vec.push(ClosureCandidate { is_const });
294+
if kind == ty::ClosureKind::FnOnce {
295+
candidates.vec.push(ClosureCandidate { is_const });
296+
} else {
297+
candidates.ambiguous = true;
298+
}
296299
}
297300
}
298301
}

compiler/rustc_trait_selection/src/traits/select/confirmation.rs

+1-11
Original file line numberDiff line numberDiff line change
@@ -821,11 +821,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
821821
&mut self,
822822
obligation: &PolyTraitObligation<'tcx>,
823823
) -> Result<Vec<PredicateObligation<'tcx>>, SelectionError<'tcx>> {
824-
let kind = self
825-
.tcx()
826-
.fn_trait_kind_from_def_id(obligation.predicate.def_id())
827-
.unwrap_or_else(|| bug!("closure candidate for non-fn trait {:?}", obligation));
828-
829824
// Okay to skip binder because the args on closure types never
830825
// touch bound regions, they just capture the in-scope
831826
// type/region parameters.
@@ -835,15 +830,10 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
835830
};
836831

837832
let trait_ref = self.closure_trait_ref_unnormalized(obligation, args);
838-
let mut nested = self.confirm_poly_trait_refs(obligation, trait_ref)?;
833+
let nested = self.confirm_poly_trait_refs(obligation, trait_ref)?;
839834

840835
debug!(?closure_def_id, ?trait_ref, ?nested, "confirm closure candidate obligations");
841836

842-
nested.push(obligation.with(
843-
self.tcx(),
844-
ty::Binder::dummy(ty::PredicateKind::ClosureKind(closure_def_id, args, kind)),
845-
));
846-
847837
Ok(nested)
848838
}
849839

compiler/rustc_trait_selection/src/traits/select/mod.rs

-13
Original file line numberDiff line numberDiff line change
@@ -885,19 +885,6 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
885885
}
886886
}
887887

888-
ty::PredicateKind::ClosureKind(_, closure_args, kind) => {
889-
match self.infcx.closure_kind(closure_args) {
890-
Some(closure_kind) => {
891-
if closure_kind.extends(kind) {
892-
Ok(EvaluatedToOk)
893-
} else {
894-
Ok(EvaluatedToErr)
895-
}
896-
}
897-
None => Ok(EvaluatedToAmbig),
898-
}
899-
}
900-
901888
ty::PredicateKind::Clause(ty::ClauseKind::ConstEvaluatable(uv)) => {
902889
match const_evaluatable::is_const_evaluatable(
903890
self.infcx,

compiler/rustc_traits/src/normalize_erasing_regions.rs

-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ fn not_outlives_predicate(p: ty::Predicate<'_>) -> bool {
5858
| ty::PredicateKind::AliasRelate(..)
5959
| ty::PredicateKind::Clause(ty::ClauseKind::WellFormed(..))
6060
| ty::PredicateKind::ObjectSafe(..)
61-
| ty::PredicateKind::ClosureKind(..)
6261
| ty::PredicateKind::Subtype(..)
6362
| ty::PredicateKind::Coerce(..)
6463
| ty::PredicateKind::Clause(ty::ClauseKind::ConstEvaluatable(..))

compiler/rustc_type_ir/src/predicate_kind.rs

-24
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,6 @@ pub enum PredicateKind<I: Interner> {
129129
/// Trait must be object-safe.
130130
ObjectSafe(I::DefId),
131131

132-
/// No direct syntax. May be thought of as `where T: FnFoo<...>`
133-
/// for some generic args `...` and `T` being a closure type.
134-
/// Satisfied (or refuted) once we know the closure's kind.
135-
ClosureKind(I::DefId, I::GenericArgs, I::ClosureKind),
136-
137132
/// `T1 <: T2`
138133
///
139134
/// This obligation is created most often when we have two
@@ -173,7 +168,6 @@ where
173168
I::Term: Copy,
174169
I::CoercePredicate: Copy,
175170
I::SubtypePredicate: Copy,
176-
I::ClosureKind: Copy,
177171
ClauseKind<I>: Copy,
178172
{
179173
}
@@ -183,9 +177,6 @@ impl<I: Interner> PartialEq for PredicateKind<I> {
183177
match (self, other) {
184178
(Self::Clause(l0), Self::Clause(r0)) => l0 == r0,
185179
(Self::ObjectSafe(l0), Self::ObjectSafe(r0)) => l0 == r0,
186-
(Self::ClosureKind(l0, l1, l2), Self::ClosureKind(r0, r1, r2)) => {
187-
l0 == r0 && l1 == r1 && l2 == r2
188-
}
189180
(Self::Subtype(l0), Self::Subtype(r0)) => l0 == r0,
190181
(Self::Coerce(l0), Self::Coerce(r0)) => l0 == r0,
191182
(Self::ConstEquate(l0, l1), Self::ConstEquate(r0, r1)) => l0 == r0 && l1 == r1,
@@ -207,18 +198,12 @@ where
207198
I::Term: TypeFoldable<I>,
208199
I::CoercePredicate: TypeFoldable<I>,
209200
I::SubtypePredicate: TypeFoldable<I>,
210-
I::ClosureKind: TypeFoldable<I>,
211201
ClauseKind<I>: TypeFoldable<I>,
212202
{
213203
fn try_fold_with<F: FallibleTypeFolder<I>>(self, folder: &mut F) -> Result<Self, F::Error> {
214204
Ok(match self {
215205
PredicateKind::Clause(c) => PredicateKind::Clause(c.try_fold_with(folder)?),
216206
PredicateKind::ObjectSafe(d) => PredicateKind::ObjectSafe(d.try_fold_with(folder)?),
217-
PredicateKind::ClosureKind(d, g, k) => PredicateKind::ClosureKind(
218-
d.try_fold_with(folder)?,
219-
g.try_fold_with(folder)?,
220-
k.try_fold_with(folder)?,
221-
),
222207
PredicateKind::Subtype(s) => PredicateKind::Subtype(s.try_fold_with(folder)?),
223208
PredicateKind::Coerce(s) => PredicateKind::Coerce(s.try_fold_with(folder)?),
224209
PredicateKind::ConstEquate(a, b) => {
@@ -242,18 +227,12 @@ where
242227
I::Term: TypeVisitable<I>,
243228
I::CoercePredicate: TypeVisitable<I>,
244229
I::SubtypePredicate: TypeVisitable<I>,
245-
I::ClosureKind: TypeVisitable<I>,
246230
ClauseKind<I>: TypeVisitable<I>,
247231
{
248232
fn visit_with<V: TypeVisitor<I>>(&self, visitor: &mut V) -> ControlFlow<V::BreakTy> {
249233
match self {
250234
PredicateKind::Clause(p) => p.visit_with(visitor),
251235
PredicateKind::ObjectSafe(d) => d.visit_with(visitor),
252-
PredicateKind::ClosureKind(d, g, k) => {
253-
d.visit_with(visitor)?;
254-
g.visit_with(visitor)?;
255-
k.visit_with(visitor)
256-
}
257236
PredicateKind::Subtype(s) => s.visit_with(visitor),
258237
PredicateKind::Coerce(s) => s.visit_with(visitor),
259238
PredicateKind::ConstEquate(a, b) => {
@@ -313,9 +292,6 @@ impl<I: Interner> fmt::Debug for PredicateKind<I> {
313292
PredicateKind::ObjectSafe(trait_def_id) => {
314293
write!(f, "ObjectSafe({trait_def_id:?})")
315294
}
316-
PredicateKind::ClosureKind(closure_def_id, closure_args, kind) => {
317-
write!(f, "ClosureKind({closure_def_id:?}, {closure_args:?}, {kind:?})")
318-
}
319295
PredicateKind::ConstEquate(c1, c2) => write!(f, "ConstEquate({c1:?}, {c2:?})"),
320296
PredicateKind::Ambiguous => write!(f, "Ambiguous"),
321297
PredicateKind::AliasRelate(t1, t2, dir) => {

compiler/stable_mir/src/ty.rs

-1
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,6 @@ pub struct GenericPredicates {
766766
pub enum PredicateKind {
767767
Clause(ClauseKind),
768768
ObjectSafe(TraitDef),
769-
ClosureKind(ClosureDef, GenericArgs, ClosureKind),
770769
SubType(SubtypePredicate),
771770
Coerce(CoercePredicate),
772771
ConstEquate(Const, Const),
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnMut`
2-
--> $DIR/issue-26046-fn-mut.rs:4:19
1+
error[E0277]: expected a `Fn()` closure, found `{closure@$DIR/issue-26046-fn-mut.rs:4:19: 4:21}`
2+
--> $DIR/issue-26046-fn-mut.rs:8:5
33
|
4-
LL | let closure = || {
5-
| ^^ this closure implements `FnMut`, not `Fn`
6-
LL | num += 1;
7-
| --- closure is `FnMut` because it mutates the variable `num` here
8-
...
94
LL | Box::new(closure)
10-
| ----------------- the requirement to implement `Fn` derives from here
5+
| ^^^^^^^^^^^^^^^^^ expected an `Fn()` closure, found `{closure@$DIR/issue-26046-fn-mut.rs:4:19: 4:21}`
116
|
7+
= help: the trait `Fn<()>` is not implemented for closure `{closure@$DIR/issue-26046-fn-mut.rs:4:19: 4:21}`
8+
= note: wrap the `{closure@$DIR/issue-26046-fn-mut.rs:4:19: 4:21}` in a closure with no arguments: `|| { /* code */ }`
9+
= note: `{closure@$DIR/issue-26046-fn-mut.rs:4:19: 4:21}` implements `FnMut`, but it must implement `Fn`, which is more general
1210
= note: required for the cast from `Box<{closure@$DIR/issue-26046-fn-mut.rs:4:19: 4:21}>` to `Box<(dyn Fn() + 'static)>`
1311

1412
error: aborting due to previous error
1513

16-
For more information about this error, try `rustc --explain E0525`.
14+
For more information about this error, try `rustc --explain E0277`.
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnOnce`
2-
--> $DIR/issue-26046-fn-once.rs:4:19
1+
error[E0277]: expected a `Fn()` closure, found `{closure@$DIR/issue-26046-fn-once.rs:4:19: 4:26}`
2+
--> $DIR/issue-26046-fn-once.rs:8:5
33
|
4-
LL | let closure = move || {
5-
| ^^^^^^^ this closure implements `FnOnce`, not `Fn`
6-
LL | vec
7-
| --- closure is `FnOnce` because it moves the variable `vec` out of its environment
8-
...
94
LL | Box::new(closure)
10-
| ----------------- the requirement to implement `Fn` derives from here
5+
| ^^^^^^^^^^^^^^^^^ expected an `Fn()` closure, found `{closure@$DIR/issue-26046-fn-once.rs:4:19: 4:26}`
116
|
7+
= help: the trait `Fn<()>` is not implemented for closure `{closure@$DIR/issue-26046-fn-once.rs:4:19: 4:26}`
8+
= note: wrap the `{closure@$DIR/issue-26046-fn-once.rs:4:19: 4:26}` in a closure with no arguments: `|| { /* code */ }`
9+
= note: `{closure@$DIR/issue-26046-fn-once.rs:4:19: 4:26}` implements `FnOnce`, but it must implement `Fn`, which is more general
1210
= note: required for the cast from `Box<{closure@$DIR/issue-26046-fn-once.rs:4:19: 4:26}>` to `Box<(dyn Fn() -> Vec<u8> + 'static)>`
1311

1412
error: aborting due to previous error
1513

16-
For more information about this error, try `rustc --explain E0525`.
14+
For more information about this error, try `rustc --explain E0277`.
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
1-
error[E0525]: expected a closure that implements the `Fn` trait, but this closure only implements `FnOnce`
2-
--> $DIR/closure-origin-array-diagnostics.rs:9:13
1+
error[E0277]: expected a `Fn()` closure, found `{closure@$DIR/closure-origin-array-diagnostics.rs:9:13: 9:15}`
2+
--> $DIR/closure-origin-array-diagnostics.rs:12:15
33
|
4-
LL | let c = || {
5-
| ^^ this closure implements `FnOnce`, not `Fn`
6-
LL | let [_, _s] = s;
7-
| - closure is `FnOnce` because it moves the variable `s` out of its environment
8-
LL | };
94
LL | expect_fn(c);
10-
| --------- - the requirement to implement `Fn` derives from here
5+
| --------- ^ expected an `Fn()` closure, found `{closure@$DIR/closure-origin-array-diagnostics.rs:9:13: 9:15}`
116
| |
127
| required by a bound introduced by this call
138
|
9+
= help: the trait `Fn<()>` is not implemented for closure `{closure@$DIR/closure-origin-array-diagnostics.rs:9:13: 9:15}`
10+
= note: wrap the `{closure@$DIR/closure-origin-array-diagnostics.rs:9:13: 9:15}` in a closure with no arguments: `|| { /* code */ }`
11+
= note: `{closure@$DIR/closure-origin-array-diagnostics.rs:9:13: 9:15}` implements `FnOnce`, but it must implement `Fn`, which is more general
1412
note: required by a bound in `expect_fn`
1513
--> $DIR/closure-origin-array-diagnostics.rs:5:17
1614
|
@@ -19,4 +17,4 @@ LL | fn expect_fn<F: Fn()>(_f: F) {}
1917

2018
error: aborting due to previous error
2119

22-
For more information about this error, try `rustc --explain E0525`.
20+
For more information about this error, try `rustc --explain E0277`.

0 commit comments

Comments
 (0)