Skip to content

Commit b7e7297

Browse files
committed
auto merge of #5147 : nikomatsakis/rust/remove-legacy-trait-table, r=nikomatsakis
r? @pcwalton
2 parents 66f9e60 + 4ecb672 commit b7e7297

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+295
-354
lines changed

src/libcore/io.rs

+7-7
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ pub fn FILE_reader(f: *libc::FILE, cleanup: bool) -> @Reader {
504504

505505
pub fn stdin() -> @Reader {
506506
unsafe {
507-
rustrt::rust_get_stdin() as @Reader
507+
@rustrt::rust_get_stdin() as @Reader
508508
}
509509
}
510510

@@ -642,11 +642,11 @@ impl Writer for *libc::FILE {
642642
}
643643
}
644644

645-
pub fn FILE_writer(f: *libc::FILE, cleanup: bool) -> Writer {
645+
pub fn FILE_writer(f: *libc::FILE, cleanup: bool) -> @Writer {
646646
if cleanup {
647-
Wrapper { base: f, cleanup: FILERes(f) } as Writer
647+
@Wrapper { base: f, cleanup: FILERes(f) } as @Writer
648648
} else {
649-
f as Writer
649+
@f as @Writer
650650
}
651651
}
652652

@@ -702,11 +702,11 @@ pub fn FdRes(fd: fd_t) -> FdRes {
702702
}
703703
}
704704

705-
pub fn fd_writer(fd: fd_t, cleanup: bool) -> Writer {
705+
pub fn fd_writer(fd: fd_t, cleanup: bool) -> @Writer {
706706
if cleanup {
707-
Wrapper { base: fd, cleanup: FdRes(fd) } as Writer
707+
@Wrapper { base: fd, cleanup: FdRes(fd) } as @Writer
708708
} else {
709-
fd as Writer
709+
@fd as @Writer
710710
}
711711
}
712712

src/libcore/rand.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -412,8 +412,8 @@ pub fn Rng() -> Rng {
412412
* all other generators constructed with the same seed. The seed may be any
413413
* length.
414414
*/
415-
pub fn seeded_rng(seed: &[u8]) -> Rng {
416-
seeded_randres(seed) as Rng
415+
pub fn seeded_rng(seed: &[u8]) -> @Rng {
416+
@seeded_randres(seed) as @Rng
417417
}
418418

419419
fn seeded_randres(seed: &[u8]) -> @RandRes {
@@ -449,8 +449,8 @@ pub pure fn xorshift() -> Rng {
449449
seeded_xorshift(123456789u32, 362436069u32, 521288629u32, 88675123u32)
450450
}
451451

452-
pub pure fn seeded_xorshift(x: u32, y: u32, z: u32, w: u32) -> Rng {
453-
XorShiftState { x: x, y: y, z: z, w: w } as Rng
452+
pub pure fn seeded_xorshift(x: u32, y: u32, z: u32, w: u32) -> @Rng {
453+
@XorShiftState { x: x, y: y, z: z, w: w } as @Rng
454454
}
455455

456456

@@ -472,10 +472,10 @@ pub fn task_rng() -> Rng {
472472
unsafe {
473473
let rng = seeded_randres(seed());
474474
task::local_data::local_data_set(tls_rng_state, rng);
475-
rng as Rng
475+
@rng as @Rng
476476
}
477477
}
478-
Some(rng) => rng as Rng
478+
Some(rng) => @rng as @Rng
479479
}
480480
}
481481

src/libcore/repr.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ pub impl ReprVisitor {
201201
unsafe {
202202
let mut u = ReprVisitor(ptr, self.writer);
203203
let v = reflect::MovePtrAdaptor(u);
204-
visit_tydesc(inner, (v) as @TyVisitor);
204+
visit_tydesc(inner, @v as @TyVisitor);
205205
true
206206
}
207207
}
@@ -570,7 +570,7 @@ pub fn write_repr<T>(writer: @Writer, object: &T) {
570570
let tydesc = intrinsic::get_tydesc::<T>();
571571
let mut u = ReprVisitor(ptr, writer);
572572
let v = reflect::MovePtrAdaptor(u);
573-
visit_tydesc(tydesc, (v) as @TyVisitor)
573+
visit_tydesc(tydesc, @v as @TyVisitor)
574574
}
575575
}
576576

src/libcore/run.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ pub fn start_program(prog: &str, args: &[~str]) -> Program {
288288
finished: false,
289289
};
290290

291-
ProgRes(repr) as Program
291+
@ProgRes(repr) as @Program
292292
}
293293

294294
fn read_all(rd: io::Reader) -> ~str {

src/libcore/task/local_data_priv.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ pub unsafe fn local_set<T:Durable>(
155155
// does not have a reference associated with it, so it may become invalid
156156
// when the box is destroyed.
157157
let data_ptr = cast::reinterpret_cast(&data);
158-
let data_box = data as LocalData;
158+
let data_box = @data as @LocalData;
159159
// Construct new entry to store in the map.
160160
let new_entry = Some((keyval, data_ptr, data_box));
161161
// Find a place to put it.

src/librustc/metadata/common.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,8 @@ pub enum astencode_tag { // Reserves 0x50 -- 0x6f
132132
tag_table_method_map = 0x60,
133133
tag_table_vtable_map = 0x61,
134134
tag_table_adjustments = 0x62,
135-
tag_table_legacy_boxed_trait = 0x63,
136-
tag_table_moves_map = 0x64,
137-
tag_table_capture_map = 0x65
135+
tag_table_moves_map = 0x63,
136+
tag_table_capture_map = 0x64
138137
}
139138

140139
pub const tag_item_trait_method_sort: uint = 0x70;

src/librustc/metadata/filesearch.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ pub fn mk_filesearch(maybe_sysroot: Option<Path>,
7171

7272
let sysroot = get_sysroot(maybe_sysroot);
7373
debug!("using sysroot = %s", sysroot.to_str());
74-
FileSearchImpl {
74+
@FileSearchImpl {
7575
sysroot: sysroot,
7676
addl_lib_search_paths: addl_lib_search_paths,
7777
target_triple: str::from_slice(target_triple)
78-
} as FileSearch
78+
} as @FileSearch
7979
}
8080

8181
pub fn search<T:Copy>(filesearch: FileSearch, pick: pick<T>) -> Option<T> {

src/librustc/middle/astencode.rs

+1-9
Original file line numberDiff line numberDiff line change
@@ -966,12 +966,6 @@ fn encode_side_tables_for_id(ecx: @e::EncodeContext,
966966
}
967967
}
968968
969-
do option::iter(&tcx.legacy_boxed_traits.find(&id)) |_x| {
970-
do ebml_w.tag(c::tag_table_legacy_boxed_trait) {
971-
ebml_w.id(id);
972-
}
973-
}
974-
975969
for maps.moves_map.find(&id).each |_| {
976970
do ebml_w.tag(c::tag_table_moves_map) {
977971
ebml_w.id(id);
@@ -1121,8 +1115,6 @@ fn decode_side_tables(xcx: @ExtendedDecodeContext,
11211115
11221116
if tag == (c::tag_table_mutbl as uint) {
11231117
dcx.maps.mutbl_map.insert(id, ());
1124-
} else if tag == (c::tag_table_legacy_boxed_trait as uint) {
1125-
dcx.tcx.legacy_boxed_traits.insert(id, ());
11261118
} else if tag == (c::tag_table_moves_map as uint) {
11271119
dcx.maps.moves_map.insert(id, ());
11281120
} else {
@@ -1230,7 +1222,7 @@ impl fake_ext_ctxt for fake_session {
12301222
12311223
#[cfg(test)]
12321224
fn mk_ctxt() -> fake_ext_ctxt {
1233-
parse::new_parse_sess(None) as fake_ext_ctxt
1225+
@parse::new_parse_sess(None) as fake_ext_ctxt
12341226
}
12351227
12361228
#[cfg(test)]

src/librustc/middle/trans/cabi.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,8 @@ impl ABIInfo for LLVM_ABIInfo {
209209
}
210210
}
211211

212-
pub fn llvm_abi_info() -> ABIInfo {
213-
return LLVM_ABIInfo as ABIInfo;
212+
pub fn llvm_abi_info() -> @ABIInfo {
213+
return @LLVM_ABIInfo as @ABIInfo;
214214
}
215215

216216

src/librustc/middle/trans/cabi_arm.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,6 @@ impl ABIInfo for ARM_ABIInfo {
159159
}
160160
}
161161

162-
pub fn abi_info() -> ABIInfo {
163-
return ARM_ABIInfo as ABIInfo;
162+
pub fn abi_info() -> @ABIInfo {
163+
return @ARM_ABIInfo as @ABIInfo;
164164
}

src/librustc/middle/trans/cabi_x86_64.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -408,5 +408,5 @@ impl ABIInfo for X86_64_ABIInfo {
408408
}
409409

410410
pub fn x86_64_abi_info() -> ABIInfo {
411-
return X86_64_ABIInfo as ABIInfo;
411+
return @X86_64_ABIInfo as @ABIInfo;
412412
}

src/librustc/middle/trans/meth.rs

+5-20
Original file line numberDiff line numberDiff line change
@@ -870,26 +870,11 @@ pub fn trans_trait_cast(bcx: block,
870870
match vstore {
871871
ty::vstore_slice(*) | ty::vstore_box => {
872872
let mut llboxdest = GEPi(bcx, lldest, [0u, 1u]);
873-
if bcx.tcx().legacy_boxed_traits.contains_key(&id) {
874-
// Allocate an @ box and store the value into it
875-
let MallocResult {bcx: new_bcx, box: llbox, body: body} =
876-
malloc_boxed(bcx, v_ty);
877-
bcx = new_bcx;
878-
add_clean_free(bcx, llbox, heap_managed);
879-
bcx = expr::trans_into(bcx, val, SaveIn(body));
880-
revoke_clean(bcx, llbox);
881-
882-
// Store the @ box into the pair
883-
Store(bcx, llbox, PointerCast(bcx,
884-
llboxdest,
885-
T_ptr(val_ty(llbox))));
886-
} else {
887-
// Just store the pointer into the pair.
888-
llboxdest = PointerCast(bcx,
889-
llboxdest,
890-
T_ptr(type_of(bcx.ccx(), v_ty)));
891-
bcx = expr::trans_into(bcx, val, SaveIn(llboxdest));
892-
}
873+
// Just store the pointer into the pair.
874+
llboxdest = PointerCast(bcx,
875+
llboxdest,
876+
T_ptr(type_of(bcx.ccx(), v_ty)));
877+
bcx = expr::trans_into(bcx, val, SaveIn(llboxdest));
893878
}
894879
ty::vstore_uniq => {
895880
// Translate the uniquely-owned value into the second element of

src/librustc/middle/ty.rs

-2
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,6 @@ struct ctxt_ {
269269
adjustments: HashMap<ast::node_id, @AutoAdjustment>,
270270
normalized_cache: HashMap<t, t>,
271271
lang_items: middle::lang_items::LanguageItems,
272-
legacy_boxed_traits: HashMap<node_id, ()>,
273272
// A mapping from an implementation ID to the method info and trait
274273
// method ID of the provided (a.k.a. default) methods in the traits that
275274
// that implementation implements.
@@ -831,7 +830,6 @@ pub fn mk_ctxt(s: session::Session,
831830
adjustments: HashMap(),
832831
normalized_cache: new_ty_hash(),
833832
lang_items: lang_items,
834-
legacy_boxed_traits: HashMap(),
835833
provided_methods: HashMap(),
836834
provided_method_sources: HashMap(),
837835
supertraits: HashMap(),

0 commit comments

Comments
 (0)