Skip to content

Commit 1c6ae8c

Browse files
committed
Use span_fatal for failure to find crates
1 parent 46b83a9 commit 1c6ae8c

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/comp/metadata/creader.rs

+5-6
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ fn get_metadata_section(str filename) -> option::t[vec[u8]] {
123123
ret option::none[vec[u8]];
124124
}
125125

126-
fn load_library_crate(&session::session sess, int cnum, &ast::ident ident,
127-
&vec[@ast::meta_item] metas,
126+
fn load_library_crate(&session::session sess, common::span span, int cnum,
127+
&ast::ident ident, vec[@ast::meta_item] metas,
128128
&vec[str] library_search_paths) {
129129
alt (find_library_crate(sess, ident, metas, library_search_paths)) {
130130
case (some(?t)) {
@@ -134,8 +134,7 @@ fn load_library_crate(&session::session sess, int cnum, &ast::ident ident,
134134
}
135135
case (_) { }
136136
}
137-
log_err #fmt("can't find crate for '%s'", ident);
138-
fail;
137+
sess.span_fatal(span, #fmt("can't find crate for '%s'", ident));
139138
}
140139

141140
type env =
@@ -151,8 +150,8 @@ fn visit_view_item(env e, &@ast::view_item i) {
151150
auto cnum;
152151
if (!e.crate_cache.contains_key(ident)) {
153152
cnum = e.next_crate_num;
154-
load_library_crate(e.sess, cnum, ident, meta_items,
155-
e.library_search_paths);
153+
load_library_crate(e.sess, i.span, cnum, ident,
154+
meta_items, e.library_search_paths);
156155
e.crate_cache.insert(ident, e.next_crate_num);
157156
e.next_crate_num += 1;
158157
} else { cnum = e.crate_cache.get(ident); }

0 commit comments

Comments
 (0)