1
Fork 0

Rollup merge of #82627 - JohnTitor:issue-82612, r=estebank

Erase late bound regions to avoid ICE

Fixes #82612, which is caused by #81769.

r? `@estebank`
This commit is contained in:
Yuki Okushi 2021-03-02 21:23:20 +09:00 committed by GitHub
commit 2c40e13b84
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 54 additions and 1 deletions

View file

@ -11,7 +11,7 @@ use rustc_hir::lang_items::LangItem;
use rustc_hir::{ExprKind, ItemKind, Node};
use rustc_infer::infer;
use rustc_middle::lint::in_external_macro;
use rustc_middle::ty::{self, Ty};
use rustc_middle::ty::{self, Binder, Ty};
use rustc_span::symbol::kw;
use std::iter;
@ -487,6 +487,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
let found = self.resolve_vars_with_obligations(found);
if let hir::FnRetTy::Return(ty) = fn_decl.output {
let ty = AstConv::ast_ty_to_ty(self, ty);
let ty = self.tcx.erase_late_bound_regions(Binder::bind(ty));
let ty = self.normalize_associated_types_in(expr.span, ty);
if self.can_coerce(found, ty) {
err.multipart_suggestion(