]> git.lizzy.rs Git - rust.git/commitdiff
use `track_caller` to show where the panic is actually from
authorOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>
Wed, 30 Nov 2022 11:09:22 +0000 (11:09 +0000)
committerOli Scherer <git-spam-no-reply9815368754983@oli-obk.de>
Tue, 20 Dec 2022 14:13:29 +0000 (14:13 +0000)
compiler/rustc_middle/src/ty/subst.rs

index a04b15f8cf13c52385a886956a9d07229c31bd02..2071d01027266581542ae273550c10b668235376 100644 (file)
@@ -400,6 +400,7 @@ pub fn non_erasable_generics(
     }
 
     #[inline]
+    #[track_caller]
     pub fn type_at(&self, i: usize) -> Ty<'tcx> {
         if let GenericArgKind::Type(ty) = self[i].unpack() {
             ty
@@ -409,6 +410,7 @@ pub fn type_at(&self, i: usize) -> Ty<'tcx> {
     }
 
     #[inline]
+    #[track_caller]
     pub fn region_at(&self, i: usize) -> ty::Region<'tcx> {
         if let GenericArgKind::Lifetime(lt) = self[i].unpack() {
             lt
@@ -418,6 +420,7 @@ pub fn region_at(&self, i: usize) -> ty::Region<'tcx> {
     }
 
     #[inline]
+    #[track_caller]
     pub fn const_at(&self, i: usize) -> ty::Const<'tcx> {
         if let GenericArgKind::Const(ct) = self[i].unpack() {
             ct
@@ -427,6 +430,7 @@ pub fn const_at(&self, i: usize) -> ty::Const<'tcx> {
     }
 
     #[inline]
+    #[track_caller]
     pub fn type_for_def(&self, def: &ty::GenericParamDef) -> GenericArg<'tcx> {
         self.type_at(def.index as usize).into()
     }