Rollup merge of #120293 - estebank:issue-102629, r=nnethercote
Deduplicate more sized errors on call exprs Change the implicit `Sized` `Obligation` `Span` for call expressions to include the whole expression. This aids the existing deduplication machinery to reduce the number of errors caused by a single unsized expression.
This commit is contained in:
commit
0a4fd52c91
87 changed files with 289 additions and 342 deletions
|
@ -3292,7 +3292,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
|||
err.help("unsized fn params are gated as an unstable feature");
|
||||
}
|
||||
}
|
||||
ObligationCauseCode::SizedReturnType => {
|
||||
ObligationCauseCode::SizedReturnType | ObligationCauseCode::SizedCallReturnType => {
|
||||
err.note("the return type of a function must have a statically known size");
|
||||
}
|
||||
ObligationCauseCode::SizedYieldType => {
|
||||
|
|
|
@ -2493,7 +2493,15 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
|||
expr_finder.visit_expr(self.tcx.hir().body(body_id).value);
|
||||
|
||||
if let Some(hir::Expr {
|
||||
kind: hir::ExprKind::Path(hir::QPath::Resolved(None, path)),
|
||||
kind:
|
||||
hir::ExprKind::Call(
|
||||
hir::Expr {
|
||||
kind: hir::ExprKind::Path(hir::QPath::Resolved(None, path)),
|
||||
..
|
||||
},
|
||||
_,
|
||||
)
|
||||
| hir::ExprKind::Path(hir::QPath::Resolved(None, path)),
|
||||
..
|
||||
}) = expr_finder.result
|
||||
&& let [
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue