Skip to content

Commit 272df28

Browse files
committed
Remove Span from hir::ImplItemRef.
1 parent ba8fc92 commit 272df28

File tree

8 files changed

+8
-9
lines changed

8 files changed

+8
-9
lines changed

compiler/rustc_ast_lowering/src/item.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
930930
hir::ImplItemRef {
931931
id: hir::ImplItemId { hir_id: self.lower_node_id(i.id, i.span) },
932932
ident: i.ident,
933-
span: i.span,
934933
vis: self.lower_visibility(&i.vis, Some(i.id)),
935934
defaultness,
936935
kind: match &i.kind {

compiler/rustc_hir/src/hir.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2596,7 +2596,6 @@ pub struct ImplItemRef<'hir> {
25962596
#[stable_hasher(project(name))]
25972597
pub ident: Ident,
25982598
pub kind: AssocItemKind,
2599-
pub span: Span,
26002599
pub vis: Visibility<'hir>,
26012600
pub defaultness: Defaultness,
26022601
}

compiler/rustc_hir/src/intravisit.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1021,7 +1021,7 @@ pub fn walk_foreign_item_ref<'v, V: Visitor<'v>>(
10211021

10221022
pub fn walk_impl_item_ref<'v, V: Visitor<'v>>(visitor: &mut V, impl_item_ref: &'v ImplItemRef<'v>) {
10231023
// N.B., deliberately force a compilation error if/when new fields are added.
1024-
let ImplItemRef { id, ident, ref kind, span: _, ref vis, ref defaultness } = *impl_item_ref;
1024+
let ImplItemRef { id, ident, ref kind, ref vis, ref defaultness } = *impl_item_ref;
10251025
visitor.visit_nested_impl_item(id);
10261026
visitor.visit_ident(ident);
10271027
visitor.visit_associated_item_kind(kind);

compiler/rustc_middle/src/hir/map/collector.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -574,7 +574,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
574574
fn visit_impl_item_ref(&mut self, ii: &'hir ImplItemRef<'hir>) {
575575
// Do not visit the duplicate information in ImplItemRef. We want to
576576
// map the actual nodes, not the duplicate ones in the *Ref.
577-
let ImplItemRef { id, ident: _, kind: _, span: _, vis: _, defaultness: _ } = *ii;
577+
let ImplItemRef { id, ident: _, kind: _, vis: _, defaultness: _ } = *ii;
578578

579579
self.visit_nested_impl_item(id);
580580
}

compiler/rustc_middle/src/ty/error.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,8 @@ fn foo(&self) -> Self::T { String::new() }
834834
for item in &items[..] {
835835
if let hir::AssocItemKind::Type = item.kind {
836836
if self.type_of(self.hir().local_def_id(item.id.hir_id)) == found {
837-
db.span_label(item.span, "expected this associated type");
837+
let item_span = self.hir().span(item.id.hir_id);
838+
db.span_label(item_span, "expected this associated type");
838839
return true;
839840
}
840841
}

compiler/rustc_trait_selection/src/traits/wf.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ fn extend_cause_with_original_assoc_item_obligation<'tcx>(
205205
let fix_span =
206206
|impl_item_ref: &hir::ImplItemRef<'_>| match tcx.hir().impl_item(impl_item_ref.id).kind {
207207
hir::ImplItemKind::Const(ty, _) | hir::ImplItemKind::TyAlias(ty) => ty.span,
208-
_ => impl_item_ref.span,
208+
_ => tcx.hir().span(impl_item_ref.id.hir_id),
209209
};
210210

211211
// It is fine to skip the binder as we don't care about regions here.

src/tools/clippy/clippy_lints/src/partialeq_ne_impl.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl<'tcx> LateLintPass<'tcx> for PartialEqNeImpl {
4545
cx,
4646
PARTIALEQ_NE_IMPL,
4747
impl_item.id.hir_id,
48-
impl_item.span,
48+
cx.tcx.hir().span_with_body(impl_item.id.hir_id),
4949
"re-implementing `PartialEq::ne` is unnecessary",
5050
);
5151
}

src/tools/clippy/clippy_lints/src/serde_api.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ impl<'tcx> LateLintPass<'tcx> for SerdeAPI {
3535
let mut seen_string = None;
3636
for item in items {
3737
match &*item.ident.as_str() {
38-
"visit_str" => seen_str = Some(item.span),
39-
"visit_string" => seen_string = Some(item.span),
38+
"visit_str" => seen_str = Some(cx.tcx.hir().span_with_body(item.id.hir_id)),
39+
"visit_string" => seen_string = Some(cx.tcx.hir().span_with_body(item.id.hir_id)),
4040
_ => {},
4141
}
4242
}

0 commit comments

Comments
 (0)