Skip to content

Commit 0eaeb6c

Browse files
committed
add track_caller attribute to map_err and ok_or/_else
1 parent 0b20963 commit 0eaeb6c

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

library/core/src/option.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1305,6 +1305,7 @@ impl<T> Option<T> {
13051305
/// assert_eq!(x.ok_or(0), Err(0));
13061306
/// ```
13071307
#[inline]
1308+
#[track_caller]
13081309
#[stable(feature = "rust1", since = "1.0.0")]
13091310
pub fn ok_or<E>(self, err: E) -> Result<T, E> {
13101311
match self {
@@ -1330,6 +1331,7 @@ impl<T> Option<T> {
13301331
/// assert_eq!(x.ok_or_else(|| 0), Err(0));
13311332
/// ```
13321333
#[inline]
1334+
#[track_caller]
13331335
#[stable(feature = "rust1", since = "1.0.0")]
13341336
pub fn ok_or_else<E, F>(self, err: F) -> Result<T, E>
13351337
where

library/core/src/result.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -907,6 +907,7 @@ impl<T, E> Result<T, E> {
907907
/// assert_eq!(x.map_err(stringify), Err("error code: 13".to_string()));
908908
/// ```
909909
#[inline]
910+
#[track_caller]
910911
#[stable(feature = "rust1", since = "1.0.0")]
911912
pub fn map_err<F, O: FnOnce(E) -> F>(self, op: O) -> Result<T, F> {
912913
match self {

0 commit comments

Comments
 (0)