match tcx.map.find(id) {
Some(ast_map::NodeImplItem(ref impl_item)) => {
match impl_item.node {
- hir::ImplItemKind::Type(_) => {
+ hir::ImplItemKind::Type(_) | hir::ImplItemKind::Const(_, _) => {
// associated types don't have their own entry (for some reason),
// so for now just grab environment for the impl
let impl_id = tcx.map.get_parent(id);
&predicates,
tcx.region_maps.item_extent(id))
}
- hir::ImplItemKind::Const(_, _) => {
- let def_id = tcx.map.local_def_id(id);
- let scheme = tcx.lookup_item_type(def_id);
- let predicates = tcx.lookup_predicates(def_id);
- tcx.construct_parameter_environment(impl_item.span,
- &scheme.generics,
- &predicates,
- tcx.region_maps.item_extent(id))
- }
hir::ImplItemKind::Method(_, ref body) => {
let method_def_id = tcx.map.local_def_id(id);
match tcx.impl_or_trait_item(method_def_id) {
}
Some(ast_map::NodeTraitItem(trait_item)) => {
match trait_item.node {
- hir::TypeTraitItem(..) => {
+ hir::TypeTraitItem(..) | hir::ConstTraitItem(..) => {
// associated types don't have their own entry (for some reason),
// so for now just grab environment for the trait
let trait_id = tcx.map.get_parent(id);
&predicates,
tcx.region_maps.item_extent(id))
}
- hir::ConstTraitItem(..) => {
- let def_id = tcx.map.local_def_id(id);
- let scheme = tcx.lookup_item_type(def_id);
- let predicates = tcx.lookup_predicates(def_id);
- tcx.construct_parameter_environment(trait_item.span,
- &scheme.generics,
- &predicates,
- tcx.region_maps.item_extent(id))
- }
hir::MethodTraitItem(_, ref body) => {
// Use call-site for extent (unless this is a
// trait method with no default; then fallback