From 05af4213b593de5e6b73d8dda0eedf54b4568266 Mon Sep 17 00:00:00 2001 From: Yaulendil Date: Mon, 21 Dec 2020 18:42:29 -0500 Subject: [PATCH 1/2] Implement `AsMut` for `str` --- library/core/src/convert/mod.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/library/core/src/convert/mod.rs b/library/core/src/convert/mod.rs index 3f7110b34cc..d8c2e0b2a3b 100644 --- a/library/core/src/convert/mod.rs +++ b/library/core/src/convert/mod.rs @@ -623,6 +623,14 @@ impl AsRef for str { } } +#[stable(feature = "as_mut_str_for_str", since = "1.50.0")] +impl AsMut for str { + #[inline] + fn as_mut(&mut self) -> &mut str { + self + } +} + //////////////////////////////////////////////////////////////////////////////// // THE NO-ERROR ERROR TYPE //////////////////////////////////////////////////////////////////////////////// From bef4ec2fc51aa020fe6bf81257459f096763f3b7 Mon Sep 17 00:00:00 2001 From: Mara Bos Date: Sat, 30 Jan 2021 22:10:25 +0100 Subject: [PATCH 2/2] Bump as_mut_str_for_str stable version. --- library/core/src/convert/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/core/src/convert/mod.rs b/library/core/src/convert/mod.rs index d8c2e0b2a3b..ea8070534eb 100644 --- a/library/core/src/convert/mod.rs +++ b/library/core/src/convert/mod.rs @@ -623,7 +623,7 @@ impl AsRef for str { } } -#[stable(feature = "as_mut_str_for_str", since = "1.50.0")] +#[stable(feature = "as_mut_str_for_str", since = "1.51.0")] impl AsMut for str { #[inline] fn as_mut(&mut self) -> &mut str {