@@ -327,7 +327,8 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
327327 . unwrap_or ( trait_ref. def_id ( ) ) ;
328328 let trait_ref = * trait_ref. skip_binder ( ) ;
329329
330- let s;
330+ let desugaring;
331+ let method;
331332 let mut flags = vec ! [ ] ;
332333 let direct = match obligation. cause . code {
333334 ObligationCauseCode :: BuiltinDerivedObligation ( ..) |
@@ -340,10 +341,23 @@ impl<'a, 'gcx, 'tcx> InferCtxt<'a, 'gcx, 'tcx> {
340341 flags. push ( ( "direct" , None ) ) ;
341342 }
342343
344+ if let ObligationCauseCode :: ItemObligation ( item) = obligation. cause . code {
345+ // FIXME: maybe also have some way of handling methods
346+ // from other traits? That would require name resolution,
347+ // which we might want to be some sort of hygienic.
348+ //
349+ // Currently I'm leaving it for what I need for `try`.
350+ if self . tcx . trait_of_item ( item) == Some ( trait_ref. def_id ) {
351+ method = self . tcx . item_name ( item) . as_str ( ) ;
352+ flags. push ( ( "from_method" , None ) ) ;
353+ flags. push ( ( "from_method" , Some ( & * method) ) ) ;
354+ }
355+ }
356+
343357 if let Some ( k) = obligation. cause . span . compiler_desugaring_kind ( ) {
344- s = k. as_symbol ( ) . as_str ( ) ;
358+ desugaring = k. as_symbol ( ) . as_str ( ) ;
345359 flags. push ( ( "from_desugaring" , None ) ) ;
346- flags. push ( ( "from_desugaring" , Some ( & * s ) ) ) ;
360+ flags. push ( ( "from_desugaring" , Some ( & * desugaring ) ) ) ;
347361 }
348362
349363 if let Ok ( Some ( command) ) = OnUnimplementedDirective :: of_item (
0 commit comments