Skip to content

Remove legacy object creation mode, and convert remaining uses of it #5147

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions src/libcore/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ pub fn FILE_reader(f: *libc::FILE, cleanup: bool) -> @Reader {

pub fn stdin() -> @Reader {
unsafe {
rustrt::rust_get_stdin() as @Reader
@rustrt::rust_get_stdin() as @Reader
}
}

Expand Down Expand Up @@ -642,11 +642,11 @@ impl Writer for *libc::FILE {
}
}

pub fn FILE_writer(f: *libc::FILE, cleanup: bool) -> Writer {
pub fn FILE_writer(f: *libc::FILE, cleanup: bool) -> @Writer {
if cleanup {
Wrapper { base: f, cleanup: FILERes(f) } as Writer
@Wrapper { base: f, cleanup: FILERes(f) } as @Writer
} else {
f as Writer
@f as @Writer
}
}

Expand Down Expand Up @@ -702,11 +702,11 @@ pub fn FdRes(fd: fd_t) -> FdRes {
}
}

pub fn fd_writer(fd: fd_t, cleanup: bool) -> Writer {
pub fn fd_writer(fd: fd_t, cleanup: bool) -> @Writer {
if cleanup {
Wrapper { base: fd, cleanup: FdRes(fd) } as Writer
@Wrapper { base: fd, cleanup: FdRes(fd) } as @Writer
} else {
fd as Writer
@fd as @Writer
}
}

Expand Down
12 changes: 6 additions & 6 deletions src/libcore/rand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,8 @@ pub fn Rng() -> Rng {
* all other generators constructed with the same seed. The seed may be any
* length.
*/
pub fn seeded_rng(seed: &[u8]) -> Rng {
seeded_randres(seed) as Rng
pub fn seeded_rng(seed: &[u8]) -> @Rng {
@seeded_randres(seed) as @Rng
}

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

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


Expand All @@ -472,10 +472,10 @@ pub fn task_rng() -> Rng {
unsafe {
let rng = seeded_randres(seed());
task::local_data::local_data_set(tls_rng_state, rng);
rng as Rng
@rng as @Rng
}
}
Some(rng) => rng as Rng
Some(rng) => @rng as @Rng
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/libcore/repr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ pub impl ReprVisitor {
unsafe {
let mut u = ReprVisitor(ptr, self.writer);
let v = reflect::MovePtrAdaptor(u);
visit_tydesc(inner, (v) as @TyVisitor);
visit_tydesc(inner, @v as @TyVisitor);
true
}
}
Expand Down Expand Up @@ -570,7 +570,7 @@ pub fn write_repr<T>(writer: @Writer, object: &T) {
let tydesc = intrinsic::get_tydesc::<T>();
let mut u = ReprVisitor(ptr, writer);
let v = reflect::MovePtrAdaptor(u);
visit_tydesc(tydesc, (v) as @TyVisitor)
visit_tydesc(tydesc, @v as @TyVisitor)
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/libcore/run.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ pub fn start_program(prog: &str, args: &[~str]) -> Program {
finished: false,
};

ProgRes(repr) as Program
@ProgRes(repr) as @Program
}

fn read_all(rd: io::Reader) -> ~str {
Expand Down
2 changes: 1 addition & 1 deletion src/libcore/task/local_data_priv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ pub unsafe fn local_set<T:Durable>(
// does not have a reference associated with it, so it may become invalid
// when the box is destroyed.
let data_ptr = cast::reinterpret_cast(&data);
let data_box = data as LocalData;
let data_box = @data as @LocalData;
// Construct new entry to store in the map.
let new_entry = Some((keyval, data_ptr, data_box));
// Find a place to put it.
Expand Down
5 changes: 2 additions & 3 deletions src/librustc/metadata/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,8 @@ pub enum astencode_tag { // Reserves 0x50 -- 0x6f
tag_table_method_map = 0x60,
tag_table_vtable_map = 0x61,
tag_table_adjustments = 0x62,
tag_table_legacy_boxed_trait = 0x63,
tag_table_moves_map = 0x64,
tag_table_capture_map = 0x65
tag_table_moves_map = 0x63,
tag_table_capture_map = 0x64
}

pub const tag_item_trait_method_sort: uint = 0x70;
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/metadata/filesearch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,11 @@ pub fn mk_filesearch(maybe_sysroot: Option<Path>,

let sysroot = get_sysroot(maybe_sysroot);
debug!("using sysroot = %s", sysroot.to_str());
FileSearchImpl {
@FileSearchImpl {
sysroot: sysroot,
addl_lib_search_paths: addl_lib_search_paths,
target_triple: str::from_slice(target_triple)
} as FileSearch
} as @FileSearch
}

pub fn search<T:Copy>(filesearch: FileSearch, pick: pick<T>) -> Option<T> {
Expand Down
10 changes: 1 addition & 9 deletions src/librustc/middle/astencode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -966,12 +966,6 @@ fn encode_side_tables_for_id(ecx: @e::EncodeContext,
}
}

do option::iter(&tcx.legacy_boxed_traits.find(&id)) |_x| {
do ebml_w.tag(c::tag_table_legacy_boxed_trait) {
ebml_w.id(id);
}
}

for maps.moves_map.find(&id).each |_| {
do ebml_w.tag(c::tag_table_moves_map) {
ebml_w.id(id);
Expand Down Expand Up @@ -1121,8 +1115,6 @@ fn decode_side_tables(xcx: @ExtendedDecodeContext,

if tag == (c::tag_table_mutbl as uint) {
dcx.maps.mutbl_map.insert(id, ());
} else if tag == (c::tag_table_legacy_boxed_trait as uint) {
dcx.tcx.legacy_boxed_traits.insert(id, ());
} else if tag == (c::tag_table_moves_map as uint) {
dcx.maps.moves_map.insert(id, ());
} else {
Expand Down Expand Up @@ -1230,7 +1222,7 @@ impl fake_ext_ctxt for fake_session {

#[cfg(test)]
fn mk_ctxt() -> fake_ext_ctxt {
parse::new_parse_sess(None) as fake_ext_ctxt
@parse::new_parse_sess(None) as fake_ext_ctxt
}

#[cfg(test)]
Expand Down
4 changes: 2 additions & 2 deletions src/librustc/middle/trans/cabi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ impl ABIInfo for LLVM_ABIInfo {
}
}

pub fn llvm_abi_info() -> ABIInfo {
return LLVM_ABIInfo as ABIInfo;
pub fn llvm_abi_info() -> @ABIInfo {
return @LLVM_ABIInfo as @ABIInfo;
}


4 changes: 2 additions & 2 deletions src/librustc/middle/trans/cabi_arm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,6 @@ impl ABIInfo for ARM_ABIInfo {
}
}

pub fn abi_info() -> ABIInfo {
return ARM_ABIInfo as ABIInfo;
pub fn abi_info() -> @ABIInfo {
return @ARM_ABIInfo as @ABIInfo;
}
2 changes: 1 addition & 1 deletion src/librustc/middle/trans/cabi_x86_64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -408,5 +408,5 @@ impl ABIInfo for X86_64_ABIInfo {
}

pub fn x86_64_abi_info() -> ABIInfo {
return X86_64_ABIInfo as ABIInfo;
return @X86_64_ABIInfo as @ABIInfo;
}
25 changes: 5 additions & 20 deletions src/librustc/middle/trans/meth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -870,26 +870,11 @@ pub fn trans_trait_cast(bcx: block,
match vstore {
ty::vstore_slice(*) | ty::vstore_box => {
let mut llboxdest = GEPi(bcx, lldest, [0u, 1u]);
if bcx.tcx().legacy_boxed_traits.contains_key(&id) {
// Allocate an @ box and store the value into it
let MallocResult {bcx: new_bcx, box: llbox, body: body} =
malloc_boxed(bcx, v_ty);
bcx = new_bcx;
add_clean_free(bcx, llbox, heap_managed);
bcx = expr::trans_into(bcx, val, SaveIn(body));
revoke_clean(bcx, llbox);

// Store the @ box into the pair
Store(bcx, llbox, PointerCast(bcx,
llboxdest,
T_ptr(val_ty(llbox))));
} else {
// Just store the pointer into the pair.
llboxdest = PointerCast(bcx,
llboxdest,
T_ptr(type_of(bcx.ccx(), v_ty)));
bcx = expr::trans_into(bcx, val, SaveIn(llboxdest));
}
// Just store the pointer into the pair.
llboxdest = PointerCast(bcx,
llboxdest,
T_ptr(type_of(bcx.ccx(), v_ty)));
bcx = expr::trans_into(bcx, val, SaveIn(llboxdest));
}
ty::vstore_uniq => {
// Translate the uniquely-owned value into the second element of
Expand Down
2 changes: 0 additions & 2 deletions src/librustc/middle/ty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,6 @@ struct ctxt_ {
adjustments: HashMap<ast::node_id, @AutoAdjustment>,
normalized_cache: HashMap<t, t>,
lang_items: middle::lang_items::LanguageItems,
legacy_boxed_traits: HashMap<node_id, ()>,
// A mapping from an implementation ID to the method info and trait
// method ID of the provided (a.k.a. default) methods in the traits that
// that implementation implements.
Expand Down Expand Up @@ -831,7 +830,6 @@ pub fn mk_ctxt(s: session::Session,
adjustments: HashMap(),
normalized_cache: new_ty_hash(),
lang_items: lang_items,
legacy_boxed_traits: HashMap(),
provided_methods: HashMap(),
provided_method_sources: HashMap(),
supertraits: HashMap(),
Expand Down
Loading