use super::method::MethodCallee;
use super::{has_expected_num_generic_args, FnCtxt};
use rustc_ast as ast;
-use rustc_errors::{self, struct_span_err, Applicability, DiagnosticBuilder};
+use rustc_errors::{self, struct_span_err, Applicability, Diagnostic};
use rustc_hir as hir;
use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
use rustc_middle::ty::adjustment::{
},
};
let autoref = Adjustment {
- kind: Adjust::Borrow(AutoBorrow::Ref(region, mutbl)),
+ kind: Adjust::Borrow(AutoBorrow::Ref(*region, mutbl)),
target: method.sig.inputs()[0],
};
self.apply_adjustments(lhs_expr, vec![autoref]);
},
};
let autoref = Adjustment {
- kind: Adjust::Borrow(AutoBorrow::Ref(region, mutbl)),
+ kind: Adjust::Borrow(AutoBorrow::Ref(*region, mutbl)),
target: method.sig.inputs()[1],
};
// HACK(eddyb) Bypass checks due to reborrows being in
}
};
if let Ref(_, rty, _) = lhs_ty.kind() {
- if self.infcx.type_is_copy_modulo_regions(self.param_env, rty, lhs_expr.span)
- && self.lookup_op_method(rty, &[rhs_ty], Op::Binary(op, is_assign)).is_ok()
+ if self.infcx.type_is_copy_modulo_regions(self.param_env, *rty, lhs_expr.span)
+ && self.lookup_op_method(*rty, &[rhs_ty], Op::Binary(op, is_assign)).is_ok()
{
if let Ok(lstring) = source_map.span_to_snippet(lhs_expr.span) {
let msg = &format!(
self.tcx,
self.body_id,
&mut err,
- ty,
+ *ty,
rhs_ty,
missing_trait,
p,
/// suggest calling the function. Returns `true` if suggestion would apply (even if not given).
fn add_type_neq_err_label(
&self,
- err: &mut rustc_errors::DiagnosticBuilder<'_>,
+ err: &mut Diagnostic,
span: Span,
ty: Ty<'tcx>,
other_ty: Ty<'tcx>,
rhs_expr: &'tcx hir::Expr<'tcx>,
lhs_ty: Ty<'tcx>,
rhs_ty: Ty<'tcx>,
- err: &mut rustc_errors::DiagnosticBuilder<'_>,
+ err: &mut Diagnostic,
is_assign: IsAssign,
op: hir::BinOp,
) -> bool {
/// Dereferences a single level of immutable referencing.
fn deref_ty_if_possible<'tcx>(ty: Ty<'tcx>) -> Ty<'tcx> {
match ty.kind() {
- ty::Ref(_, ty, hir::Mutability::Not) => ty,
+ ty::Ref(_, ty, hir::Mutability::Not) => *ty,
_ => ty,
}
}
fn suggest_constraining_param(
tcx: TyCtxt<'_>,
body_id: hir::HirId,
- mut err: &mut DiagnosticBuilder<'_>,
+ mut err: &mut Diagnostic,
lhs_ty: Ty<'_>,
rhs_ty: Ty<'_>,
missing_trait: &str,