diff options
| author | Michael Goulet <michael@errs.io> | 2023-07-11 15:37:09 +0000 |
|---|---|---|
| committer | Michael Goulet <michael@errs.io> | 2023-07-22 15:27:21 +0000 |
| commit | c0c2d39668be6d0633dbcb7fa19bd54ed7122587 (patch) | |
| tree | 0b88df061f87ce34440127a21455c0deba7041bd /compiler | |
| parent | 8164cdb9ee460eddcb8888b9b6f72836a956d110 (diff) | |
| download | rust-c0c2d39668be6d0633dbcb7fa19bd54ed7122587.tar.gz rust-c0c2d39668be6d0633dbcb7fa19bd54ed7122587.zip | |
Don't call a type uncallable if its signature has errors in it
Diffstat (limited to 'compiler')
| -rw-r--r-- | compiler/rustc_hir_typeck/src/callee.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/rustc_hir_typeck/src/callee.rs b/compiler/rustc_hir_typeck/src/callee.rs index a24d1ff077f..a1fd09d4050 100644 --- a/compiler/rustc_hir_typeck/src/callee.rs +++ b/compiler/rustc_hir_typeck/src/callee.rs @@ -581,6 +581,14 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> { callee_ty: Ty<'tcx>, arg_exprs: &'tcx [hir::Expr<'tcx>], ) -> ErrorGuaranteed { + // Callee probe fails when APIT references errors, so suppress those + // errors here. + if let Some((_, _, args)) = self.extract_callable_info(callee_ty) + && let Err(err) = args.error_reported() + { + return err; + } + let mut unit_variant = None; if let hir::ExprKind::Path(qpath) = &callee_expr.kind && let Res::Def(def::DefKind::Ctor(kind, CtorKind::Const), _) |
