@@ -2,6 +2,7 @@ use crate::infer::type_variable::TypeVariableOriginKind;
2
2
use crate :: infer:: InferCtxt ;
3
3
use rustc_errors:: { pluralize, struct_span_err, Applicability , DiagnosticBuilder , ErrorGuaranteed } ;
4
4
use rustc_hir as hir;
5
+ use rustc_hir:: def:: Res ;
5
6
use rustc_hir:: def:: { CtorOf , DefKind , Namespace } ;
6
7
use rustc_hir:: def_id:: DefId ;
7
8
use rustc_hir:: intravisit:: { self , Visitor } ;
@@ -853,12 +854,20 @@ impl<'a, 'tcx> FindInferSourceVisitor<'a, 'tcx> {
853
854
hir:: TyKind :: Path ( hir:: QPath :: Resolved ( _self_ty, path) ) ,
854
855
) => {
855
856
if tcx. res_generics_def_id ( path. res ) != Some ( def. did ( ) ) {
856
- bug ! (
857
- "unexpected path: def={:?} substs={:?} path={:?}" ,
858
- def,
859
- substs,
860
- path,
861
- ) ;
857
+ match path. res {
858
+ Res :: Def ( DefKind :: TyAlias , _) => {
859
+ // FIXME: Ideally we should support this. For that
860
+ // we have to map back from the self type to the
861
+ // type alias though. That's difficult.
862
+ //
863
+ // See the `need_type_info/type-alias.rs` test for
864
+ // some examples.
865
+ }
866
+ _ => warn ! (
867
+ "unexpected path: def={:?} substs={:?} path={:?}" ,
868
+ def, substs, path,
869
+ ) ,
870
+ }
862
871
} else {
863
872
return Box :: new (
864
873
self . resolved_path_inferred_subst_iter ( path, substs)
0 commit comments