Skip to content

Commit dd3437b

Browse files
committed
rename method
1 parent d5ebdfc commit dd3437b

File tree

5 files changed

+18
-9
lines changed

5 files changed

+18
-9
lines changed

compiler/rustc_hir_typeck/src/callee.rs

+6-2
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
845845
expected,
846846
);
847847

848-
self.write_method_call(call_expr.hir_id, call_expr.span, method_callee);
848+
self.write_method_call_and_enforce_effects(call_expr.hir_id, call_expr.span, method_callee);
849849
output_type
850850
}
851851
}
@@ -895,7 +895,11 @@ impl<'a, 'tcx> DeferredCallResolution<'tcx> {
895895
adjustments.extend(autoref);
896896
fcx.apply_adjustments(self.callee_expr, adjustments);
897897

898-
fcx.write_method_call(self.call_expr.hir_id, self.call_expr.span, method_callee);
898+
fcx.write_method_call_and_enforce_effects(
899+
self.call_expr.hir_id,
900+
self.call_expr.span,
901+
method_callee,
902+
);
899903
}
900904
None => {
901905
// This can happen if `#![no_core]` is used and the `fn/fn_mut/fn_once`

compiler/rustc_hir_typeck/src/expr.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1313,7 +1313,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
13131313
Ok(method) => {
13141314
// We could add a "consider `foo::<params>`" suggestion here, but I wasn't able to
13151315
// trigger this codepath causing `structurally_resolve_type` to emit an error.
1316-
self.write_method_call(expr.hir_id, expr.span, method);
1316+
self.write_method_call_and_enforce_effects(expr.hir_id, expr.span, method);
13171317
Ok(method)
13181318
}
13191319
Err(error) => {

compiler/rustc_hir_typeck/src/fn_ctxt/_impl.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
159159
}
160160

161161
#[instrument(level = "debug", skip(self))]
162-
pub fn write_method_call(&self, hir_id: hir::HirId, span: Span, method: MethodCallee<'tcx>) {
162+
pub fn write_method_call_and_enforce_effects(
163+
&self,
164+
hir_id: hir::HirId,
165+
span: Span,
166+
method: MethodCallee<'tcx>,
167+
) {
163168
self.enforce_context_effects(hir_id, span, method.def_id, method.args);
164169
self.write_resolution(hir_id, Ok((DefKind::AssocFn, method.def_id)));
165170
self.write_args(hir_id, method.args);

compiler/rustc_hir_typeck/src/op.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
291291
.push(autoref);
292292
}
293293
}
294-
self.write_method_call(expr.hir_id, expr.span, method);
294+
self.write_method_call_and_enforce_effects(expr.hir_id, expr.span, method);
295295

296296
method.sig.output()
297297
}
@@ -781,7 +781,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
781781
assert!(op.is_by_value());
782782
match self.lookup_op_method(operand_ty, None, Op::Unary(op, ex.span), expected) {
783783
Ok(method) => {
784-
self.write_method_call(ex.hir_id, ex.span, method);
784+
self.write_method_call_and_enforce_effects(ex.hir_id, ex.span, method);
785785
method.sig.output()
786786
}
787787
Err(errors) => {

compiler/rustc_hir_typeck/src/place_op.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
3838
span_bug!(expr.span, "input to deref is not a ref?");
3939
}
4040
let ty = self.make_overloaded_place_return_type(method).ty;
41-
self.write_method_call(expr.hir_id, expr.span, method);
41+
self.write_method_call_and_enforce_effects(expr.hir_id, expr.span, method);
4242
Some(ty)
4343
}
4444

@@ -179,7 +179,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
179179
}
180180
self.apply_adjustments(base_expr, adjustments);
181181

182-
self.write_method_call(expr.hir_id, expr.span, method);
182+
self.write_method_call_and_enforce_effects(expr.hir_id, expr.span, method);
183183

184184
return Some((input_ty, self.make_overloaded_place_return_type(method).ty));
185185
}
@@ -404,7 +404,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
404404
None => return,
405405
};
406406
debug!("convert_place_op_to_mutable: method={:?}", method);
407-
self.write_method_call(expr.hir_id, expr.span, method);
407+
self.write_method_call_and_enforce_effects(expr.hir_id, expr.span, method);
408408

409409
let ty::Ref(region, _, hir::Mutability::Mut) = method.sig.inputs()[0].kind() else {
410410
span_bug!(expr.span, "input to mutable place op is not a mut ref?");

0 commit comments

Comments
 (0)