Rollup merge of #145930 - GrigorenkoPV:const_str_as_str, r=joshtriplett
`const`ify (the unstable) `str::as_str` Tracking issue: rust-lang/rust#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`: rust-lang/rust#145279
This commit is contained in:
commit
f6c56bcd66
1 changed files with 1 additions and 1 deletions
|
|
@ -3072,7 +3072,7 @@ impl str {
|
|||
/// for example references to `Box<str>` or `Arc<str>`.
|
||||
#[inline]
|
||||
#[unstable(feature = "str_as_str", issue = "130366")]
|
||||
pub fn as_str(&self) -> &str {
|
||||
pub const fn as_str(&self) -> &str {
|
||||
self
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue