Skip to content

Commit

Permalink
rustdoc: Change type name of raw pointer from *T to *const T
Browse files Browse the repository at this point in the history
Update the formatting of raw immutable pointers to print *const T.
  • Loading branch information
root committed Jul 11, 2014
1 parent a672456 commit 20a6a6d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/librustdoc/html/format.rs
Expand Up @@ -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<clean::Stability>);
/// Wrapper struct for emitting the stability level concisely.
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
Expand Down

5 comments on commit 20a6a6d

@bors
Copy link
Contributor

@bors bors commented on 20a6a6d Jul 12, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 20a6a6d Jul 12, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging blake2-ppc/rust/rustdoc-const-t = 20a6a6d into auto

@bors
Copy link
Contributor

@bors bors commented on 20a6a6d Jul 12, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

blake2-ppc/rust/rustdoc-const-t = 20a6a6d merged ok, testing candidate = 6323e86

@bors
Copy link
Contributor

@bors bors commented on 20a6a6d Jul 12, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 6323e86

Please sign in to comment.