提交 e5a5fc20 编写于 作者: T Tim Chevalier

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.
上级 1db8515c
......@@ -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));
}
};
......
#[link(name = "a", vers = "0.1")];
#[crate_type = "lib"];
type t1 = uint;
impl t2 for str { }
// xfail-fast
#[link(name = "b", vers = "0.1")];
#[crate_type = "lib"];
use a;
import a::t2;
export t2;
// xfail-fast
// aux-build:issue-2414-a.rs
// aux-build:issue-2414-b.rs
use b;
fn main() {}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册