@@ -1365,15 +1365,18 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
13651365 // const param
13661366 ParamCandidate ( trait_pred) if trait_pred. is_const_if_const ( ) => { }
13671367 // const projection
1368- ProjectionCandidate ( _, ty:: BoundConstness :: ConstIfConst ) => { }
1368+ ProjectionCandidate ( _, ty:: BoundConstness :: ConstIfConst )
13691369 // auto trait impl
1370- AutoImplCandidate => { }
1370+ | AutoImplCandidate
13711371 // generator / future, this will raise error in other places
13721372 // or ignore error with const_async_blocks feature
1373- GeneratorCandidate => { }
1374- FutureCandidate => { }
1373+ | GeneratorCandidate
1374+ | FutureCandidate
13751375 // FnDef where the function is const
1376- FnPointerCandidate { is_const : true } => { }
1376+ | FnPointerCandidate { is_const : true }
1377+ | ConstDestructCandidate ( _)
1378+ | ClosureCandidate { is_const : true } => { }
1379+
13771380 FnPointerCandidate { is_const : false } => {
13781381 if let ty:: FnDef ( def_id, _) = obligation. self_ty ( ) . skip_binder ( ) . kind ( ) && tcx. trait_of_item ( * def_id) . is_some ( ) {
13791382 // Trait methods are not seen as const unless the trait is implemented as const.
@@ -1382,7 +1385,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
13821385 continue
13831386 }
13841387 }
1385- ConstDestructCandidate ( _ ) => { }
1388+
13861389 _ => {
13871390 // reject all other types of candidates
13881391 continue ;
@@ -1844,7 +1847,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
18441847 (
18451848 ParamCandidate ( ref cand) ,
18461849 ImplCandidate ( ..)
1847- | ClosureCandidate
1850+ | ClosureCandidate { .. }
18481851 | GeneratorCandidate
18491852 | FutureCandidate
18501853 | FnPointerCandidate { .. }
@@ -1863,7 +1866,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
18631866 }
18641867 (
18651868 ImplCandidate ( _)
1866- | ClosureCandidate
1869+ | ClosureCandidate { .. }
18671870 | GeneratorCandidate
18681871 | FutureCandidate
18691872 | FnPointerCandidate { .. }
@@ -1894,7 +1897,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
18941897 (
18951898 ObjectCandidate ( _) | ProjectionCandidate ( ..) ,
18961899 ImplCandidate ( ..)
1897- | ClosureCandidate
1900+ | ClosureCandidate { .. }
18981901 | GeneratorCandidate
18991902 | FutureCandidate
19001903 | FnPointerCandidate { .. }
@@ -1907,7 +1910,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
19071910
19081911 (
19091912 ImplCandidate ( ..)
1910- | ClosureCandidate
1913+ | ClosureCandidate { .. }
19111914 | GeneratorCandidate
19121915 | FutureCandidate
19131916 | FnPointerCandidate { .. }
@@ -1989,7 +1992,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
19891992 // Everything else is ambiguous
19901993 (
19911994 ImplCandidate ( _)
1992- | ClosureCandidate
1995+ | ClosureCandidate { .. }
19931996 | GeneratorCandidate
19941997 | FutureCandidate
19951998 | FnPointerCandidate { .. }
@@ -1999,7 +2002,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
19992002 | BuiltinCandidate { has_nested : true }
20002003 | TraitAliasCandidate ,
20012004 ImplCandidate ( _)
2002- | ClosureCandidate
2005+ | ClosureCandidate { .. }
20032006 | GeneratorCandidate
20042007 | FutureCandidate
20052008 | FnPointerCandidate { .. }
0 commit comments