make anything used in a resource body always reachable
(they appear to be uncond. inlined) Fixes #2170.
This commit is contained in:
parent
564d8e09c7
commit
24e921f7d4
@ -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);
|
||||
|
8
src/test/auxiliary/issue2170lib.rs
Normal file
8
src/test/auxiliary/issue2170lib.rs
Normal file
@ -0,0 +1,8 @@
|
||||
export rsrc;
|
||||
|
||||
fn foo(_x: i32) {
|
||||
}
|
||||
|
||||
resource rsrc(x: i32) {
|
||||
foo(x);
|
||||
}
|
7
src/test/run-pass/issue2170exe.rs
Normal file
7
src/test/run-pass/issue2170exe.rs
Normal 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);
|
||||
}
|
Loading…
Reference in New Issue
Block a user