Produce better errors for invalid imports.
This commit is contained in:
parent
c489abedb4
commit
c1f2e29596
@ -404,6 +404,7 @@ TEST_XFAILS_BOOT := $(TASK_XFAILS) \
|
||||
test/run-fail/task-comm-14.rs \
|
||||
test/compile-fail/import.rs \
|
||||
test/compile-fail/import2.rs \
|
||||
test/compile-fail/import3.rs \
|
||||
test/compile-fail/bad-recv.rs \
|
||||
test/compile-fail/bad-send.rs \
|
||||
test/compile-fail/infinite-vec-type-recursion.rs \
|
||||
|
@ -90,6 +90,12 @@ fn find_final_def(&env e, &span sp, vec[ident] idents) -> option.t[def_wrap] {
|
||||
auto new_e = update_env_for_item(tmp_e, i);
|
||||
ret find_final_def(new_e, sp, new_idents);
|
||||
}
|
||||
case (def_wrap_use(?c)) {
|
||||
e.sess.span_err(sp, "Crate access is not implemented");
|
||||
}
|
||||
case (_) {
|
||||
e.sess.span_err(sp, first + " is not a module or crate");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
6
src/test/compile-fail/import3.rs
Normal file
6
src/test/compile-fail/import3.rs
Normal file
@ -0,0 +1,6 @@
|
||||
// error-pattern: main is not a module or crate
|
||||
import main.bar;
|
||||
|
||||
fn main(vec[str] args) {
|
||||
log "foo";
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user