@@ -339,27 +339,30 @@ impl<'tcx> Instance<'tcx> {
339339 def_id : DefId ,
340340 substs : SubstsRef < ' tcx > ,
341341 ) -> Result < Option < Instance < ' tcx > > , ErrorReported > {
342- // All regions in the result of this query are erased, so it's
343- // fine to erase all of the input regions.
344-
345- // HACK(eddyb) erase regions in `substs` first, so that `param_env.and(...)`
346- // below is more likely to ignore the bounds in scope (e.g. if the only
347- // generic parameters mentioned by `substs` were lifetime ones).
348- let substs = tcx. erase_regions ( & substs) ;
349-
350- // FIXME(eddyb) should this always use `param_env.with_reveal_all()`?
351- tcx. resolve_instance ( tcx. erase_regions ( & param_env. and ( ( def_id, substs) ) ) )
342+ Instance :: resolve_opt_const_arg (
343+ tcx,
344+ param_env,
345+ ty:: WithOptConstParam :: unknown ( def_id) ,
346+ substs,
347+ )
352348 }
353349
354350 // This should be kept up to date with `resolve`.
355- pub fn resolve_const_arg (
351+ pub fn resolve_opt_const_arg (
356352 tcx : TyCtxt < ' tcx > ,
357353 param_env : ty:: ParamEnv < ' tcx > ,
358354 def : ty:: WithOptConstParam < DefId > ,
359355 substs : SubstsRef < ' tcx > ,
360356 ) -> Result < Option < Instance < ' tcx > > , ErrorReported > {
357+ // All regions in the result of this query are erased, so it's
358+ // fine to erase all of the input regions.
359+
360+ // HACK(eddyb) erase regions in `substs` first, so that `param_env.and(...)`
361+ // below is more likely to ignore the bounds in scope (e.g. if the only
362+ // generic parameters mentioned by `substs` were lifetime ones).
361363 let substs = tcx. erase_regions ( & substs) ;
362364
365+ // FIXME(eddyb) should this always use `param_env.with_reveal_all()`?
363366 if let Some ( ( did, param_did) ) = def. as_const_arg ( ) {
364367 tcx. resolve_instance_of_const_arg (
365368 tcx. erase_regions ( & param_env. and ( ( did, param_did, substs) ) ) ,
0 commit comments