make anything used in a resource body always reachable

(they appear to be uncond. inlined)

Fixes #2170.
This commit is contained in:
Niko Matsakis 2012-04-09 15:55:02 -07:00
parent 564d8e09c7
commit 24e921f7d4
3 changed files with 20 additions and 1 deletions

View File

@ -84,7 +84,11 @@ fn traverse_public_item(cx: ctx, item: @item) {
for vec::each(nm.items) {|item| cx.rmap.insert(item.id, ()); }
}
}
item_res(_, tps, blk, _, _) | item_fn(_, tps, blk) {
item_res(_, tps, blk, _, _) {
// resources seem to be unconditionally inlined
traverse_inline_body(cx, blk);
}
item_fn(_, tps, blk) {
if tps.len() > 0u ||
attr::find_inline_attr(item.attrs) != attr::ia_none {
traverse_inline_body(cx, blk);

View File

@ -0,0 +1,8 @@
export rsrc;
fn foo(_x: i32) {
}
resource rsrc(x: i32) {
foo(x);
}

View File

@ -0,0 +1,7 @@
// xfail-fast - check-fail fast doesn't under aux-build
// aux-build:issue2170lib.rs
use issue2170lib;
fn main() {
let _ = issue2170lib::rsrc(2i32);
}