result += [(cnum, cm.data, def)];
} else {
if cm.cnum_map.contains_key(def.crate) {
- // This reexport is itself a reexport from anther crate
+ // This reexport is itself a reexport from another crate
let next_cnum = cm.cnum_map.get(def.crate);
let next_cm_data = cstore::get_crate_data(cstore, next_cnum);
result += [(next_cnum, next_cm_data.data, def)];
fn lookup_external(e: env, cnum: int, ids: [ident], ns: namespace) ->
option<def> {
let mut result = none;
+ let mut done = false;
for csearch::lookup_defs(e.sess.cstore, cnum, ids).each {|d|
e.ext_map.insert(def_id_of_def(d), ids);
- if ns == ns_for_def(d) { result = some(d); }
+ if ns == ns_for_def(d) && !done {
+ result = some(d);
+ }
}
ret result;
}
}
}
}
- found_something |= lookup_glob_any(e, _mod, vi.span, ident,
- export_id);
+ /*
+ This code previously used bitwise or (|=) but that was wrong,
+ because we need or to be lazy here. If something was already
+ found, we don't want to call lookup_glob_any (see #2316 for
+ what happens if we do)
+ */
+ found_something = found_something ||
+ lookup_glob_any(e, _mod, vi.span, ident, export_id);
if !found_something {
e.sess.span_warn(vi.span,
#fmt("exported item %s is not defined", ident));
--- /dev/null
+use issue_2316_a;
+
+mod cloth {
+
+import issue_2316_a::*;
+
+export calico, gingham, flannel;
+export fabric;
+
+enum fabric {
+ gingham, flannel, calico
+}
+
+}
+
+
--- /dev/null
+// xfail-fast - check-fast doesn't understand aux-build
+// aux-build:issue_2316_a.rs
+// aux-build:issue_2316_b.rs
+
+use issue_2316_b;
+import issue_2316_b::cloth;
+
+fn main() {
+ let _c: cloth::fabric = cloth::calico;
+}
\ No newline at end of file