Skip to content

Commit f1ef038

Browse files
committed
use track_caller to show where the panic is actually from
1 parent 8a746f4 commit f1ef038

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

compiler/rustc_middle/src/ty/subst.rs

+4
Original file line numberDiff line numberDiff line change
@@ -400,6 +400,7 @@ impl<'tcx> InternalSubsts<'tcx> {
400400
}
401401

402402
#[inline]
403+
#[track_caller]
403404
pub fn type_at(&self, i: usize) -> Ty<'tcx> {
404405
if let GenericArgKind::Type(ty) = self[i].unpack() {
405406
ty
@@ -409,6 +410,7 @@ impl<'tcx> InternalSubsts<'tcx> {
409410
}
410411

411412
#[inline]
413+
#[track_caller]
412414
pub fn region_at(&self, i: usize) -> ty::Region<'tcx> {
413415
if let GenericArgKind::Lifetime(lt) = self[i].unpack() {
414416
lt
@@ -418,6 +420,7 @@ impl<'tcx> InternalSubsts<'tcx> {
418420
}
419421

420422
#[inline]
423+
#[track_caller]
421424
pub fn const_at(&self, i: usize) -> ty::Const<'tcx> {
422425
if let GenericArgKind::Const(ct) = self[i].unpack() {
423426
ct
@@ -427,6 +430,7 @@ impl<'tcx> InternalSubsts<'tcx> {
427430
}
428431

429432
#[inline]
433+
#[track_caller]
430434
pub fn type_for_def(&self, def: &ty::GenericParamDef) -> GenericArg<'tcx> {
431435
self.type_at(def.index as usize).into()
432436
}

0 commit comments

Comments
 (0)