Skip to content

Commit 6323e86

Browse files
committed
auto merge of #15605 : blake2-ppc/rust/rustdoc-const-t, r=alexcrichton
Update the formatting of raw immutable pointers to print *const T.
2 parents da4e4e4 + 20a6a6d commit 6323e86

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/librustdoc/html/format.rs

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ pub struct FnStyleSpace(pub ast::FnStyle);
3838
pub struct Method<'a>(pub &'a clean::SelfTy, pub &'a clean::FnDecl);
3939
/// Similar to VisSpace, but used for mutability
4040
pub struct MutableSpace(pub clean::Mutability);
41+
/// Similar to VisSpace, but used for mutability
42+
pub struct RawMutableSpace(pub clean::Mutability);
4143
/// Wrapper struct for properly emitting the stability level.
4244
pub struct Stability<'a>(pub &'a Option<clean::Stability>);
4345
/// Wrapper struct for emitting the stability level concisely.
@@ -442,7 +444,7 @@ impl fmt::Show for clean::Type {
442444
clean::Unique(ref t) => write!(f, "Box<{}>", **t),
443445
clean::Managed(ref t) => write!(f, "Gc<{}>", **t),
444446
clean::RawPointer(m, ref t) => {
445-
write!(f, "*{}{}", MutableSpace(m), **t)
447+
write!(f, "*{}{}", RawMutableSpace(m), **t)
446448
}
447449
clean::BorrowedRef{ lifetime: ref l, mutability, type_: ref ty} => {
448450
let lt = match *l {
@@ -602,6 +604,15 @@ impl fmt::Show for MutableSpace {
602604
}
603605
}
604606

607+
impl fmt::Show for RawMutableSpace {
608+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
609+
match *self {
610+
RawMutableSpace(clean::Immutable) => write!(f, "const "),
611+
RawMutableSpace(clean::Mutable) => write!(f, "mut "),
612+
}
613+
}
614+
}
615+
605616
impl<'a> fmt::Show for Stability<'a> {
606617
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
607618
let Stability(stab) = *self;

0 commit comments

Comments
 (0)