Skip to content

Commit b2b859b

Browse files
committed
Some track_caller additions
1 parent b0ed631 commit b2b859b

File tree

1 file changed

+8
-0
lines changed
  • compiler/rustc_middle/src/hir/map

1 file changed

+8
-0
lines changed

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

+8
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ impl<'hir> Map<'hir> {
170170
}
171171

172172
#[inline]
173+
#[track_caller]
173174
pub fn local_def_id(self, hir_id: HirId) -> LocalDefId {
174175
self.opt_local_def_id(hir_id).unwrap_or_else(|| {
175176
bug!(
@@ -310,6 +311,7 @@ impl<'hir> Map<'hir> {
310311
}
311312
}
312313

314+
#[track_caller]
313315
pub fn get_parent_node(self, hir_id: HirId) -> HirId {
314316
self.find_parent_node(hir_id)
315317
.unwrap_or_else(|| bug!("No parent for node {:?}", self.node_to_string(hir_id)))
@@ -334,12 +336,14 @@ impl<'hir> Map<'hir> {
334336
}
335337

336338
/// Retrieves the `Node` corresponding to `id`, panicking if it cannot be found.
339+
#[track_caller]
337340
pub fn get(self, id: HirId) -> Node<'hir> {
338341
self.find(id).unwrap_or_else(|| bug!("couldn't find hir id {} in the HIR map", id))
339342
}
340343

341344
/// Retrieves the `Node` corresponding to `id`, panicking if it cannot be found.
342345
#[inline]
346+
#[track_caller]
343347
pub fn get_by_def_id(self, id: LocalDefId) -> Node<'hir> {
344348
self.find_by_def_id(id).unwrap_or_else(|| bug!("couldn't find {:?} in the HIR map", id))
345349
}
@@ -377,6 +381,7 @@ impl<'hir> Map<'hir> {
377381
self.tcx.hir_owner_nodes(id.hir_id.owner).unwrap().bodies[&id.hir_id.local_id]
378382
}
379383

384+
#[track_caller]
380385
pub fn fn_decl_by_hir_id(self, hir_id: HirId) -> Option<&'hir FnDecl<'hir>> {
381386
if let Some(node) = self.find(hir_id) {
382387
node.fn_decl()
@@ -385,6 +390,7 @@ impl<'hir> Map<'hir> {
385390
}
386391
}
387392

393+
#[track_caller]
388394
pub fn fn_sig_by_hir_id(self, hir_id: HirId) -> Option<&'hir FnSig<'hir>> {
389395
if let Some(node) = self.find(hir_id) {
390396
node.fn_sig()
@@ -393,6 +399,7 @@ impl<'hir> Map<'hir> {
393399
}
394400
}
395401

402+
#[track_caller]
396403
pub fn enclosing_body_owner(self, hir_id: HirId) -> LocalDefId {
397404
for (_, node) in self.parent_iter(hir_id) {
398405
if let Some(body) = associated_body(node) {
@@ -423,6 +430,7 @@ impl<'hir> Map<'hir> {
423430
}
424431

425432
/// Given a body owner's id, returns the `BodyId` associated with it.
433+
#[track_caller]
426434
pub fn body_owned_by(self, id: LocalDefId) -> BodyId {
427435
self.maybe_body_owned_by(id).unwrap_or_else(|| {
428436
let hir_id = self.local_def_id_to_hir_id(id);

0 commit comments

Comments
 (0)