1
Fork 0

Improve errors for recursive type aliases

This commit is contained in:
Noah Lev 2021-07-20 18:06:39 -07:00
parent d3e2578c31
commit 2f48bfa88c
14 changed files with 38 additions and 23 deletions

View file

@ -591,10 +591,14 @@ pub(crate) fn report_cycle<'a>(
err.span_note(span, &format!("...which requires {}...", query.description));
}
err.note(&format!(
"...which again requires {}, completing the cycle",
stack[0].query.description
));
if stack.len() == 1 {
err.note(&format!("...which immediately requires {} again", stack[0].query.description));
} else {
err.note(&format!(
"...which again requires {}, completing the cycle",
stack[0].query.description
));
}
if let Some((span, query)) = usage {
err.span_note(fix_span(span, &query), &format!("cycle used when {}", query.description));