about summary refs log tree commit diff
path: root/compiler/rustc_ast_ir
diff options
context:
space:
mode:
authorKalle Wachsmuth <kalle.wachsmuth@gmail.com>2024-03-24 14:53:58 +0100
committerKalle Wachsmuth <kalle.wachsmuth@gmail.com>2024-04-10 18:51:09 +0200
commit277e61854eaad456816730bb0a75d85a3a460d96 (patch)
tree34d1b374129e249e88133c7b711bdcb433bf9f44 /compiler/rustc_ast_ir
parentdb3a5c58739137036f85cee036c1b63af2517093 (diff)
downloadrust-277e61854eaad456816730bb0a75d85a3a460d96.tar.gz
rust-277e61854eaad456816730bb0a75d85a3a460d96.zip
introduce `Mutability::ptr_str`
Diffstat (limited to 'compiler/rustc_ast_ir')
-rw-r--r--compiler/rustc_ast_ir/src/lib.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/compiler/rustc_ast_ir/src/lib.rs b/compiler/rustc_ast_ir/src/lib.rs
index ff7a1552047..9ff2e32f06b 100644
--- a/compiler/rustc_ast_ir/src/lib.rs
+++ b/compiler/rustc_ast_ir/src/lib.rs
@@ -51,6 +51,14 @@ impl Mutability {
         }
     }
 
+    /// Returns `"const"` or `"mut"` depending on the mutability.
+    pub fn ptr_str(self) -> &'static str {
+        match self {
+            Mutability::Not => "const",
+            Mutability::Mut => "mut",
+        }
+    }
+
     /// Returns `""` (empty string) or `"mutably "` depending on the mutability.
     pub fn mutably_str(self) -> &'static str {
         match self {