mirror of
https://github.com/rust-lang/rust.git
synced 2025-04-15 21:47:04 +00:00
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.
This commit is contained in:
parent
029c1e71ff
commit
bad05e20a3
@ -724,7 +724,7 @@ fn lookup_import(&env e, def_id defid, namespace ns) -> option::t[def] {
|
||||
ret lookup_import(e, defid, ns);
|
||||
}
|
||||
case (resolving(?sp)) {
|
||||
e.sess.span_err(sp, "cyclic import");
|
||||
e.sess.span_err(sp, "cyclic import or nonexistent module");
|
||||
}
|
||||
case (resolved(?val, ?typ, ?md)) {
|
||||
ret alt (ns) { case (ns_value) { val }
|
||||
|
7
src/test/compile-fail/bad-module.rs
Normal file
7
src/test/compile-fail/bad-module.rs
Normal file
@ -0,0 +1,7 @@
|
||||
// xfail-stage0
|
||||
// error-pattern: nonexistent module
|
||||
import vec;
|
||||
|
||||
fn main() {
|
||||
auto foo = vec.len([]);
|
||||
}
|
Loading…
Reference in New Issue
Block a user