Allow impls to be re-exported
It was a little hard for me to believe, but it seems that re-exporting an impl doesn't work at a, because encoder::encode_info_for_mod requires that all the impls in the current module's impl map be local (that is, bound to a value in the current crate's item map). Fixed it. Closes #2414.
This commit is contained in:
parent
1db8515c08
commit
e5a5fc2029
src
@ -396,17 +396,21 @@ fn encode_info_for_mod(ecx: @encode_ctxt, ebml_w: ebml::writer, md: _mod,
|
||||
let (ident, did) = i;
|
||||
if ast_util::is_exported(ident, md) {
|
||||
ebml_w.start_tag(tag_mod_impl);
|
||||
alt ecx.tcx.items.find(did.node) {
|
||||
some(ast_map::node_item(it@@{node: cl@item_class(*),_},_)) {
|
||||
/* If did stands for an iface
|
||||
ref, we need to map it to its parent class */
|
||||
alt ecx.tcx.items.get(did.node) {
|
||||
ast_map::node_item(it@@{node: cl@item_class(*),_},_) {
|
||||
ebml_w.wr_str(def_to_str(local_def(it.id)));
|
||||
}
|
||||
ast_map::node_item(@{node: item_impl(_,_,
|
||||
some(ifce),_,_),_},_) {
|
||||
some(ast_map::node_item(@{node: item_impl(_,_,
|
||||
some(ifce),_,_),_},_)) {
|
||||
ebml_w.wr_str(def_to_str(did));
|
||||
}
|
||||
_ {
|
||||
some(_) {
|
||||
ebml_w.wr_str(def_to_str(did));
|
||||
}
|
||||
none {
|
||||
// Must be a re-export, then!
|
||||
ebml_w.wr_str(def_to_str(did));
|
||||
}
|
||||
};
|
||||
|
5
src/test/auxiliary/issue-2414-a.rs
Normal file
5
src/test/auxiliary/issue-2414-a.rs
Normal file
@ -0,0 +1,5 @@
|
||||
#[link(name = "a", vers = "0.1")];
|
||||
#[crate_type = "lib"];
|
||||
|
||||
type t1 = uint;
|
||||
impl t2 for str { }
|
9
src/test/auxiliary/issue-2414-b.rs
Normal file
9
src/test/auxiliary/issue-2414-b.rs
Normal file
@ -0,0 +1,9 @@
|
||||
// xfail-fast
|
||||
|
||||
#[link(name = "b", vers = "0.1")];
|
||||
#[crate_type = "lib"];
|
||||
|
||||
use a;
|
||||
|
||||
import a::t2;
|
||||
export t2;
|
7
src/test/run-pass/issue-2414-c.rs
Normal file
7
src/test/run-pass/issue-2414-c.rs
Normal file
@ -0,0 +1,7 @@
|
||||
// xfail-fast
|
||||
// aux-build:issue-2414-a.rs
|
||||
// aux-build:issue-2414-b.rs
|
||||
|
||||
use b;
|
||||
|
||||
fn main() {}
|
Loading…
x
Reference in New Issue
Block a user