about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2023-10-02 02:26:38 +0000
committerbors <bors@rust-lang.org>2023-10-02 02:26:38 +0000
commit30ec74728dafd672d9b53d4037694a7dcd71a9de (patch)
treef2b68a7e97eeb6a10b8e2c0b9ef66ce5071235a6
parent79bfd93d5a9cf73d312b72158c1d2289453c18c7 (diff)
parentba0b7f0f0105f497cd8c6ddffef0c425473fdbb8 (diff)
downloadrust-30ec74728dafd672d9b53d4037694a7dcd71a9de.tar.gz
rust-30ec74728dafd672d9b53d4037694a7dcd71a9de.zip
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.
-rw-r--r--library/core/src/result.rs1
1 files changed, 1 insertions, 0 deletions
diff --git a/library/core/src/result.rs b/library/core/src/result.rs
index 6981abc9be1..50127b27f8b 100644
--- a/library/core/src/result.rs
+++ b/library/core/src/result.rs
@@ -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 {