Auto merge of #93783 - oli-obk:lazy_tait_regression_fix, r=jackh726 · rust-lang/rust@cc38176 (original) (raw)
`@@ -259,22 +259,21 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
`
259
259
`` /// The cause_span
should be the span that caused us to
``
260
260
`` /// have this expected signature, or None
if we can't readily
``
261
261
`/// know that.
`
``
262
`+
#[instrument(level = "debug", skip(self, cause_span))]
`
262
263
`fn deduce_sig_from_projection(
`
263
264
`&self,
`
264
265
`cause_span: Option,
`
265
266
`projection: ty::PolyProjectionPredicate<'tcx>,
`
266
267
`) -> Option<ExpectedSig<'tcx>> {
`
267
268
`let tcx = self.tcx;
`
268
269
``
269
``
`-
debug!("deduce_sig_from_projection({:?})", projection);
`
270
``
-
271
270
`let trait_def_id = projection.trait_def_id(tcx);
`
272
271
``
273
272
`let is_fn = tcx.fn_trait_kind_from_lang_item(trait_def_id).is_some();
`
274
273
`let gen_trait = tcx.require_lang_item(LangItem::Generator, cause_span);
`
275
274
`let is_gen = gen_trait == trait_def_id;
`
276
275
`if !is_fn && !is_gen {
`
277
``
`-
debug!("deduce_sig_from_projection: not fn or generator");
`
``
276
`+
debug!("not fn or generator");
`
278
277
`return None;
`
279
278
`}
`
280
279
``
`@@ -283,15 +282,15 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
`
283
282
`// associated item and not yield.
`
284
283
`let return_assoc_item = self.tcx.associated_item_def_ids(gen_trait)[1];
`
285
284
`if return_assoc_item != projection.projection_def_id() {
`
286
``
`-
debug!("deduce_sig_from_projection: not return assoc item of generator");
`
``
285
`+
debug!("not return assoc item of generator");
`
287
286
`return None;
`
288
287
`}
`
289
288
`}
`
290
289
``
291
290
`let input_tys = if is_fn {
`
292
291
`let arg_param_ty = projection.skip_binder().projection_ty.substs.type_at(1);
`
293
292
`let arg_param_ty = self.resolve_vars_if_possible(arg_param_ty);
`
294
``
`-
debug!("deduce_sig_from_projection: arg_param_ty={:?}", arg_param_ty);
`
``
293
`+
debug!(?arg_param_ty);
`
295
294
``
296
295
`match arg_param_ty.kind() {
`
297
296
` ty::Tuple(tys) => tys.into_iter().map(|k| k.expect_ty()).collect::<Vec<_>>(),
`
`@@ -306,7 +305,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
`
306
305
`// Since this is a return parameter type it is safe to unwrap.
`
307
306
`let ret_param_ty = projection.skip_binder().term.ty().unwrap();
`
308
307
`let ret_param_ty = self.resolve_vars_if_possible(ret_param_ty);
`
309
``
`-
debug!("deduce_sig_from_projection: ret_param_ty={:?}", ret_param_ty);
`
``
308
`+
debug!(?ret_param_ty);
`
310
309
``
311
310
`let sig = projection.rebind(self.tcx.mk_fn_sig(
`
312
311
` input_tys.iter(),
`
`@@ -315,7 +314,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
`
315
314
` hir::Unsafety::Normal,
`
316
315
`Abi::Rust,
`
317
316
`));
`
318
``
`-
debug!("deduce_sig_from_projection: sig={:?}", sig);
`
``
317
`+
debug!(?sig);
`
319
318
``
320
319
`Some(ExpectedSig { cause_span, sig })
`
321
320
`}
`