mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-01 06:51:58 +00:00
encode the borrowing table, add a simple cross-crate borrowing test
This commit is contained in:
parent
7d05bea7b9
commit
b04b415e0d
@ -844,6 +844,12 @@ fn encode_side_tables_for_id(ecx: @e::encode_ctxt,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
option::iter(tcx.borrowings.find(id)) {|_i|
|
||||
ebml_w.tag(c::tag_table_borrowings) {||
|
||||
ebml_w.id(id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl decoder for ebml::doc {
|
||||
@ -914,6 +920,8 @@ fn decode_side_tables(xcx: extended_decode_ctxt,
|
||||
dcx.maps.copy_map.insert(id, ());
|
||||
} else if tag == (c::tag_table_spill as uint) {
|
||||
dcx.maps.spill_map.insert(id, ());
|
||||
} else if tag == (c::tag_table_borrowings as uint) {
|
||||
dcx.tcx.borrowings.insert(id, ());
|
||||
} else {
|
||||
let val_doc = entry_doc[c::tag_table_val];
|
||||
let val_dsr = ebml::ebml_deserializer(val_doc);
|
||||
|
@ -109,7 +109,8 @@ enum astencode_tag { // Reserves 0x50 -- 0x6f
|
||||
tag_table_last_use,
|
||||
tag_table_spill,
|
||||
tag_table_method_map,
|
||||
tag_table_vtable_map
|
||||
tag_table_vtable_map,
|
||||
tag_table_borrowings
|
||||
}
|
||||
|
||||
// djb's cdb hashes.
|
||||
|
@ -307,6 +307,11 @@ fn parse_ty(st: @pstate, conv: conv_did) -> ty::t {
|
||||
'@' { ret ty::mk_box(st.tcx, parse_mt(st, conv)); }
|
||||
'~' { ret ty::mk_uniq(st.tcx, parse_mt(st, conv)); }
|
||||
'*' { ret ty::mk_ptr(st.tcx, parse_mt(st, conv)); }
|
||||
'&' {
|
||||
let r = parse_region(st);
|
||||
let mt = parse_mt(st, conv);
|
||||
ret ty::mk_rptr(st.tcx, r, mt);
|
||||
}
|
||||
'I' { ret ty::mk_vec(st.tcx, parse_mt(st, conv)); }
|
||||
'V' {
|
||||
let mt = parse_mt(st, conv);
|
||||
|
3
src/test/auxiliary/cci_borrow_lib.rs
Normal file
3
src/test/auxiliary/cci_borrow_lib.rs
Normal file
@ -0,0 +1,3 @@
|
||||
fn foo(x: &uint) -> uint {
|
||||
*x
|
||||
}
|
12
src/test/run-pass/cci_borrow.rs
Normal file
12
src/test/run-pass/cci_borrow.rs
Normal file
@ -0,0 +1,12 @@
|
||||
// xfail-fast - check-fast doesn't understand aux-build
|
||||
// aux-build:cci_borrow_lib.rs
|
||||
|
||||
use cci_borrow_lib;
|
||||
import cci_borrow_lib::foo;
|
||||
|
||||
fn main() {
|
||||
let p = @22u;
|
||||
let r = foo(p);
|
||||
#debug["r=%u", r];
|
||||
assert r == 22u;
|
||||
}
|
Loading…
Reference in New Issue
Block a user