From 20a6a6d8485f6c5f9f31fa44b7029da188ab5e2b Mon Sep 17 00:00:00 2001 From: root Date: Fri, 11 Jul 2014 11:35:02 +0200 Subject: [PATCH] rustdoc: Change type name of raw pointer from *T to *const T Update the formatting of raw immutable pointers to print *const T. --- src/librustdoc/html/format.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs index 382e299d28d9..8cc799e96675 100644 --- a/src/librustdoc/html/format.rs +++ b/src/librustdoc/html/format.rs @@ -37,6 +37,8 @@ pub struct FnStyleSpace(pub ast::FnStyle); pub struct Method<'a>(pub &'a clean::SelfTy, pub &'a clean::FnDecl); /// Similar to VisSpace, but used for mutability pub struct MutableSpace(pub clean::Mutability); +/// Similar to VisSpace, but used for mutability +pub struct RawMutableSpace(pub clean::Mutability); /// Wrapper struct for properly emitting the stability level. pub struct Stability<'a>(pub &'a Option); /// Wrapper struct for emitting the stability level concisely. @@ -441,7 +443,7 @@ impl fmt::Show for clean::Type { clean::Unique(ref t) => write!(f, "Box<{}>", **t), clean::Managed(ref t) => write!(f, "Gc<{}>", **t), clean::RawPointer(m, ref t) => { - write!(f, "*{}{}", MutableSpace(m), **t) + write!(f, "*{}{}", RawMutableSpace(m), **t) } clean::BorrowedRef{ lifetime: ref l, mutability, type_: ref ty} => { let lt = match *l { @@ -601,6 +603,15 @@ impl fmt::Show for MutableSpace { } } +impl fmt::Show for RawMutableSpace { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match *self { + RawMutableSpace(clean::Immutable) => write!(f, "const "), + RawMutableSpace(clean::Mutable) => write!(f, "mut "), + } + } +} + impl<'a> fmt::Show for Stability<'a> { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let Stability(stab) = *self;