Skip to content

Commit 346176f

Browse files
committed
Remove Span from hir::ImplItemRef.
1 parent 56871a5 commit 346176f

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
@@ -948,7 +948,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
948948
hir::ImplItemRef {
949949
id: hir::ImplItemId { def_id: self.lower_node_id(i.id, i.span).expect_owner() },
950950
ident: i.ident,
951-
span: i.span,
952951
vis: self.lower_visibility(&i.vis, Some(i.id)),
953952
defaultness,
954953
kind: match &i.kind {

compiler/rustc_hir/src/hir.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2838,7 +2838,6 @@ pub struct ImplItemRef<'hir> {
28382838
#[stable_hasher(project(name))]
28392839
pub ident: Ident,
28402840
pub kind: AssocItemKind,
2841-
pub span: Span,
28422841
pub vis: Visibility<'hir>,
28432842
pub defaultness: Defaultness,
28442843
}

compiler/rustc_hir/src/intravisit.rs

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

10011001
pub fn walk_impl_item_ref<'v, V: Visitor<'v>>(visitor: &mut V, impl_item_ref: &'v ImplItemRef<'v>) {
10021002
// N.B., deliberately force a compilation error if/when new fields are added.
1003-
let ImplItemRef { id, ident, ref kind, span: _, ref vis, ref defaultness } = *impl_item_ref;
1003+
let ImplItemRef { id, ident, ref kind, ref vis, ref defaultness } = *impl_item_ref;
10041004
visitor.visit_nested_impl_item(id);
10051005
visitor.visit_ident(ident);
10061006
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
@@ -556,7 +556,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
556556
fn visit_impl_item_ref(&mut self, ii: &'hir ImplItemRef<'hir>) {
557557
// Do not visit the duplicate information in ImplItemRef. We want to
558558
// map the actual nodes, not the duplicate ones in the *Ref.
559-
let ImplItemRef { id, ident: _, kind: _, span: _, vis: _, defaultness: _ } = *ii;
559+
let ImplItemRef { id, ident: _, kind: _, vis: _, defaultness: _ } = *ii;
560560

561561
self.visit_nested_impl_item(id);
562562
}

compiler/rustc_middle/src/ty/error.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -852,7 +852,8 @@ fn foo(&self) -> Self::T { String::new() }
852852
for item in &items[..] {
853853
if let hir::AssocItemKind::Type = item.kind {
854854
if self.type_of(item.id.def_id) == found {
855-
db.span_label(item.span, "expected this associated type");
855+
let item_span = self.hir().span(item.id.hir_id());
856+
db.span_label(item_span, "expected this associated type");
856857
return true;
857858
}
858859
}

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
@@ -46,7 +46,7 @@ impl<'tcx> LateLintPass<'tcx> for PartialEqNeImpl {
4646
cx,
4747
PARTIALEQ_NE_IMPL,
4848
impl_item.id.hir_id(),
49-
impl_item.span,
49+
cx.tcx.hir().span_with_body(impl_item.id.hir_id()),
5050
"re-implementing `PartialEq::ne` is unnecessary",
5151
);
5252
}

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)