rustdoc: Encode ABI in all methods

This commit ensures that the ABI of functions is propagated all the way through
to the documentation.

Closes #22038
This commit is contained in:
Alex Crichton
2015-04-07 14:22:55 -07:00
parent 6950f68870
commit 2b9076ee19
10 changed files with 97 additions and 8 deletions

View File

@@ -18,6 +18,7 @@
use std::fmt;
use std::iter::repeat;
use syntax::abi::Abi;
use syntax::ast;
use syntax::ast_util;
@@ -54,6 +55,7 @@ pub struct WhereClause<'a>(pub &'a clean::Generics);
pub struct TyParamBounds<'a>(pub &'a [clean::TyParamBound]);
/// Wrapper struct for emitting a comma-separated list of items
pub struct CommaSep<'a, T: 'a>(pub &'a [T]);
pub struct AbiSpace(pub Abi);
impl VisSpace {
pub fn get(&self) -> Option<ast::Visibility> {
@@ -691,6 +693,16 @@ impl fmt::Display for RawMutableSpace {
}
}
impl fmt::Display for AbiSpace {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
match self.0 {
Abi::Rust => Ok(()),
Abi::C => write!(f, "extern "),
abi => write!(f, "extern {} ", abi),
}
}
}
impl<'a> fmt::Display for Stability<'a> {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let Stability(stab) = *self;