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.
This commit is contained in:
commit
30ec74728d
@ -1422,6 +1422,7 @@ impl<T, E> Result<T, E> {
|
|||||||
/// assert_eq!(Err("foo").unwrap_or_else(count), 3);
|
/// assert_eq!(Err("foo").unwrap_or_else(count), 3);
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
|
#[track_caller]
|
||||||
#[stable(feature = "rust1", since = "1.0.0")]
|
#[stable(feature = "rust1", since = "1.0.0")]
|
||||||
pub fn unwrap_or_else<F: FnOnce(E) -> T>(self, op: F) -> T {
|
pub fn unwrap_or_else<F: FnOnce(E) -> T>(self, op: F) -> T {
|
||||||
match self {
|
match self {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user