Skip to content

Commit ea7de0d

Browse files
committed
Do not use hir_ty_to_ty
1 parent 12fd901 commit ea7de0d

File tree

3 files changed

+10
-17
lines changed

3 files changed

+10
-17
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3447,7 +3447,6 @@ dependencies = [
34473447
"rustc_errors",
34483448
"rustc_graphviz",
34493449
"rustc_hir",
3450-
"rustc_hir_analysis",
34513450
"rustc_index",
34523451
"rustc_infer",
34533452
"rustc_lexer",

compiler/rustc_borrowck/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ rustc_data_structures = { path = "../rustc_data_structures" }
1515
rustc_errors = { path = "../rustc_errors" }
1616
rustc_graphviz = { path = "../rustc_graphviz" }
1717
rustc_hir = { path = "../rustc_hir" }
18-
rustc_hir_analysis = { path = "../rustc_hir_analysis" }
1918
rustc_index = { path = "../rustc_index" }
2019
rustc_infer = { path = "../rustc_infer" }
2120
rustc_lexer = { path = "../rustc_lexer" }

compiler/rustc_borrowck/src/diagnostics/mod.rs

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ use rustc_errors::{Applicability, Diagnostic};
66
use rustc_hir as hir;
77
use rustc_hir::def::{CtorKind, Namespace};
88
use rustc_hir::GeneratorKind;
9-
use rustc_hir_analysis::hir_ty_to_ty;
109
use rustc_infer::infer::TyCtxtInferExt;
1110
use rustc_middle::mir::tcx::PlaceTy;
1211
use rustc_middle::mir::{
@@ -1137,7 +1136,7 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
11371136
&& Some(def.did()) == self.infcx.tcx.lang_items().pin_type()
11381137
&& let ty::Ref(_, _, hir::Mutability::Mut) = substs.type_at(0).kind()
11391138
// FIXME: this is a hack because we can't call `can_eq`
1140-
&& ty.to_string() ==
1139+
&& ty.to_string() ==
11411140
tcx.fn_sig(method_did).input(0).skip_binder().to_string()
11421141
{
11431142
err.span_suggestion_verbose(
@@ -1155,22 +1154,18 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
11551154
if let Some(def_id) = impl_def_id.as_local()
11561155
&& let hir_id = tcx.hir().local_def_id_to_hir_id(def_id)
11571156
&& let hir::Node::Item(hir::Item {
1158-
kind: hir::ItemKind::Impl(hir::Impl {
1159-
self_ty,
1160-
..
1161-
}),
1157+
kind: hir::ItemKind::Impl(_),
11621158
..
11631159
}) = tcx.hir().get(hir_id)
1160+
&& tcx.type_of(impl_def_id) == ty
11641161
{
1165-
if ty == hir_ty_to_ty(tcx, self_ty) {
1166-
err.span_suggestion_verbose(
1167-
fn_call_span.shrink_to_lo(),
1168-
"you can `clone` the value and consume it, but this \
1169-
might not be your desired behavior",
1170-
"clone().".to_string(),
1171-
Applicability::MaybeIncorrect,
1172-
);
1173-
}
1162+
err.span_suggestion_verbose(
1163+
fn_call_span.shrink_to_lo(),
1164+
"you can `clone` the value and consume it, but this might \
1165+
not be your desired behavior",
1166+
"clone().".to_string(),
1167+
Applicability::MaybeIncorrect,
1168+
);
11741169
}
11751170
}
11761171
}

0 commit comments

Comments
 (0)