rename method
This commit is contained in:
parent
d5ebdfc2c5
commit
dd3437b718
5 changed files with 18 additions and 9 deletions
|
@ -845,7 +845,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
expected,
|
expected,
|
||||||
);
|
);
|
||||||
|
|
||||||
self.write_method_call(call_expr.hir_id, call_expr.span, method_callee);
|
self.write_method_call_and_enforce_effects(call_expr.hir_id, call_expr.span, method_callee);
|
||||||
output_type
|
output_type
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -895,7 +895,11 @@ impl<'a, 'tcx> DeferredCallResolution<'tcx> {
|
||||||
adjustments.extend(autoref);
|
adjustments.extend(autoref);
|
||||||
fcx.apply_adjustments(self.callee_expr, adjustments);
|
fcx.apply_adjustments(self.callee_expr, adjustments);
|
||||||
|
|
||||||
fcx.write_method_call(self.call_expr.hir_id, self.call_expr.span, method_callee);
|
fcx.write_method_call_and_enforce_effects(
|
||||||
|
self.call_expr.hir_id,
|
||||||
|
self.call_expr.span,
|
||||||
|
method_callee,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
None => {
|
None => {
|
||||||
// This can happen if `#![no_core]` is used and the `fn/fn_mut/fn_once`
|
// This can happen if `#![no_core]` is used and the `fn/fn_mut/fn_once`
|
||||||
|
|
|
@ -1313,7 +1313,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
Ok(method) => {
|
Ok(method) => {
|
||||||
// We could add a "consider `foo::<params>`" suggestion here, but I wasn't able to
|
// We could add a "consider `foo::<params>`" suggestion here, but I wasn't able to
|
||||||
// trigger this codepath causing `structurally_resolve_type` to emit an error.
|
// trigger this codepath causing `structurally_resolve_type` to emit an error.
|
||||||
self.write_method_call(expr.hir_id, expr.span, method);
|
self.write_method_call_and_enforce_effects(expr.hir_id, expr.span, method);
|
||||||
Ok(method)
|
Ok(method)
|
||||||
}
|
}
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
|
|
|
@ -159,7 +159,12 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[instrument(level = "debug", skip(self))]
|
#[instrument(level = "debug", skip(self))]
|
||||||
pub fn write_method_call(&self, hir_id: hir::HirId, span: Span, method: MethodCallee<'tcx>) {
|
pub fn write_method_call_and_enforce_effects(
|
||||||
|
&self,
|
||||||
|
hir_id: hir::HirId,
|
||||||
|
span: Span,
|
||||||
|
method: MethodCallee<'tcx>,
|
||||||
|
) {
|
||||||
self.enforce_context_effects(hir_id, span, method.def_id, method.args);
|
self.enforce_context_effects(hir_id, span, method.def_id, method.args);
|
||||||
self.write_resolution(hir_id, Ok((DefKind::AssocFn, method.def_id)));
|
self.write_resolution(hir_id, Ok((DefKind::AssocFn, method.def_id)));
|
||||||
self.write_args(hir_id, method.args);
|
self.write_args(hir_id, method.args);
|
||||||
|
|
|
@ -291,7 +291,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
.push(autoref);
|
.push(autoref);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.write_method_call(expr.hir_id, expr.span, method);
|
self.write_method_call_and_enforce_effects(expr.hir_id, expr.span, method);
|
||||||
|
|
||||||
method.sig.output()
|
method.sig.output()
|
||||||
}
|
}
|
||||||
|
@ -781,7 +781,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
assert!(op.is_by_value());
|
assert!(op.is_by_value());
|
||||||
match self.lookup_op_method(operand_ty, None, Op::Unary(op, ex.span), expected) {
|
match self.lookup_op_method(operand_ty, None, Op::Unary(op, ex.span), expected) {
|
||||||
Ok(method) => {
|
Ok(method) => {
|
||||||
self.write_method_call(ex.hir_id, ex.span, method);
|
self.write_method_call_and_enforce_effects(ex.hir_id, ex.span, method);
|
||||||
method.sig.output()
|
method.sig.output()
|
||||||
}
|
}
|
||||||
Err(errors) => {
|
Err(errors) => {
|
||||||
|
|
|
@ -38,7 +38,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
span_bug!(expr.span, "input to deref is not a ref?");
|
span_bug!(expr.span, "input to deref is not a ref?");
|
||||||
}
|
}
|
||||||
let ty = self.make_overloaded_place_return_type(method).ty;
|
let ty = self.make_overloaded_place_return_type(method).ty;
|
||||||
self.write_method_call(expr.hir_id, expr.span, method);
|
self.write_method_call_and_enforce_effects(expr.hir_id, expr.span, method);
|
||||||
Some(ty)
|
Some(ty)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,7 +179,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
}
|
}
|
||||||
self.apply_adjustments(base_expr, adjustments);
|
self.apply_adjustments(base_expr, adjustments);
|
||||||
|
|
||||||
self.write_method_call(expr.hir_id, expr.span, method);
|
self.write_method_call_and_enforce_effects(expr.hir_id, expr.span, method);
|
||||||
|
|
||||||
return Some((input_ty, self.make_overloaded_place_return_type(method).ty));
|
return Some((input_ty, self.make_overloaded_place_return_type(method).ty));
|
||||||
}
|
}
|
||||||
|
@ -404,7 +404,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
|
||||||
None => return,
|
None => return,
|
||||||
};
|
};
|
||||||
debug!("convert_place_op_to_mutable: method={:?}", method);
|
debug!("convert_place_op_to_mutable: method={:?}", method);
|
||||||
self.write_method_call(expr.hir_id, expr.span, method);
|
self.write_method_call_and_enforce_effects(expr.hir_id, expr.span, method);
|
||||||
|
|
||||||
let ty::Ref(region, _, hir::Mutability::Mut) = method.sig.inputs()[0].kind() else {
|
let ty::Ref(region, _, hir::Mutability::Mut) = method.sig.inputs()[0].kind() else {
|
||||||
span_bug!(expr.span, "input to mutable place op is not a mut ref?");
|
span_bug!(expr.span, "input to mutable place op is not a mut ref?");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue