Skip to content

Commit

Permalink
Auto merge of rust-lang#116317 - ravenclaw900:track-caller-unwrap-or-…
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
bors committed Oct 2, 2023
2 parents 79bfd93 + ba0b7f0 commit 30ec747
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions library/core/src/result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1422,6 +1422,7 @@ impl<T, E> Result<T, E> {
/// assert_eq!(Err("foo").unwrap_or_else(count), 3);
/// ```
#[inline]
#[track_caller]
#[stable(feature = "rust1", since = "1.0.0")]
pub fn unwrap_or_else<F: FnOnce(E) -> T>(self, op: F) -> T {
match self {
Expand Down

0 comments on commit 30ec747

Please sign in to comment.