rustdoc: Support unboxed fn sugar in bounds
This commit is contained in:
parent
2f955c73d6
commit
7be20574e0
@ -324,7 +324,7 @@ fn build_impl(cx: &DocContext, tcx: &ty::ctxt,
|
||||
trait_: associated_trait.clean(cx).map(|bound| {
|
||||
match bound {
|
||||
clean::TraitBound(ty) => ty,
|
||||
clean::UnboxedFnBound => unimplemented!(),
|
||||
clean::UnboxedFnBound(..) |
|
||||
clean::RegionBound(..) |
|
||||
clean::UnknownBound => unreachable!(),
|
||||
}
|
||||
|
@ -474,7 +474,7 @@ impl Clean<TyParam> for ty::TypeParameterDef {
|
||||
#[deriving(Clone, Encodable, Decodable, PartialEq)]
|
||||
pub enum TyParamBound {
|
||||
RegionBound(Lifetime),
|
||||
UnboxedFnBound, // FIXME
|
||||
UnboxedFnBound(UnboxedFnType),
|
||||
UnknownBound,
|
||||
TraitBound(Type)
|
||||
}
|
||||
@ -483,10 +483,7 @@ impl Clean<TyParamBound> for ast::TyParamBound {
|
||||
fn clean(&self, cx: &DocContext) -> TyParamBound {
|
||||
match *self {
|
||||
ast::RegionTyParamBound(lt) => RegionBound(lt.clean(cx)),
|
||||
ast::UnboxedFnTyParamBound(_) => {
|
||||
// FIXME(pcwalton): Wrong.
|
||||
UnboxedFnBound
|
||||
},
|
||||
ast::UnboxedFnTyParamBound(ref ty) => { UnboxedFnBound(ty.clean(cx)) },
|
||||
ast::TraitTyParamBound(ref t) => TraitBound(t.clean(cx)),
|
||||
}
|
||||
}
|
||||
@ -598,6 +595,21 @@ impl Clean<Option<Vec<TyParamBound>>> for subst::Substs {
|
||||
}
|
||||
}
|
||||
|
||||
#[deriving(Clone, Encodable, Decodable, PartialEq)]
|
||||
pub struct UnboxedFnType {
|
||||
pub path: Path,
|
||||
pub decl: FnDecl
|
||||
}
|
||||
|
||||
impl Clean<UnboxedFnType> for ast::UnboxedFnBound {
|
||||
fn clean(&self, cx: &DocContext) -> UnboxedFnType {
|
||||
UnboxedFnType {
|
||||
path: self.path.clean(cx),
|
||||
decl: self.decl.clean(cx)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[deriving(Clone, Encodable, Decodable, PartialEq)]
|
||||
pub struct Lifetime(String);
|
||||
|
||||
|
@ -143,8 +143,8 @@ impl fmt::Show for clean::TyParamBound {
|
||||
clean::RegionBound(ref lt) => {
|
||||
write!(f, "{}", *lt)
|
||||
}
|
||||
clean::UnboxedFnBound(..) => {
|
||||
write!(f, "Fn(???)") // FIXME
|
||||
clean::UnboxedFnBound(ref ty) => {
|
||||
write!(f, "{}{}", ty.path, ty.decl)
|
||||
}
|
||||
clean::UnknownBound => {
|
||||
write!(f, "'static")
|
||||
@ -408,7 +408,7 @@ impl fmt::Show for clean::Type {
|
||||
for bound in decl.bounds.iter() {
|
||||
match *bound {
|
||||
clean::RegionBound(..) |
|
||||
clean::UnboxedFnBound |
|
||||
clean::UnboxedFnBound(..) |
|
||||
clean::UnknownBound => {}
|
||||
clean::TraitBound(ref t) => {
|
||||
if ret.len() == 0 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user