@@ -1272,14 +1272,29 @@ fn project<'cx, 'tcx>(
1272
1272
ProjectionCandidateSet :: Single ( candidate) => {
1273
1273
Ok ( Projected :: Progress ( confirm_candidate ( selcx, obligation, candidate) ) )
1274
1274
}
1275
- ProjectionCandidateSet :: None => Ok ( Projected :: NoProgress (
1276
- // FIXME(associated_const_generics): this may need to change in the future?
1277
- // need to investigate whether or not this is fine.
1278
- selcx
1279
- . tcx ( )
1280
- . mk_projection ( obligation. predicate . def_id , obligation. predicate . substs )
1281
- . into ( ) ,
1282
- ) ) ,
1275
+ ProjectionCandidateSet :: None => {
1276
+ let tcx = selcx. tcx ( ) ;
1277
+ let term = match tcx. def_kind ( obligation. predicate . def_id ) {
1278
+ DefKind :: AssocTy | DefKind :: ImplTraitPlaceholder => tcx
1279
+ . mk_projection ( obligation. predicate . def_id , obligation. predicate . substs )
1280
+ . into ( ) ,
1281
+ DefKind :: AssocConst => tcx
1282
+ . mk_const (
1283
+ ty:: ConstKind :: Unevaluated ( ty:: UnevaluatedConst :: new (
1284
+ obligation. predicate . def_id ,
1285
+ obligation. predicate . substs ,
1286
+ ) ) ,
1287
+ tcx. type_of ( obligation. predicate . def_id )
1288
+ . subst ( tcx, obligation. predicate . substs ) ,
1289
+ )
1290
+ . into ( ) ,
1291
+ kind => {
1292
+ bug ! ( "unknown projection def-id: {}" , kind. descr( obligation. predicate. def_id) )
1293
+ }
1294
+ } ;
1295
+
1296
+ Ok ( Projected :: NoProgress ( term) )
1297
+ }
1283
1298
// Error occurred while trying to processing impls.
1284
1299
ProjectionCandidateSet :: Error ( e) => Err ( ProjectionError :: TraitSelectionError ( e) ) ,
1285
1300
// Inherent ambiguity that prevents us from even enumerating the
0 commit comments