Skip to content

Commit

Permalink
hash the contents of impl-item-ref by adding them to visitor
Browse files Browse the repository at this point in the history
Also simplify some of the `ty::AssociatedItem` representation,
in particular by folding `has_value` into `hir::Defaultness`
  • Loading branch information
nikomatsakis committed Nov 17, 2016
1 parent b6fd9c4 commit 3b51004
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions clean/inline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ pub fn build_impl<'a, 'tcx>(cx: &DocContext,
let trait_items = tcx.associated_items(did).filter_map(|item| {
match item.kind {
ty::AssociatedKind::Const => {
let default = if item.has_value {
let default = if item.defaultness.has_value() {
Some(pprust::expr_to_string(
lookup_const_by_id(tcx, item.def_id, None).unwrap().0))
} else {
Expand Down Expand Up @@ -407,7 +407,7 @@ pub fn build_impl<'a, 'tcx>(cx: &DocContext,
abi: abi
})
}
_ => panic!("not a tymethod"),
ref r => panic!("not a tymethod: {:?}", r),
};
Some(cleaned)
}
Expand Down
5 changes: 3 additions & 2 deletions clean/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1373,9 +1373,10 @@ impl<'tcx> Clean<Item> for ty::AssociatedItem {
}
}
}

let provided = match self.container {
ty::ImplContainer(_) => false,
ty::TraitContainer(_) => self.has_value
ty::TraitContainer(_) => self.defaultness.has_value()
};
if provided {
MethodItem(Method {
Expand Down Expand Up @@ -1440,7 +1441,7 @@ impl<'tcx> Clean<Item> for ty::AssociatedItem {
None => bounds.push(TyParamBound::maybe_sized(cx)),
}

let ty = if self.has_value {
let ty = if self.defaultness.has_value() {
Some(cx.tcx().item_type(self.def_id))
} else {
None
Expand Down

0 comments on commit 3b51004

Please sign in to comment.