Skip to content

Commit e9957b9

Browse files
Stop passing empty args to check_expr_path
1 parent 8f08625 commit e9957b9

File tree

1 file changed

+4
-4
lines changed
  • compiler/rustc_hir_typeck/src

1 file changed

+4
-4
lines changed

compiler/rustc_hir_typeck/src/expr.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
222222
let ty = ensure_sufficient_stack(|| match &expr.kind {
223223
hir::ExprKind::Path(
224224
qpath @ (hir::QPath::Resolved(..) | hir::QPath::TypeRelative(..)),
225-
) => self.check_expr_path(qpath, expr, args, call),
225+
) => self.check_expr_path(qpath, expr, Some(args), call),
226226
_ => self.check_expr_kind(expr, expected),
227227
});
228228
let ty = self.resolve_vars_if_possible(ty);
@@ -289,7 +289,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
289289
ExprKind::Path(QPath::LangItem(lang_item, _)) => {
290290
self.check_lang_item_path(lang_item, expr)
291291
}
292-
ExprKind::Path(ref qpath) => self.check_expr_path(qpath, expr, &[], None),
292+
ExprKind::Path(ref qpath) => self.check_expr_path(qpath, expr, None, None),
293293
ExprKind::InlineAsm(asm) => {
294294
// We defer some asm checks as we may not have resolved the input and output types yet (they may still be infer vars).
295295
self.deferred_asm_checks.borrow_mut().push((asm, expr.hir_id));
@@ -501,7 +501,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
501501
&self,
502502
qpath: &'tcx hir::QPath<'tcx>,
503503
expr: &'tcx hir::Expr<'tcx>,
504-
args: &'tcx [hir::Expr<'tcx>],
504+
args: Option<&'tcx [hir::Expr<'tcx>]>,
505505
call: Option<&'tcx hir::Expr<'tcx>>,
506506
) -> Ty<'tcx> {
507507
let tcx = self.tcx;
@@ -563,7 +563,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
563563
// We just want to check sizedness, so instead of introducing
564564
// placeholder lifetimes with probing, we just replace higher lifetimes
565565
// with fresh vars.
566-
let span = args.get(i).map(|a| a.span).unwrap_or(expr.span);
566+
let span = args.and_then(|args| args.get(i)).map_or(expr.span, |arg| arg.span);
567567
let input = self.instantiate_binder_with_fresh_vars(
568568
span,
569569
infer::BoundRegionConversionTime::FnCall,

0 commit comments

Comments
 (0)