@@ -130,16 +130,11 @@ impl OverloadedCallType {
130130
131131 fn from_method_id ( tcx : & ty:: ctxt , method_id : ast:: DefId )
132132 -> OverloadedCallType {
133- let method_descriptor =
134- match tcx. impl_or_trait_items . borrow_mut ( ) . find ( & method_id) {
135- Some ( & ty:: MethodTraitItem ( ref method_descriptor) ) => {
136- ( * method_descriptor) . clone ( )
137- }
138- None => {
139- tcx. sess . bug ( "overloaded call method wasn't in method \
140- map")
141- }
142- } ;
133+ let method_descriptor = match ty:: impl_or_trait_item ( tcx, method_id) {
134+ ty:: MethodTraitItem ( ref method_descriptor) => {
135+ ( * method_descriptor) . clone ( )
136+ }
137+ } ;
143138 let impl_id = match method_descriptor. container {
144139 ty:: TraitContainer ( _) => {
145140 tcx. sess . bug ( "statically resolved overloaded call method \
@@ -157,14 +152,27 @@ impl OverloadedCallType {
157152 OverloadedCallType :: from_trait_id ( tcx, trait_ref. def_id )
158153 }
159154
155+ fn from_unboxed_closure ( tcx : & ty:: ctxt , closure_did : ast:: DefId )
156+ -> OverloadedCallType {
157+ let trait_did =
158+ tcx. unboxed_closures
159+ . borrow ( )
160+ . find ( & closure_did)
161+ . expect ( "OverloadedCallType::from_unboxed_closure: didn't \
162+ find closure id")
163+ . kind
164+ . trait_did ( tcx) ;
165+ OverloadedCallType :: from_trait_id ( tcx, trait_did)
166+ }
167+
160168 fn from_method_origin ( tcx : & ty:: ctxt , origin : & MethodOrigin )
161169 -> OverloadedCallType {
162170 match * origin {
163171 MethodStatic ( def_id) => {
164172 OverloadedCallType :: from_method_id ( tcx, def_id)
165173 }
166174 MethodStaticUnboxedClosure ( def_id) => {
167- OverloadedCallType :: from_method_id ( tcx, def_id)
175+ OverloadedCallType :: from_unboxed_closure ( tcx, def_id)
168176 }
169177 MethodParam ( ref method_param) => {
170178 OverloadedCallType :: from_trait_id ( tcx, method_param. trait_id )
0 commit comments