@@ -957,6 +957,7 @@ impl<T, E: fmt::Debug> Result<T, E> {
957957 /// x.unwrap(); // panics with `emergency failure`
958958 /// ```
959959 #[ inline]
960+ #[ track_caller]
960961 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
961962 pub fn unwrap ( self ) -> T {
962963 match self {
@@ -984,6 +985,7 @@ impl<T, E: fmt::Debug> Result<T, E> {
984985 /// x.expect("Testing expect"); // panics with `Testing expect: emergency failure`
985986 /// ```
986987 #[ inline]
988+ #[ track_caller]
987989 #[ stable( feature = "result_expect" , since = "1.4.0" ) ]
988990 pub fn expect ( self , msg : & str ) -> T {
989991 match self {
@@ -1017,6 +1019,7 @@ impl<T: fmt::Debug, E> Result<T, E> {
10171019 /// assert_eq!(x.unwrap_err(), "emergency failure");
10181020 /// ```
10191021 #[ inline]
1022+ #[ track_caller]
10201023 #[ stable( feature = "rust1" , since = "1.0.0" ) ]
10211024 pub fn unwrap_err ( self ) -> E {
10221025 match self {
@@ -1044,6 +1047,7 @@ impl<T: fmt::Debug, E> Result<T, E> {
10441047 /// x.expect_err("Testing expect_err"); // panics with `Testing expect_err: 10`
10451048 /// ```
10461049 #[ inline]
1050+ #[ track_caller]
10471051 #[ stable( feature = "result_expect_err" , since = "1.17.0" ) ]
10481052 pub fn expect_err ( self , msg : & str ) -> E {
10491053 match self {
@@ -1188,6 +1192,7 @@ impl<T, E> Result<Option<T>, E> {
11881192// This is a separate function to reduce the code size of the methods
11891193#[ inline( never) ]
11901194#[ cold]
1195+ #[ track_caller]
11911196fn unwrap_failed ( msg : & str , error : & dyn fmt:: Debug ) -> ! {
11921197 panic ! ( "{}: {:?}" , msg, error)
11931198}
0 commit comments