Skip to content

Commit 643fdbd

Browse files
committed
Avoid passing a full Expr when only the Span is used
1 parent 5a6036a commit 643fdbd

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
@@ -822,7 +822,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
822822
// We always require that the type provided as the value for
823823
// a type parameter outlives the moment of instantiation.
824824
let args = self.typeck_results.borrow().node_args(expr.hir_id);
825-
self.add_wf_bounds(args, expr);
825+
self.add_wf_bounds(args, expr.span);
826826

827827
ty
828828
}

compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs

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

557557
/// Registers obligations that all `args` are well-formed.
558-
pub(crate) fn add_wf_bounds(&self, args: GenericArgsRef<'tcx>, expr: &hir::Expr<'_>) {
558+
pub(crate) fn add_wf_bounds(&self, args: GenericArgsRef<'tcx>, span: Span) {
559559
for arg in args.iter().filter(|arg| {
560560
matches!(arg.unpack(), GenericArgKind::Type(..) | GenericArgKind::Const(..))
561561
}) {
562-
self.register_wf_obligation(arg, expr.span, ObligationCauseCode::WellFormed(None));
562+
self.register_wf_obligation(arg, span, ObligationCauseCode::WellFormed(None));
563563
}
564564
}
565565

compiler/rustc_hir_typeck/src/method/confirm.rs

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

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

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

0 commit comments

Comments
 (0)