rustc: hir().local_def_id_to_hir_id()
-> tcx.local_def_id_to_hir_id()
cleanup
This commit is contained in:
parent
9529a5d265
commit
c697927f44
110 changed files with 189 additions and 199 deletions
|
@ -393,7 +393,7 @@ impl IgnoredDiagnosticOption {
|
|||
if let (Some(new_item), Some(old_item)) = (new, old) {
|
||||
tcx.emit_spanned_lint(
|
||||
UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES,
|
||||
tcx.hir().local_def_id_to_hir_id(item_def_id.expect_local()),
|
||||
tcx.local_def_id_to_hir_id(item_def_id.expect_local()),
|
||||
new_item,
|
||||
IgnoredDiagnosticOption { span: new_item, prev_span: old_item, option_name },
|
||||
);
|
||||
|
@ -511,7 +511,7 @@ impl<'tcx> OnUnimplementedDirective {
|
|||
if is_diagnostic_namespace_variant {
|
||||
tcx.emit_spanned_lint(
|
||||
UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES,
|
||||
tcx.hir().local_def_id_to_hir_id(item_def_id.expect_local()),
|
||||
tcx.local_def_id_to_hir_id(item_def_id.expect_local()),
|
||||
vec![item.span()],
|
||||
MalformedOnUnimplementedAttrLint::new(item.span()),
|
||||
);
|
||||
|
@ -651,7 +651,7 @@ impl<'tcx> OnUnimplementedDirective {
|
|||
|
||||
tcx.emit_spanned_lint(
|
||||
UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES,
|
||||
tcx.hir().local_def_id_to_hir_id(item_def_id.expect_local()),
|
||||
tcx.local_def_id_to_hir_id(item_def_id.expect_local()),
|
||||
report_span,
|
||||
MalformedOnUnimplementedAttrLint::new(report_span),
|
||||
);
|
||||
|
@ -662,14 +662,14 @@ impl<'tcx> OnUnimplementedDirective {
|
|||
AttrKind::Normal(p) if !matches!(p.item.args, AttrArgs::Empty) => {
|
||||
tcx.emit_spanned_lint(
|
||||
UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES,
|
||||
tcx.hir().local_def_id_to_hir_id(item_def_id.expect_local()),
|
||||
tcx.local_def_id_to_hir_id(item_def_id.expect_local()),
|
||||
attr.span,
|
||||
MalformedOnUnimplementedAttrLint::new(attr.span),
|
||||
);
|
||||
}
|
||||
_ => tcx.emit_spanned_lint(
|
||||
UNKNOWN_OR_MALFORMED_DIAGNOSTIC_ATTRIBUTES,
|
||||
tcx.hir().local_def_id_to_hir_id(item_def_id.expect_local()),
|
||||
tcx.local_def_id_to_hir_id(item_def_id.expect_local()),
|
||||
attr.span,
|
||||
MissingOptionsForOnUnimplementedAttr,
|
||||
),
|
||||
|
|
|
@ -871,7 +871,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
|||
};
|
||||
|
||||
let hir = self.tcx.hir();
|
||||
let hir_id = hir.local_def_id_to_hir_id(def_id.as_local()?);
|
||||
let hir_id = self.tcx.local_def_id_to_hir_id(def_id.as_local()?);
|
||||
match hir.find_parent(hir_id) {
|
||||
Some(hir::Node::Stmt(hir::Stmt { kind: hir::StmtKind::Local(local), .. })) => {
|
||||
get_name(err, &local.pat.kind)
|
||||
|
@ -2414,7 +2414,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
|||
.tcx
|
||||
.parent(coroutine_did)
|
||||
.as_local()
|
||||
.map(|parent_did| hir.local_def_id_to_hir_id(parent_did))
|
||||
.map(|parent_did| self.tcx.local_def_id_to_hir_id(parent_did))
|
||||
.and_then(|parent_hir_id| hir.opt_name(parent_hir_id))
|
||||
.map(|name| {
|
||||
format!("future returned by `{name}` is not {trait_name}")
|
||||
|
@ -2429,7 +2429,7 @@ impl<'tcx> TypeErrCtxtExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
|||
.tcx
|
||||
.parent(coroutine_did)
|
||||
.as_local()
|
||||
.map(|parent_did| hir.local_def_id_to_hir_id(parent_did))
|
||||
.map(|parent_did| self.tcx.local_def_id_to_hir_id(parent_did))
|
||||
.and_then(|parent_hir_id| hir.opt_name(parent_hir_id))
|
||||
.map(|name| {
|
||||
format!("iterator returned by `{name}` is not {trait_name}")
|
||||
|
|
|
@ -3075,7 +3075,7 @@ impl<'tcx> InferCtxtPrivExt<'tcx> for TypeErrCtxt<'_, 'tcx> {
|
|||
// Additional context information explaining why the closure only implements
|
||||
// a particular trait.
|
||||
if let Some(typeck_results) = &self.typeck_results {
|
||||
let hir_id = self.tcx.hir().local_def_id_to_hir_id(closure_def_id.expect_local());
|
||||
let hir_id = self.tcx.local_def_id_to_hir_id(closure_def_id.expect_local());
|
||||
match (found_kind, typeck_results.closure_kind_origins().get(hir_id)) {
|
||||
(ty::ClosureKind::FnOnce, Some((span, place))) => {
|
||||
err.fn_once_label = Some(ClosureFnOnceLabel {
|
||||
|
|
|
@ -442,7 +442,7 @@ fn report_conflicting_impls<'tcx>(
|
|||
};
|
||||
tcx.struct_span_lint_hir(
|
||||
lint,
|
||||
tcx.hir().local_def_id_to_hir_id(impl_def_id),
|
||||
tcx.local_def_id_to_hir_id(impl_def_id),
|
||||
impl_span,
|
||||
msg,
|
||||
|err| {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue