Skip to content

Commit f6c56bc

Browse files
authored
Rollup merge of #145930 - GrigorenkoPV:const_str_as_str, r=joshtriplett
`const`ify (the unstable) `str::as_str` Tracking issue: #130366 The method was not initially marked `const` presumably because it is only useful with `Deref`. But now that const traits seem to be a thing that can actually become real, why not make it `const`? PR `const`ifying `Deref`: #145279
2 parents c838117 + e06cd9f commit f6c56bc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

library/core/src/str/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3072,7 +3072,7 @@ impl str {
30723072
/// for example references to `Box<str>` or `Arc<str>`.
30733073
#[inline]
30743074
#[unstable(feature = "str_as_str", issue = "130366")]
3075-
pub fn as_str(&self) -> &str {
3075+
pub const fn as_str(&self) -> &str {
30763076
self
30773077
}
30783078
}

0 commit comments

Comments
 (0)