diff options
| author | Lukas Markeffsky <@> | 2025-09-04 22:39:15 +0200 |
|---|---|---|
| committer | Lukas Markeffsky <@> | 2025-09-04 22:56:24 +0200 |
| commit | 4ca8078d37c53ee4ff8fb32b4453b915116f25b8 (patch) | |
| tree | 79ce8f042b88f8f322cb47cf7b7dfd114592a23c /compiler | |
| parent | 71289c378d0a406a4f537fe4001282d19362931f (diff) | |
| download | rust-4ca8078d37c53ee4ff8fb32b4453b915116f25b8.tar.gz rust-4ca8078d37c53ee4ff8fb32b4453b915116f25b8.zip | |
fix ICE when suggesting `::new`
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_hir_typeck/src/expr.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/compiler/rustc_hir_typeck/src/expr.rs b/compiler/rustc_hir_typeck/src/expr.rs index a652e08905a..7adbee7ff28 100644 --- a/compiler/rustc_hir_typeck/src/expr.rs +++ b/compiler/rustc_hir_typeck/src/expr.rs @@ -2585,12 +2585,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { .filter(|item| item.is_fn() && !item.is_method()) .filter_map(|item| { // Only assoc fns that return `Self` - let fn_sig = self.tcx.fn_sig(item.def_id).skip_binder(); - let ret_ty = fn_sig.output(); - let ret_ty = self.tcx.normalize_erasing_late_bound_regions( - self.typing_env(self.param_env), - ret_ty, - ); + let fn_sig = self + .tcx + .fn_sig(item.def_id) + .instantiate(self.tcx, self.fresh_args_for_item(span, item.def_id)); + let ret_ty = self.tcx.instantiate_bound_regions_with_erased(fn_sig.output()); if !self.can_eq(self.param_env, ret_ty, adt_ty) { return None; } |
