remove NoMatchData::new

This commit is contained in:
lcnr 2022-03-11 12:20:27 +01:00
parent 975162d1be
commit 4558a125b6
2 changed files with 9 additions and 31 deletions

View File

@ -78,28 +78,6 @@ pub struct NoMatchData<'tcx> {
pub mode: probe::Mode,
}
impl<'tcx> NoMatchData<'tcx> {
pub fn new(
static_candidates: Vec<CandidateSource>,
unsatisfied_predicates: Vec<(
ty::Predicate<'tcx>,
Option<ty::Predicate<'tcx>>,
Option<ObligationCause<'tcx>>,
)>,
out_of_scope_traits: Vec<DefId>,
lev_candidate: Option<ty::AssocItem>,
mode: probe::Mode,
) -> Self {
NoMatchData {
static_candidates,
unsatisfied_predicates,
out_of_scope_traits,
lev_candidate,
mode,
}
}
}
// A pared down enum describing just the places from which a method
// candidate can arise. Used for error reporting only.
#[derive(Copy, Clone, Debug, Eq, Ord, PartialEq, PartialOrd)]

View File

@ -427,13 +427,13 @@ fn probe_op<OP, R>(
.unwrap_or_else(|_| span_bug!(span, "instantiating {:?} failed?", ty));
let ty = self.structurally_resolved_type(span, ty.value);
assert!(matches!(ty.kind(), ty::Error(_)));
return Err(MethodError::NoMatch(NoMatchData::new(
Vec::new(),
Vec::new(),
Vec::new(),
None,
return Err(MethodError::NoMatch(NoMatchData {
static_candidates: Vec::new(),
unsatisfied_predicates: Vec::new(),
out_of_scope_traits: Vec::new(),
lev_candidate: None,
mode,
)));
}));
}
}
@ -1093,13 +1093,13 @@ fn pick(mut self) -> PickResult<'tcx> {
}
let lev_candidate = self.probe_for_lev_candidate()?;
Err(MethodError::NoMatch(NoMatchData::new(
Err(MethodError::NoMatch(NoMatchData {
static_candidates,
unsatisfied_predicates,
out_of_scope_traits,
lev_candidate,
self.mode,
)))
mode: self.mode,
}))
}
fn pick_core(&mut self) -> Option<PickResult<'tcx>> {