Skip to content

Commit 0f31095

Browse files
committed
Remove Span from hir::ImplItemRef.
1 parent 00ce893 commit 0f31095

File tree

8 files changed

+10
-9
lines changed

8 files changed

+10
-9
lines changed

src/librustc_ast_lowering/item.rs

-1
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,6 @@ impl<'hir> LoweringContext<'_, 'hir> {
887887
hir::ImplItemRef {
888888
id: hir::ImplItemId { hir_id: self.lower_node_id(i.id, i.span) },
889889
ident: i.ident,
890-
span: i.span,
891890
vis: self.lower_visibility(&i.vis, Some(i.id)),
892891
defaultness,
893892
kind: match &i.kind {

src/librustc_hir/hir.rs

-1
Original file line numberDiff line numberDiff line change
@@ -2579,7 +2579,6 @@ pub struct ImplItemRef<'hir> {
25792579
#[stable_hasher(project(name))]
25802580
pub ident: Ident,
25812581
pub kind: AssocItemKind,
2582-
pub span: Span,
25832582
pub vis: Visibility<'hir>,
25842583
pub defaultness: Defaultness,
25852584
}

src/librustc_hir/intravisit.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,7 @@ pub fn walk_impl_item<'v, V: Visitor<'v>>(visitor: &mut V, impl_item: &'v ImplIt
980980

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

src/librustc_middle/hir/map/collector.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,7 @@ impl<'a, 'hir> Visitor<'hir> for NodeCollector<'a, 'hir> {
548548
fn visit_impl_item_ref(&mut self, ii: &'hir ImplItemRef<'hir>) {
549549
// Do not visit the duplicate information in ImplItemRef. We want to
550550
// map the actual nodes, not the duplicate ones in the *Ref.
551-
let ImplItemRef { id, ident: _, kind: _, span: _, vis: _, defaultness: _ } = *ii;
551+
let ImplItemRef { id, ident: _, kind: _, vis: _, defaultness: _ } = *ii;
552552

553553
self.visit_nested_impl_item(id);
554554
}

src/librustc_middle/ty/error.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -840,7 +840,10 @@ fn foo(&self) -> Self::T { String::new() }
840840
match item.kind {
841841
hir::AssocItemKind::Type => {
842842
if self.type_of(self.hir().local_def_id(item.id.hir_id)) == found {
843-
db.span_label(item.span, "expected this associated type");
843+
db.span_label(
844+
self.hir().span(item.id.hir_id),
845+
"expected this associated type",
846+
);
844847
return true;
845848
}
846849
}

src/librustc_trait_selection/traits/wf.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ fn extend_cause_with_original_assoc_item_obligation<'tcx>(
190190
let fix_span =
191191
|impl_item_ref: &hir::ImplItemRef<'_>| match tcx.hir().impl_item(impl_item_ref.id).kind {
192192
hir::ImplItemKind::Const(ty, _) | hir::ImplItemKind::TyAlias(ty) => ty.span,
193-
_ => impl_item_ref.span,
193+
_ => tcx.hir().span(impl_item_ref.id.hir_id),
194194
};
195195
match pred.kind() {
196196
ty::PredicateKind::Projection(proj) => {

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for PartialEqNeImpl {
4444
cx,
4545
PARTIALEQ_NE_IMPL,
4646
impl_item.id.hir_id,
47-
impl_item.span,
47+
cx.tcx.hir().span(impl_item.id.hir_id),
4848
"re-implementing `PartialEq::ne` is unnecessary",
4949
);
5050
}

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

+2-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ impl<'a, 'tcx> LateLintPass<'a, '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(item.id.hir_id)),
39+
"visit_string" => seen_string = Some(cx.tcx.hir().span(item.id.hir_id)),
4040
_ => {},
4141
}
4242
}

0 commit comments

Comments
 (0)