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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user