@@ -282,32 +282,28 @@ impl<'tcx> Visitor<'tcx> for SpanMapVisitor<'tcx> {
282282 fn visit_qpath ( & mut self , qpath : & QPath < ' tcx > , id : HirId , _span : rustc_span:: Span ) {
283283 match * qpath {
284284 QPath :: TypeRelative ( qself, segment) => {
285- if let Res :: Err = segment. res {
286- // FIXME: This doesn't work for paths in *types* since HIR ty lowering currently
287- // doesn't write back the resolution of type-relative paths. Updating it
288- // to do so should be a simple fix.
289- // FIXME: This obviously doesn't support item signatures / non-bodies. Sadly,
290- // rustc currently doesn't keep around that information & thus can't
291- // provide an API for it.
292- // `ItemCtxt`s would need a place to write back the resolution of type-
293- // dependent definitions. Ideally there was some sort of query keyed on
294- // the `LocalDefId` of the owning item that returns some table with which
295- // we can map the `HirId` to a `DefId`.
296- // Of course, we could re-HIR-ty-lower such paths *here* if we were to
297- // extend the public API of HIR analysis. However, I strongly advise
298- // against it as it would be too much of a hack.
299- if let Some ( typeck_results) = self . maybe_typeck_results ( ) {
300- let path = hir:: Path {
301- // We change the span to not include parens.
302- span : segment. ident . span ,
303- res : typeck_results. qpath_res ( qpath, id) ,
304- // FIXME(fmease): Don't create a path with zero segments!
305- segments : & [ ] ,
306- } ;
307- self . handle_path ( & path, false ) ;
308- }
309- } else {
310- self . infer_id ( segment. hir_id , Some ( id) , segment. ident . span . into ( ) ) ;
285+ // FIXME: This doesn't work for paths in *types* since HIR ty lowering currently
286+ // doesn't write back the resolution of type-relative paths. Updating it to
287+ // do so should be a simple fix.
288+ // FIXME: This obviously doesn't support item signatures / non-bodies. Sadly, rustc
289+ // currently doesn't keep around that information & thus can't provide an API
290+ // for it.
291+ // `ItemCtxt`s would need a place to write back the resolution of type-
292+ // dependent definitions. Ideally there was some sort of query keyed on the
293+ // `LocalDefId` of the owning item that returns some table with which we can
294+ // map the `HirId` to a `DefId`.
295+ // Of course, we could re-HIR-ty-lower such paths *here* if we were to extend
296+ // the public API of HIR analysis. However, I strongly advise against it as
297+ // it would be too much of a hack.
298+ if let Some ( typeck_results) = self . maybe_typeck_results ( ) {
299+ let path = hir:: Path {
300+ // We change the span to not include parens.
301+ span : segment. ident . span ,
302+ res : typeck_results. qpath_res ( qpath, id) ,
303+ // FIXME(fmease): Don't create a path with zero segments!
304+ segments : & [ ] ,
305+ } ;
306+ self . handle_path ( & path, false ) ;
311307 }
312308
313309 rustc_ast:: visit:: try_visit!( self . visit_ty_unambig( qself) ) ;
0 commit comments