Skip to content

Commit 30ec747

Browse files
committed
Auto merge of #116317 - ravenclaw900:track-caller-unwrap-or-else, r=Mark-Simulacrum
Add track_caller attribute to Result::unwrap_or_else Fixes issue where panics in unwrap_or_else callbacks marked with the `track_caller` attribute appear as errors in core.
2 parents 79bfd93 + ba0b7f0 commit 30ec747

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

library/core/src/result.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1422,6 +1422,7 @@ impl<T, E> Result<T, E> {
14221422
/// assert_eq!(Err("foo").unwrap_or_else(count), 3);
14231423
/// ```
14241424
#[inline]
1425+
#[track_caller]
14251426
#[stable(feature = "rust1", since = "1.0.0")]
14261427
pub fn unwrap_or_else<F: FnOnce(E) -> T>(self, op: F) -> T {
14271428
match self {

0 commit comments

Comments
 (0)