about summary refs log tree commit diff
path: root/compiler/rustc_query_system
diff options
context:
space:
mode:
authorNoah Lev <camelidcamel@gmail.com>2021-07-20 18:06:39 -0700
committerNoah Lev <camelidcamel@gmail.com>2021-08-21 18:30:25 -0700
commit2f48bfa88c1c742ed058fc8af096d8cedc138434 (patch)
tree7ba8d580294450e1e6bc3c82a7d479ca7d0aa4a8 /compiler/rustc_query_system
parentd3e2578c31688619ddc0a10ddf8543bf4ebcba5b (diff)
Improve errors for recursive type aliases
Diffstat (limited to 'compiler/rustc_query_system')
-rw-r--r--compiler/rustc_query_system/src/query/job.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/compiler/rustc_query_system/src/query/job.rs b/compiler/rustc_query_system/src/query/job.rs
index a967670280f..b7ac42546dd 100644
--- a/compiler/rustc_query_system/src/query/job.rs
+++ b/compiler/rustc_query_system/src/query/job.rs
@@ -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));