about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-07-12 14:36:35 +0000
committerbors <bors@rust-lang.org>2014-07-12 14:36:35 +0000
commit6323e8653cf46da4b4d445db491fc5b0c78e86d4 (patch)
treee2ca2d9b1f73c08a7d6742ce540fdea669dff623 /src
parentda4e4e4e0a7778a85748aa4a303b13f603e96b4b (diff)
parent20a6a6d8485f6c5f9f31fa44b7029da188ab5e2b (diff)
downloadrust-6323e8653cf46da4b4d445db491fc5b0c78e86d4.tar.gz
rust-6323e8653cf46da4b4d445db491fc5b0c78e86d4.zip
auto merge of #15605 : blake2-ppc/rust/rustdoc-const-t, r=alexcrichton
Update the formatting of raw immutable pointers to print *const T.
Diffstat (limited to 'src')
-rw-r--r--src/librustdoc/html/format.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/librustdoc/html/format.rs b/src/librustdoc/html/format.rs
index 84c0f0b97a1..e2ff80b9fd9 100644
--- a/src/librustdoc/html/format.rs
+++ b/src/librustdoc/html/format.rs
@@ -38,6 +38,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<clean::Stability>);
 /// Wrapper struct for emitting the stability level concisely.
@@ -442,7 +444,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 {
@@ -602,6 +604,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;