Skip to content

Commit a186aae

Browse files
Quick experiment
1 parent 16f3003 commit a186aae

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/string/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ impl<const N: usize> StaticString<N> {
111111
/// ```
112112
#[allow(clippy::should_implement_trait)]
113113
#[inline(always)]
114-
pub fn from_str<S: AsRef<str>>(string: S) -> Self {
114+
pub const fn from_str<S: ~const AsRef<str> + ~const Drop>(string: S) -> Self {
115115
let mut res = Self::new();
116116
let string_ref = string.as_ref();
117117
unsafe {
@@ -559,7 +559,7 @@ impl<const N: usize> StaticString<N> {
559559
/// assert_eq!(s, "foobar");
560560
/// ```
561561
#[inline]
562-
pub fn push_str<S: AsRef<str>>(&mut self, string: S) {
562+
pub const fn push_str<S: ~const AsRef<str> + ~const Drop>(&mut self, string: S) {
563563
// Note that when calling this at runtime, the compiler still just sees the signature
564564
// as `push_str<S: AsRef<str>>(&mut self, string: S)`. Adding new `~const` bounds is only
565565
// a "breaking change" if you add them to something that was *already* a `const fn`. Adding
@@ -592,7 +592,7 @@ impl<const N: usize> StaticString<N> {
592592
/// # }
593593
/// ```
594594
#[inline(always)]
595-
pub fn push_str_truncating<S: AsRef<str>>(&mut self, string: S) {
595+
pub const fn push_str_truncating<S: ~const AsRef<str> + ~const Drop>(&mut self, string: S) {
596596
unsafe { self.push_str_unchecked(truncate_str(string.as_ref(), self.remaining_capacity())) };
597597
}
598598

0 commit comments

Comments
 (0)