remove unused function argument

This commit is contained in:
lcnr 2022-07-01 13:36:49 +02:00
parent a5c6a48aee
commit c2ed08715b
4 changed files with 5 additions and 37 deletions

View File

@ -315,8 +315,6 @@ pub fn emit_inference_failure_err(
body_id: Option<hir::BodyId>, body_id: Option<hir::BodyId>,
failure_span: Span, failure_span: Span,
arg: GenericArg<'tcx>, arg: GenericArg<'tcx>,
// FIXME(#94483): Either use this or remove it.
_impl_candidates: Vec<ty::TraitRef<'tcx>>,
error_code: TypeAnnotationNeeded, error_code: TypeAnnotationNeeded,
should_label_span: bool, should_label_span: bool,
) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> { ) -> DiagnosticBuilder<'tcx, ErrorGuaranteed> {

View File

@ -1980,7 +1980,6 @@ fn maybe_report_ambiguity(
body_id, body_id,
span, span,
trait_ref.self_ty().skip_binder().into(), trait_ref.self_ty().skip_binder().into(),
vec![],
ErrorCode::E0282, ErrorCode::E0282,
false, false,
) )
@ -2005,19 +2004,7 @@ fn maybe_report_ambiguity(
let subst = data.trait_ref.substs.iter().find(|s| s.has_infer_types_or_consts()); let subst = data.trait_ref.substs.iter().find(|s| s.has_infer_types_or_consts());
let mut err = if let Some(subst) = subst { let mut err = if let Some(subst) = subst {
let impl_candidates = self self.emit_inference_failure_err(body_id, span, subst, ErrorCode::E0283, true)
.find_similar_impl_candidates(trait_ref)
.into_iter()
.map(|candidate| candidate.trait_ref)
.collect();
self.emit_inference_failure_err(
body_id,
span,
subst,
impl_candidates,
ErrorCode::E0283,
true,
)
} else { } else {
struct_span_err!( struct_span_err!(
self.tcx.sess, self.tcx.sess,
@ -2117,7 +2104,7 @@ fn maybe_report_ambiguity(
return; return;
} }
self.emit_inference_failure_err(body_id, span, arg, vec![], ErrorCode::E0282, false) self.emit_inference_failure_err(body_id, span, arg, ErrorCode::E0282, false)
} }
ty::PredicateKind::Subtype(data) => { ty::PredicateKind::Subtype(data) => {
@ -2131,14 +2118,7 @@ fn maybe_report_ambiguity(
let SubtypePredicate { a_is_expected: _, a, b } = data; let SubtypePredicate { a_is_expected: _, a, b } = data;
// both must be type variables, or the other would've been instantiated // both must be type variables, or the other would've been instantiated
assert!(a.is_ty_var() && b.is_ty_var()); assert!(a.is_ty_var() && b.is_ty_var());
self.emit_inference_failure_err( self.emit_inference_failure_err(body_id, span, a.into(), ErrorCode::E0282, true)
body_id,
span,
a.into(),
vec![],
ErrorCode::E0282,
true,
)
} }
ty::PredicateKind::Projection(data) => { ty::PredicateKind::Projection(data) => {
if predicate.references_error() || self.is_tainted_by_errors() { if predicate.references_error() || self.is_tainted_by_errors() {
@ -2155,7 +2135,6 @@ fn maybe_report_ambiguity(
body_id, body_id,
span, span,
subst, subst,
vec![],
ErrorCode::E0284, ErrorCode::E0284,
true, true,
); );

View File

@ -1538,14 +1538,7 @@ pub fn structurally_resolved_type(&self, sp: Span, ty: Ty<'tcx>) -> Ty<'tcx> {
ty ty
} else { } else {
if !self.is_tainted_by_errors() { if !self.is_tainted_by_errors() {
self.emit_inference_failure_err( self.emit_inference_failure_err((**self).body_id, sp, ty.into(), E0282, true)
(**self).body_id,
sp,
ty.into(),
vec![],
E0282,
true,
)
.emit(); .emit();
} }
let err = self.tcx.ty_error(); let err = self.tcx.ty_error();

View File

@ -692,7 +692,6 @@ fn report_type_error(&self, t: Ty<'tcx>) {
Some(self.body.id()), Some(self.body.id()),
self.span.to_span(self.tcx), self.span.to_span(self.tcx),
t.into(), t.into(),
vec![],
E0282, E0282,
false, false,
) )
@ -707,7 +706,6 @@ fn report_const_error(&self, c: ty::Const<'tcx>) {
Some(self.body.id()), Some(self.body.id()),
self.span.to_span(self.tcx), self.span.to_span(self.tcx),
c.into(), c.into(),
vec![],
E0282, E0282,
false, false,
) )