Skip to content

Commit bad05e2

Browse files
committed
Improve nonexistent-module error message
The error message for (for example) "import vec;" without "use std;" was "cyclic import", which was misleading because there were no cycles. I changed it to "cyclic import or nonexistent module", which doesn't break existing tests.
1 parent 029c1e7 commit bad05e2

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

src/comp/middle/resolve.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -724,7 +724,7 @@ fn lookup_import(&env e, def_id defid, namespace ns) -> option::t[def] {
724724
ret lookup_import(e, defid, ns);
725725
}
726726
case (resolving(?sp)) {
727-
e.sess.span_err(sp, "cyclic import");
727+
e.sess.span_err(sp, "cyclic import or nonexistent module");
728728
}
729729
case (resolved(?val, ?typ, ?md)) {
730730
ret alt (ns) { case (ns_value) { val }

src/test/compile-fail/bad-module.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// xfail-stage0
2+
// error-pattern: nonexistent module
3+
import vec;
4+
5+
fn main() {
6+
auto foo = vec.len([]);
7+
}

0 commit comments

Comments
 (0)