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.)
This commit is contained in:
parent
f1ea2b3094
commit
f9bbef7f44
@ -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 */ }
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user