From efeb46187398199dd9ac1b1e0c1ba43180de9b4f Mon Sep 17 00:00:00 2001 From: Waffle Date: Tue, 7 Sep 2021 16:41:15 +0300 Subject: [PATCH 1/2] Make `UnsafeCell::get_mut` const --- library/core/src/cell.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/library/core/src/cell.rs b/library/core/src/cell.rs index 2adf6a549e641..25c153dae04e3 100644 --- a/library/core/src/cell.rs +++ b/library/core/src/cell.rs @@ -1916,7 +1916,8 @@ impl UnsafeCell { /// ``` #[inline(always)] #[stable(feature = "unsafe_cell_get_mut", since = "1.50.0")] - pub fn get_mut(&mut self) -> &mut T { + #[rustc_const_unstable(feature = "const_unsafecell_get_mut", issue = "none")] + pub const fn get_mut(&mut self) -> &mut T { &mut self.value } From 2c30162380ac06e5e6b084164ee6ba596a9398f0 Mon Sep 17 00:00:00 2001 From: Waffle Lapkin Date: Sat, 11 Sep 2021 00:07:14 +0300 Subject: [PATCH 2/2] Fill in the tracking issue for `#![feature(const_unsafecell_get_mut)]` --- library/core/src/cell.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/library/core/src/cell.rs b/library/core/src/cell.rs index 25c153dae04e3..e56b631dbaf8d 100644 --- a/library/core/src/cell.rs +++ b/library/core/src/cell.rs @@ -1916,7 +1916,7 @@ impl UnsafeCell { /// ``` #[inline(always)] #[stable(feature = "unsafe_cell_get_mut", since = "1.50.0")] - #[rustc_const_unstable(feature = "const_unsafecell_get_mut", issue = "none")] + #[rustc_const_unstable(feature = "const_unsafecell_get_mut", issue = "88836")] pub const fn get_mut(&mut self) -> &mut T { &mut self.value }