-
Notifications
You must be signed in to change notification settings - Fork 13.4k
query for def_span #41593
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
query for def_span #41593
Changes from 1 commit
932d251
93ac5df
ba90718
2f73b17
ad1959e
00d02cf
d3b7af0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2265,14 +2265,6 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> { | |
} | ||
} | ||
|
||
pub fn def_span(self, def_id: DefId) -> Span { | ||
if let Some(id) = self.hir.as_local_node_id(def_id) { | ||
self.hir.span(id) | ||
} else { | ||
self.sess.cstore.def_span(&self.sess, def_id) | ||
} | ||
} | ||
|
||
pub fn vis_is_accessible_from(self, vis: Visibility, block: NodeId) -> bool { | ||
vis.is_accessible_from(self.hir.local_def_id(self.hir.get_module_parent(block)), self) | ||
} | ||
|
@@ -2675,12 +2667,23 @@ fn associated_item_def_ids<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, | |
Rc::new(vec) | ||
} | ||
|
||
fn def_span<'a, 'tcx>(tcx: TyCtxt<'a, 'tcx, 'tcx>, def_id: DefId) -> Span { | ||
match tcx.hir.span_if_local(def_id) { | ||
Some(span) => span, | ||
None => { | ||
let node_id = tcx.sess.cstore.item_body(tcx, def_id).id().node_id; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm surprised you found |
||
tcx.hir.span(node_id) | ||
}, | ||
} | ||
} | ||
|
||
pub fn provide(providers: &mut ty::maps::Providers) { | ||
*providers = ty::maps::Providers { | ||
associated_item, | ||
associated_item_def_ids, | ||
adt_sized_constraint, | ||
adt_dtorck_constraint, | ||
def_span, | ||
..*providers | ||
}; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait, what is
meta_data_node
? First off, it doesn't need a function, it could just beMetaData
.Secondly, if you have a local crate implementation, you kind of need a node that's not
MetaData
.But if @nikomatsakis doesn't think this impacts incremental this can be left as-is for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was actually added as part of my last PR. I will remove it form both instances and replace it with just
MetaData
.