1
Fork 0

Rollup merge of #104156 - oli-obk:autoderef, r=estebank

Cleanups in autoderef impl

Just something I noticed. Turns out the `overloaded_span` is not actually used separately from the main span, so I merged them.
This commit is contained in:
Manish Goregaokar 2022-11-09 15:39:06 -05:00 committed by GitHub
commit a709cc1f32
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 8 additions and 35 deletions

View file

@ -27,7 +27,6 @@ pub struct Autoderef<'a, 'tcx> {
// Meta infos:
infcx: &'a InferCtxt<'tcx>,
span: Span,
overloaded_span: Span,
body_id: hir::HirId,
param_env: ty::ParamEnv<'tcx>,
@ -99,12 +98,10 @@ impl<'a, 'tcx> Autoderef<'a, 'tcx> {
body_id: hir::HirId,
span: Span,
base_ty: Ty<'tcx>,
overloaded_span: Span,
) -> Autoderef<'a, 'tcx> {
Autoderef {
infcx,
span,
overloaded_span,
body_id,
param_env,
state: AutoderefSnapshot {
@ -193,10 +190,6 @@ impl<'a, 'tcx> Autoderef<'a, 'tcx> {
self.span
}
pub fn overloaded_span(&self) -> Span {
self.overloaded_span
}
pub fn reached_recursion_limit(&self) -> bool {
self.state.reached_recursion_limit
}

View file

@ -714,7 +714,6 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
obligation.cause.body_id,
span,
base_ty,
span,
);
if let Some(steps) = autoderef.find_map(|(ty, steps)| {
// Re-add the `&`