]> git.lizzy.rs Git - rust.git/blobdiff - src/librustc_typeck/astconv.rs
Make name resolution errors non-fatal
[rust.git] / src / librustc_typeck / astconv.rs
index b83f0a5be6f042dc9b596ec915fa930bebb1765f..752dd6e57f64fc86fbba86c35e26d0ed9dc41d01 100644 (file)
@@ -719,6 +719,9 @@ fn trait_def_id<'tcx>(this: &AstConv<'tcx>, trait_ref: &hir::TraitRef) -> DefId
     let path = &trait_ref.path;
     match ::lookup_full_def(this.tcx(), path.span, trait_ref.ref_id) {
         def::DefTrait(trait_def_id) => trait_def_id,
+        def::DefErr => {
+            this.tcx().sess.fatal("cannot continue compilation due to previous error");
+        }
         _ => {
             span_fatal!(this.tcx().sess, path.span, E0245, "`{}` is not a trait",
                         path);
@@ -1533,6 +1536,9 @@ fn base_def_to_ty<'tcx>(this: &AstConv<'tcx>,
         def::DefPrimTy(prim_ty) => {
             prim_ty_to_ty(tcx, base_segments, prim_ty)
         }
+        def::DefErr => {
+            return this.tcx().types.err;
+        }
         _ => {
             let id_node = tcx.map.as_local_node_id(def.def_id()).unwrap();
             span_err!(tcx.sess, span, E0248,