diff options
| author | Stuart Cook <Zalathar@users.noreply.github.com> | 2025-08-28 23:10:36 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-08-28 23:10:36 +1000 |
| commit | f6c56bcd66ebf0bfcb65ddd696c7e88210c38f00 (patch) | |
| tree | daae4e46f32394f5880d73835d99c27cd87065be | |
| parent | c83811762091e45a4cccff2f4546eac88928201b (diff) | |
| parent | e06cd9f2c82c5bb3999eafda7abe2b1951384f78 (diff) | |
| download | rust-f6c56bcd66ebf0bfcb65ddd696c7e88210c38f00.tar.gz rust-f6c56bcd66ebf0bfcb65ddd696c7e88210c38f00.zip | |
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
| -rw-r--r-- | library/core/src/str/mod.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/library/core/src/str/mod.rs b/library/core/src/str/mod.rs index 1b6e84175b9..1a055a0a5ad 100644 --- a/library/core/src/str/mod.rs +++ b/library/core/src/str/mod.rs @@ -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 } } |
