Skip to content

Commit a7a40dd

Browse files
committed
Simplify some Autoderef::new calls
1 parent 57d3c58 commit a7a40dd

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

compiler/rustc_hir_typeck/src/autoderef.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ use std::iter;
1212

1313
impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
1414
pub fn autoderef(&'a self, span: Span, base_ty: Ty<'tcx>) -> Autoderef<'a, 'tcx> {
15-
Autoderef::new(self, self.param_env, self.body_id, span, base_ty, span)
15+
self.autoderef_overloaded_span(span, base_ty, span)
1616
}
1717

1818
/// Like `autoderef`, but provides a custom `Span` to use for calls to

compiler/rustc_hir_typeck/src/pat.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ use rustc_span::lev_distance::find_best_match_for_name;
1919
use rustc_span::source_map::{Span, Spanned};
2020
use rustc_span::symbol::{kw, sym, Ident};
2121
use rustc_span::{BytePos, DUMMY_SP};
22-
use rustc_trait_selection::autoderef::Autoderef;
2322
use rustc_trait_selection::traits::{ObligationCause, Pattern};
2423
use ty::VariantDef;
2524

@@ -2132,7 +2131,7 @@ impl<'a, 'tcx> FnCtxt<'a, 'tcx> {
21322131
&& let ty::Array(..) | ty::Slice(..) = ty.kind()
21332132
{
21342133
err.help("the semantics of slice patterns changed recently; see issue #62254");
2135-
} else if Autoderef::new(&self.infcx, self.param_env, self.body_id, span, expected_ty, span)
2134+
} else if self.autoderef(span, expected_ty)
21362135
.any(|(ty, _)| matches!(ty.kind(), ty::Slice(..) | ty::Array(..)))
21372136
&& let (Some(span), true) = (ti.span, ti.origin_expr)
21382137
&& let Ok(snippet) = self.tcx.sess.source_map().span_to_snippet(span)

0 commit comments

Comments
 (0)