summaryrefslogtreecommitdiffstats
path: root/tests/ui/consts/precise-drop-with-coverage.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ui/consts/precise-drop-with-coverage.rs')
-rw-r--r--tests/ui/consts/precise-drop-with-coverage.rs16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/ui/consts/precise-drop-with-coverage.rs b/tests/ui/consts/precise-drop-with-coverage.rs
new file mode 100644
index 000000000..275cb3869
--- /dev/null
+++ b/tests/ui/consts/precise-drop-with-coverage.rs
@@ -0,0 +1,16 @@
+// Checks that code coverage doesn't interfere with const_precise_live_drops.
+// Regression test for issue #93848.
+//
+// check-pass
+// compile-flags: --crate-type=lib -Cinstrument-coverage -Zno-profiler-runtime
+
+#![feature(const_precise_live_drops)]
+
+#[inline]
+pub const fn transpose<T, E>(this: Option<Result<T, E>>) -> Result<Option<T>, E> {
+ match this {
+ Some(Ok(x)) => Ok(Some(x)),
+ Some(Err(e)) => Err(e),
+ None => Ok(None),
+ }
+}