diff options
| author | Felix S. Klock II <pnkfelix@pnkfx.org> | 2015-02-22 16:24:39 +0100 |
|---|---|---|
| committer | Felix S. Klock II <pnkfelix@pnkfx.org> | 2015-03-03 12:10:57 +0100 |
| commit | f9bbef7f448ba843052eb88733c79aa36c35d5ab (patch) | |
| tree | c53f314cbc4c22a67eaa0982c9ba459ad42290e3 | |
| parent | f1ea2b3094b1c28e64af30e187e31aa82f5ff004 (diff) | |
| download | rust-f9bbef7f448ba843052eb88733c79aa36c35d5ab.tar.gz rust-f9bbef7f448ba843052eb88733c79aa36c35d5ab.zip | |
Avoid fatal errors in astconv; just err and return `ty_err` instead.
This allows computation to proceed and find further errors. (However, this is also annoying at times when the subsequent errors are just reporting that a ty_err occurred. I have thoughts on ways to fix this that I will experiment with separately.)
| -rw-r--r-- | src/librustc_typeck/astconv.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/librustc_typeck/astconv.rs b/src/librustc_typeck/astconv.rs index 87c17c7d9ad..87604f4a4f8 100644 --- a/src/librustc_typeck/astconv.rs +++ b/src/librustc_typeck/astconv.rs @@ -1233,17 +1233,18 @@ pub fn finish_resolving_def_to_ty<'tcx>(this: &AstConv<'tcx>, if segments.is_empty() { opt_self_ty.expect("missing T in <T>::a::b::c") } else { - tcx.sess.span_bug(span, - &format!("found module name used as a type: {}", - tcx.map.node_to_string(id.node))); + span_err!(tcx.sess, span, E0247, "found module name used as a type: {}", + tcx.map.node_to_string(id.node)); + return this.tcx().types.err; } } def::DefPrimTy(prim_ty) => { prim_ty_to_ty(tcx, segments, prim_ty) } _ => { - span_fatal!(tcx.sess, span, E0248, - "found value name used as a type: {:?}", *def); + span_err!(tcx.sess, span, E0248, + "found value name used as a type: {:?}", *def); + return this.tcx().types.err; } }; @@ -1278,10 +1279,11 @@ pub fn ast_ty_to_ty<'tcx>(this: &AstConv<'tcx>, match ast_ty_to_ty_cache.get(&ast_ty.id) { Some(&ty::atttce_resolved(ty)) => return ty, Some(&ty::atttce_unresolved) => { - span_fatal!(tcx.sess, ast_ty.span, E0246, + span_err!(tcx.sess, ast_ty.span, E0246, "illegal recursive type; insert an enum \ or struct in the cycle, if this is \ desired"); + return this.tcx().types.err; } None => { /* go on */ } } |
