diff options
| author | Kalle Wachsmuth <kalle.wachsmuth@gmail.com> | 2024-03-24 14:53:58 +0100 |
|---|---|---|
| committer | Kalle Wachsmuth <kalle.wachsmuth@gmail.com> | 2024-04-10 18:51:09 +0200 |
| commit | 277e61854eaad456816730bb0a75d85a3a460d96 (patch) | |
| tree | 34d1b374129e249e88133c7b711bdcb433bf9f44 /compiler/rustc_ast_ir | |
| parent | db3a5c58739137036f85cee036c1b63af2517093 (diff) | |
| download | rust-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.rs | 8 |
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 { |
