From 377594dcedf812dab65adfe2f892a5438b780731 Mon Sep 17 00:00:00 2001 From: Yuri Astrakhan Date: Wed, 14 Feb 2024 18:56:21 -0500 Subject: [PATCH] add safety text --- library/core/src/fmt/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/library/core/src/fmt/mod.rs b/library/core/src/fmt/mod.rs index 3c9cd093ad86..a1513515c09b 100644 --- a/library/core/src/fmt/mod.rs +++ b/library/core/src/fmt/mod.rs @@ -444,6 +444,7 @@ impl<'a> Arguments<'a> { #[inline] const fn as_const_str(&self) -> Option<&'static str> { let s = self.as_str(); + // SAFETY: both cases are valid as the result if unsafe { core::intrinsics::is_val_statically_known(s.is_some()) } { s } else { None } } }