Skip to content

Commit 20a6a6d

Browse files
author
root
committed
rustdoc: Change type name of raw pointer from *T to *const T
Update the formatting of raw immutable pointers to print *const T.
1 parent a672456 commit 20a6a6d

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
@@ -37,6 +37,8 @@ pub struct FnStyleSpace(pub ast::FnStyle);
3737
pub struct Method<'a>(pub &'a clean::SelfTy, pub &'a clean::FnDecl);
3838
/// Similar to VisSpace, but used for mutability
3939
pub struct MutableSpace(pub clean::Mutability);
40+
/// Similar to VisSpace, but used for mutability
41+
pub struct RawMutableSpace(pub clean::Mutability);
4042
/// Wrapper struct for properly emitting the stability level.
4143
pub struct Stability<'a>(pub &'a Option<clean::Stability>);
4244
/// Wrapper struct for emitting the stability level concisely.
@@ -441,7 +443,7 @@ impl fmt::Show for clean::Type {
441443
clean::Unique(ref t) => write!(f, "Box<{}>", **t),
442444
clean::Managed(ref t) => write!(f, "Gc<{}>", **t),
443445
clean::RawPointer(m, ref t) => {
444-
write!(f, "*{}{}", MutableSpace(m), **t)
446+
write!(f, "*{}{}", RawMutableSpace(m), **t)
445447
}
446448
clean::BorrowedRef{ lifetime: ref l, mutability, type_: ref ty} => {
447449
let lt = match *l {
@@ -601,6 +603,15 @@ impl fmt::Show for MutableSpace {
601603
}
602604
}
603605

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

0 commit comments

Comments
 (0)