Skip to content

Commit 594625d

Browse files
committed
Avoid passing a full Expr when only the Span is used
1 parent 6f2ca60 commit 594625d

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

compiler/rustc_hir_typeck/src/expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
834834
// We always require that the type provided as the value for
835835
// a type parameter outlives the moment of instantiation.
836836
let args = self.typeck_results.borrow().node_args(expr.hir_id);
837-
self.add_wf_bounds(args, expr);
837+
self.add_wf_bounds(args, expr.span);
838838

839839
ty
840840
}

compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -577,11 +577,11 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
577577
}
578578

579579
/// Registers obligations that all `args` are well-formed.
580-
pub(crate) fn add_wf_bounds(&self, args: GenericArgsRef<'tcx>, expr: &hir::Expr<'_>) {
580+
pub(crate) fn add_wf_bounds(&self, args: GenericArgsRef<'tcx>, span: Span) {
581581
for arg in args.iter().filter(|arg| {
582582
matches!(arg.unpack(), GenericArgKind::Type(..) | GenericArgKind::Const(..))
583583
}) {
584-
self.register_wf_obligation(arg, expr.span, ObligationCauseCode::WellFormed(None));
584+
self.register_wf_obligation(arg, span, ObligationCauseCode::WellFormed(None));
585585
}
586586
}
587587

compiler/rustc_hir_typeck/src/method/confirm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ impl<'a, 'tcx> ConfirmContext<'a, 'tcx> {
611611

612612
// this is a projection from a trait reference, so we have to
613613
// make sure that the trait reference inputs are well-formed.
614-
self.add_wf_bounds(all_args, self.call_expr);
614+
self.add_wf_bounds(all_args, self.call_expr.span);
615615

616616
// the function type must also be well-formed (this is not
617617
// implied by the args being well-formed because of inherent

0 commit comments

Comments
 (0)