diff options
| author | Patrick Walton <[email protected]> | 2010-11-05 10:37:32 -0700 |
|---|---|---|
| committer | Patrick Walton <[email protected]> | 2010-11-05 10:37:32 -0700 |
| commit | a58016d43e85721d50ff2a387ddab5bab0a1c13e (patch) | |
| tree | bc711f25159533885fb066db83faefdb477ecf26 /src/boot | |
| parent | Move the option type to its own module (diff) | |
| download | rust-a58016d43e85721d50ff2a387ddab5bab0a1c13e.tar.xz rust-a58016d43e85721d50ff2a387ddab5bab0a1c13e.zip | |
rustboot: Describe the cycle when reporting a cyclic import error
Diffstat (limited to 'src/boot')
| -rw-r--r-- | src/boot/me/semant.ml | 11 |
1 files changed, 10 insertions, 1 deletions
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 |