Do not use hir_ty_to_ty
This commit is contained in:
parent
12fd9011b8
commit
ea7de0d485
3 changed files with 10 additions and 17 deletions
|
@ -3447,7 +3447,6 @@ dependencies = [
|
||||||
"rustc_errors",
|
"rustc_errors",
|
||||||
"rustc_graphviz",
|
"rustc_graphviz",
|
||||||
"rustc_hir",
|
"rustc_hir",
|
||||||
"rustc_hir_analysis",
|
|
||||||
"rustc_index",
|
"rustc_index",
|
||||||
"rustc_infer",
|
"rustc_infer",
|
||||||
"rustc_lexer",
|
"rustc_lexer",
|
||||||
|
|
|
@ -15,7 +15,6 @@ rustc_data_structures = { path = "../rustc_data_structures" }
|
||||||
rustc_errors = { path = "../rustc_errors" }
|
rustc_errors = { path = "../rustc_errors" }
|
||||||
rustc_graphviz = { path = "../rustc_graphviz" }
|
rustc_graphviz = { path = "../rustc_graphviz" }
|
||||||
rustc_hir = { path = "../rustc_hir" }
|
rustc_hir = { path = "../rustc_hir" }
|
||||||
rustc_hir_analysis = { path = "../rustc_hir_analysis" }
|
|
||||||
rustc_index = { path = "../rustc_index" }
|
rustc_index = { path = "../rustc_index" }
|
||||||
rustc_infer = { path = "../rustc_infer" }
|
rustc_infer = { path = "../rustc_infer" }
|
||||||
rustc_lexer = { path = "../rustc_lexer" }
|
rustc_lexer = { path = "../rustc_lexer" }
|
||||||
|
|
|
@ -6,7 +6,6 @@ use rustc_errors::{Applicability, Diagnostic};
|
||||||
use rustc_hir as hir;
|
use rustc_hir as hir;
|
||||||
use rustc_hir::def::{CtorKind, Namespace};
|
use rustc_hir::def::{CtorKind, Namespace};
|
||||||
use rustc_hir::GeneratorKind;
|
use rustc_hir::GeneratorKind;
|
||||||
use rustc_hir_analysis::hir_ty_to_ty;
|
|
||||||
use rustc_infer::infer::TyCtxtInferExt;
|
use rustc_infer::infer::TyCtxtInferExt;
|
||||||
use rustc_middle::mir::tcx::PlaceTy;
|
use rustc_middle::mir::tcx::PlaceTy;
|
||||||
use rustc_middle::mir::{
|
use rustc_middle::mir::{
|
||||||
|
@ -1155,18 +1154,15 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||||
if let Some(def_id) = impl_def_id.as_local()
|
if let Some(def_id) = impl_def_id.as_local()
|
||||||
&& let hir_id = tcx.hir().local_def_id_to_hir_id(def_id)
|
&& let hir_id = tcx.hir().local_def_id_to_hir_id(def_id)
|
||||||
&& let hir::Node::Item(hir::Item {
|
&& let hir::Node::Item(hir::Item {
|
||||||
kind: hir::ItemKind::Impl(hir::Impl {
|
kind: hir::ItemKind::Impl(_),
|
||||||
self_ty,
|
|
||||||
..
|
|
||||||
}),
|
|
||||||
..
|
..
|
||||||
}) = tcx.hir().get(hir_id)
|
}) = tcx.hir().get(hir_id)
|
||||||
|
&& tcx.type_of(impl_def_id) == ty
|
||||||
{
|
{
|
||||||
if ty == hir_ty_to_ty(tcx, self_ty) {
|
|
||||||
err.span_suggestion_verbose(
|
err.span_suggestion_verbose(
|
||||||
fn_call_span.shrink_to_lo(),
|
fn_call_span.shrink_to_lo(),
|
||||||
"you can `clone` the value and consume it, but this \
|
"you can `clone` the value and consume it, but this might \
|
||||||
might not be your desired behavior",
|
not be your desired behavior",
|
||||||
"clone().".to_string(),
|
"clone().".to_string(),
|
||||||
Applicability::MaybeIncorrect,
|
Applicability::MaybeIncorrect,
|
||||||
);
|
);
|
||||||
|
@ -1174,7 +1170,6 @@ impl<'cx, 'tcx> MirBorrowckCtxt<'cx, 'tcx> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// Avoid pointing to the same function in multiple different
|
// Avoid pointing to the same function in multiple different
|
||||||
// error messages.
|
// error messages.
|
||||||
if span != DUMMY_SP && self.fn_self_span_reported.insert(self_arg.span) {
|
if span != DUMMY_SP && self.fn_self_span_reported.insert(self_arg.span) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue