@@ -1365,15 +1365,18 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1365
1365
// const param
1366
1366
ParamCandidate ( trait_pred) if trait_pred. is_const_if_const ( ) => { }
1367
1367
// const projection
1368
- ProjectionCandidate ( _, ty:: BoundConstness :: ConstIfConst ) => { }
1368
+ ProjectionCandidate ( _, ty:: BoundConstness :: ConstIfConst )
1369
1369
// auto trait impl
1370
- AutoImplCandidate => { }
1370
+ | AutoImplCandidate
1371
1371
// generator / future, this will raise error in other places
1372
1372
// or ignore error with const_async_blocks feature
1373
- GeneratorCandidate => { }
1374
- FutureCandidate => { }
1373
+ | GeneratorCandidate
1374
+ | FutureCandidate
1375
1375
// FnDef where the function is const
1376
- FnPointerCandidate { is_const : true } => { }
1376
+ | FnPointerCandidate { is_const : true }
1377
+ | ConstDestructCandidate ( _)
1378
+ | ClosureCandidate { is_const : true } => { }
1379
+
1377
1380
FnPointerCandidate { is_const : false } => {
1378
1381
if let ty:: FnDef ( def_id, _) = obligation. self_ty ( ) . skip_binder ( ) . kind ( ) && tcx. trait_of_item ( * def_id) . is_some ( ) {
1379
1382
// Trait methods are not seen as const unless the trait is implemented as const.
@@ -1382,7 +1385,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1382
1385
continue
1383
1386
}
1384
1387
}
1385
- ConstDestructCandidate ( _ ) => { }
1388
+
1386
1389
_ => {
1387
1390
// reject all other types of candidates
1388
1391
continue ;
@@ -1844,7 +1847,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1844
1847
(
1845
1848
ParamCandidate ( ref cand) ,
1846
1849
ImplCandidate ( ..)
1847
- | ClosureCandidate
1850
+ | ClosureCandidate { .. }
1848
1851
| GeneratorCandidate
1849
1852
| FutureCandidate
1850
1853
| FnPointerCandidate { .. }
@@ -1863,7 +1866,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1863
1866
}
1864
1867
(
1865
1868
ImplCandidate ( _)
1866
- | ClosureCandidate
1869
+ | ClosureCandidate { .. }
1867
1870
| GeneratorCandidate
1868
1871
| FutureCandidate
1869
1872
| FnPointerCandidate { .. }
@@ -1894,7 +1897,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1894
1897
(
1895
1898
ObjectCandidate ( _) | ProjectionCandidate ( ..) ,
1896
1899
ImplCandidate ( ..)
1897
- | ClosureCandidate
1900
+ | ClosureCandidate { .. }
1898
1901
| GeneratorCandidate
1899
1902
| FutureCandidate
1900
1903
| FnPointerCandidate { .. }
@@ -1907,7 +1910,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1907
1910
1908
1911
(
1909
1912
ImplCandidate ( ..)
1910
- | ClosureCandidate
1913
+ | ClosureCandidate { .. }
1911
1914
| GeneratorCandidate
1912
1915
| FutureCandidate
1913
1916
| FnPointerCandidate { .. }
@@ -1989,7 +1992,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1989
1992
// Everything else is ambiguous
1990
1993
(
1991
1994
ImplCandidate ( _)
1992
- | ClosureCandidate
1995
+ | ClosureCandidate { .. }
1993
1996
| GeneratorCandidate
1994
1997
| FutureCandidate
1995
1998
| FnPointerCandidate { .. }
@@ -1999,7 +2002,7 @@ impl<'cx, 'tcx> SelectionContext<'cx, 'tcx> {
1999
2002
| BuiltinCandidate { has_nested : true }
2000
2003
| TraitAliasCandidate ,
2001
2004
ImplCandidate ( _)
2002
- | ClosureCandidate
2005
+ | ClosureCandidate { .. }
2003
2006
| GeneratorCandidate
2004
2007
| FutureCandidate
2005
2008
| FnPointerCandidate { .. }
0 commit comments