@@ -957,6 +957,7 @@ impl<T, E: fmt::Debug> Result<T, E> {
957
957
/// x.unwrap(); // panics with `emergency failure`
958
958
/// ```
959
959
#[ inline]
960
+ #[ track_caller]
960
961
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
961
962
pub fn unwrap ( self ) -> T {
962
963
match self {
@@ -984,6 +985,7 @@ impl<T, E: fmt::Debug> Result<T, E> {
984
985
/// x.expect("Testing expect"); // panics with `Testing expect: emergency failure`
985
986
/// ```
986
987
#[ inline]
988
+ #[ track_caller]
987
989
#[ stable( feature = "result_expect" , since = "1.4.0" ) ]
988
990
pub fn expect ( self , msg : & str ) -> T {
989
991
match self {
@@ -1017,6 +1019,7 @@ impl<T: fmt::Debug, E> Result<T, E> {
1017
1019
/// assert_eq!(x.unwrap_err(), "emergency failure");
1018
1020
/// ```
1019
1021
#[ inline]
1022
+ #[ track_caller]
1020
1023
#[ stable( feature = "rust1" , since = "1.0.0" ) ]
1021
1024
pub fn unwrap_err ( self ) -> E {
1022
1025
match self {
@@ -1044,6 +1047,7 @@ impl<T: fmt::Debug, E> Result<T, E> {
1044
1047
/// x.expect_err("Testing expect_err"); // panics with `Testing expect_err: 10`
1045
1048
/// ```
1046
1049
#[ inline]
1050
+ #[ track_caller]
1047
1051
#[ stable( feature = "result_expect_err" , since = "1.17.0" ) ]
1048
1052
pub fn expect_err ( self , msg : & str ) -> E {
1049
1053
match self {
@@ -1188,6 +1192,7 @@ impl<T, E> Result<Option<T>, E> {
1188
1192
// This is a separate function to reduce the code size of the methods
1189
1193
#[ inline( never) ]
1190
1194
#[ cold]
1195
+ #[ track_caller]
1191
1196
fn unwrap_failed ( msg : & str , error : & dyn fmt:: Debug ) -> ! {
1192
1197
panic ! ( "{}: {:?}" , msg, error)
1193
1198
}
0 commit comments