@@ -1260,7 +1260,7 @@ impl<'a, 'tcx> ParameterEnvironment<'tcx> {
12601260 match tcx. map . find ( id) {
12611261 Some ( ast_map:: NodeImplItem ( ref impl_item) ) => {
12621262 match impl_item. node {
1263- hir:: ImplItemKind :: Type ( _) => {
1263+ hir:: ImplItemKind :: Type ( _) | hir :: ImplItemKind :: Const ( _ , _ ) => {
12641264 // associated types don't have their own entry (for some reason),
12651265 // so for now just grab environment for the impl
12661266 let impl_id = tcx. map . get_parent ( id) ;
@@ -1272,15 +1272,6 @@ impl<'a, 'tcx> ParameterEnvironment<'tcx> {
12721272 & predicates,
12731273 tcx. region_maps . item_extent ( id) )
12741274 }
1275- hir:: ImplItemKind :: Const ( _, _) => {
1276- let def_id = tcx. map . local_def_id ( id) ;
1277- let scheme = tcx. lookup_item_type ( def_id) ;
1278- let predicates = tcx. lookup_predicates ( def_id) ;
1279- tcx. construct_parameter_environment ( impl_item. span ,
1280- & scheme. generics ,
1281- & predicates,
1282- tcx. region_maps . item_extent ( id) )
1283- }
12841275 hir:: ImplItemKind :: Method ( _, ref body) => {
12851276 let method_def_id = tcx. map . local_def_id ( id) ;
12861277 match tcx. impl_or_trait_item ( method_def_id) {
@@ -1303,7 +1294,7 @@ impl<'a, 'tcx> ParameterEnvironment<'tcx> {
13031294 }
13041295 Some ( ast_map:: NodeTraitItem ( trait_item) ) => {
13051296 match trait_item. node {
1306- hir:: TypeTraitItem ( ..) => {
1297+ hir:: TypeTraitItem ( ..) | hir :: ConstTraitItem ( .. ) => {
13071298 // associated types don't have their own entry (for some reason),
13081299 // so for now just grab environment for the trait
13091300 let trait_id = tcx. map . get_parent ( id) ;
@@ -1315,15 +1306,6 @@ impl<'a, 'tcx> ParameterEnvironment<'tcx> {
13151306 & predicates,
13161307 tcx. region_maps . item_extent ( id) )
13171308 }
1318- hir:: ConstTraitItem ( ..) => {
1319- let def_id = tcx. map . local_def_id ( id) ;
1320- let scheme = tcx. lookup_item_type ( def_id) ;
1321- let predicates = tcx. lookup_predicates ( def_id) ;
1322- tcx. construct_parameter_environment ( trait_item. span ,
1323- & scheme. generics ,
1324- & predicates,
1325- tcx. region_maps . item_extent ( id) )
1326- }
13271309 hir:: MethodTraitItem ( _, ref body) => {
13281310 // Use call-site for extent (unless this is a
13291311 // trait method with no default; then fallback
0 commit comments