From a58016d43e85721d50ff2a387ddab5bab0a1c13e Mon Sep 17 00:00:00 2001 From: Patrick Walton Date: Fri, 5 Nov 2010 10:37:32 -0700 Subject: rustboot: Describe the cycle when reporting a cyclic import error --- src/boot/me/semant.ml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/boot') diff --git a/src/boot/me/semant.ml b/src/boot/me/semant.ml index 56c52a3c..12f973c1 100644 --- a/src/boot/me/semant.ml +++ b/src/boot/me/semant.ml @@ -2001,7 +2001,16 @@ let rec project_ident_from_items let lchk = if List.mem (scope_id, ident) lchk - then err (Some scope_id) "cyclic import for ident %s" ident + then + let string_of_loop_check (id, ident) = + match Session.get_span cx.ctxt_sess id with + Some span -> ident ^ " @ " ^ (Session.string_of_span span) + | None -> ident + in + let lchk' = (scope_id, ident)::lchk in + let lchk_strs = List.map string_of_loop_check (List.rev lchk') in + err (Some scope_id) "cyclic import for ident %s (%s)" ident + (String.concat " -> " lchk_strs) else (scope_id, ident)::lchk in -- cgit v1.2.3